-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Update Windows dependency build action and workflow job
- Loading branch information
Showing
3 changed files
with
100 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,72 @@ | ||
name: 'Build Windows Dependencies' | ||
description: 'Builds Windows dependencies for obs-deps with specified architecture, type, and build config' | ||
name: Build Windows Dependencies | ||
description: Builds Windows dependencies for obs-deps with specified architecture, type, and build config | ||
inputs: | ||
target: | ||
description: 'Build target for dependencies' | ||
description: Build target for dependencies | ||
required: true | ||
type: | ||
description: 'Build type (shared or static libraries)' | ||
description: Build type (shared or static libraries) | ||
required: false | ||
default: 'static' | ||
default: static | ||
config: | ||
description: 'Build configuration' | ||
description: Build configuration | ||
required: false | ||
default: 'Release' | ||
cacheRevision: | ||
description: 'Cache revision number to force creation of new cache generation' | ||
default: Release | ||
workingDirectory: | ||
description: Working directory for repository action | ||
required: false | ||
default: '01' | ||
default: ${{ github.workspace }} | ||
runs: | ||
using: 'composite' | ||
using: composite | ||
steps: | ||
- name: Environment Setup | ||
id: deps-env-setup | ||
id: env-setup | ||
shell: pwsh | ||
run: | | ||
Get-Content .\deps.windows\*.ps1 > temp.txt | ||
$DepsHash = ((Get-FileHash -Path temp.txt -Algorithm SHA256).Hash) | ||
# Environment Setup | ||
"hash=${DepsHash}" >> $env:GITHUB_OUTPUT | ||
$Content = Get-Content ${{ inputs.workingDirectory }}/deps.windows/*.ps1 | ||
$Sha256Hasher = [System.Security.Cryptography.HashAlgorithm]::Create('sha256') | ||
$ContentHash = $Sha256Hasher.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($Content)) | ||
"hash=$([System.BitConverter]::ToString($ContentHash).Replace('-','').SubString(0,9).ToLower())" >> $env:GITHUB_OUTPUT | ||
- name: Restore Windows Dependencies from Cache | ||
id: deps-cache | ||
uses: actions/cache@v3 | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/*_build_temp/* | ||
!${{ github.workspace }}/*_build_temp/**/.git | ||
!${{ github.workspace }}/*_build_temp/*.tar.gz | ||
!${{ github.workspace }}/*_build_temp/*.tar.xz | ||
!${{ github.workspace }}/*_build_temp/*.zip | ||
key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ steps.deps-env-setup.outputs.hash }}-${{ inputs.cacheRevision }} | ||
${{ inputs.workingDirectory }}/*_build_temp/* | ||
!${{ inputs.workingDirectory }}/*_build_temp/**/.git | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.tar.gz | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.tar.xz | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.zip | ||
key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ inputs.config }}-${{ steps.env-setup.outputs.hash }} | ||
|
||
- name: Install Windows Dependencies | ||
if: ${{ steps.deps-cache.outputs.cache-hit == 'true' }} | ||
shell: pwsh | ||
run: | | ||
$Params = @{ | ||
SkipBuild = $true | ||
SkipUnpack = $true | ||
Target = '${{ inputs.target }}' | ||
Configuration = '${{ inputs.config }}' | ||
} | ||
if ( '${{ inputs.type }}' -eq 'shared' ) { $Params += @{Shared = $true} } | ||
# Install Windows Dependencies | ||
./Build-Dependencies.ps1 @Params | ||
- name: Build and Install Windows Dependencies | ||
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }} | ||
shell: pwsh | ||
run: | | ||
$Params = @{ | ||
Target = '${{ inputs.target }}' | ||
Configuration = '${{ inputs.config }}' | ||
Shared = $(if ( '${{ inputs.type }}' -eq 'shared' ) { $true } else { $false }) | ||
SkipBuild = $(if ( '${{ steps.deps-cache.outputs.cache-hit }}' -eq 'true' ) { $true } else { $false }) | ||
SkipUnpack = $(if ( '${{ steps.deps-cache.outputs.cache-hit }}' -eq 'true' ) { $true } else { $false }) | ||
} | ||
if ( '${{ inputs.type }}' -eq 'shared' ) { $Params += @{Shared = $true} } | ||
./Build-Dependencies.ps1 @Params | ||
- name: Save Windows Dependencies to Cache | ||
uses: actions/cache/save@v3 | ||
if: github.event_name == 'schedule' || (github.event_name == 'push' && steps.deps-cache.outputs.cache-hit != 'true') | ||
with: | ||
path: | | ||
${{ inputs.workingDirectory }}/*_build_temp/* | ||
!${{ inputs.workingDirectory }}/*_build_temp/**/.git | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.tar.gz | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.tar.xz | ||
!${{ inputs.workingDirectory }}/*_build_temp/*.zip | ||
key: ${{ inputs.target }}-deps-${{ inputs.type }}-${{ inputs.config }}-${{ steps.env-setup.outputs.hash }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters