mirror of
https://github.com/mitch030504/Wiicompiled_VR_Frame.git
synced 2026-10-06 06:00:25 +02:00
Reduce CI time using caching (#180)
* caching a little bit * provide CMake with the explicit path to sccache.exe * map ACTIONS_RESULTS_URL to ACTIONS_CACHE_URL so sccache can upload the files... * i removed the parallel oops * small change * doing a little bit of flag editing * update sccache and cache nuget stuff
This commit is contained in:
1 parent
88b990b060
commit
a135beb201
5 files changed
+49
-11
No files matched your search
@@ -30,6 +30,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
dotnet-version: '8.0.x'
|
dotnet-version: '8.0.x'
|
||||||
|
|
||||||
|
- name: Cache NuGet packages
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ~/.nuget/packages
|
||||||
|
key: ${{ runner.os }}-nuget-${{ hashFiles('translator/Translator.sln', '**/*.csproj', '**/*.props', '**/*.targets', '**/packages.lock.json', 'global.json', 'NuGet.config', 'nuget.config') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-nuget-
|
||||||
|
|
||||||
- name: Restore
|
- name: Restore
|
||||||
run: dotnet restore translator/Translator.sln
|
run: dotnet restore translator/Translator.sln
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,19 @@ jobs:
|
|||||||
path: Launcher/artifacts/downloads
|
path: Launcher/artifacts/downloads
|
||||||
key: windows-recomp-downloads-${{ hashFiles('Launcher/Prepare-PortableTools.ps1', 'Launcher/Prepare-Dependencies.ps1') }}
|
key: windows-recomp-downloads-${{ hashFiles('Launcher/Prepare-PortableTools.ps1', 'Launcher/Prepare-Dependencies.ps1') }}
|
||||||
|
|
||||||
|
# Install sccache.
|
||||||
|
- name: Run sccache-action
|
||||||
|
uses: mozilla/sccache-action@v0.0.11
|
||||||
|
|
||||||
|
# Tell CMake to use sccache and use GitHub's API.
|
||||||
|
- name: Configure sccache environment
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
"SCCACHE_GHA_ENABLED=true" | Add-Content -Path $env:GITHUB_ENV
|
||||||
|
"ACTIONS_CACHE_SERVICE_V2=on" | Add-Content -Path $env:GITHUB_ENV
|
||||||
|
"CMAKE_C_COMPILER_LAUNCHER=$env:SCCACHE_PATH" | Add-Content -Path $env:GITHUB_ENV
|
||||||
|
"CMAKE_CXX_COMPILER_LAUNCHER=$env:SCCACHE_PATH" | Add-Content -Path $env:GITHUB_ENV
|
||||||
|
|
||||||
- name: Prepare the shipped Windows toolchain
|
- name: Prepare the shipped Windows toolchain
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./Launcher/Prepare-PortableTools.ps1
|
run: ./Launcher/Prepare-PortableTools.ps1
|
||||||
@@ -36,6 +49,13 @@ jobs:
|
|||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./Launcher/Prepare-Dependencies.ps1
|
run: ./Launcher/Prepare-Dependencies.ps1
|
||||||
|
|
||||||
|
# Expose cache token context to the build script.
|
||||||
- name: Translate, compile the full runtime, and link
|
- name: Translate, compile the full runtime, and link
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: ./Launcher/Test-Recompilation.ps1 -Parallel 3
|
run: ./Launcher/Test-Recompilation.ps1 -Parallel 4
|
||||||
|
|
||||||
|
# Print cache results (even if the build fails)
|
||||||
|
- name: Show sccache stats
|
||||||
|
if: always()
|
||||||
|
shell: pwsh
|
||||||
|
run: sccache --show-stats
|
||||||
@@ -72,3 +72,5 @@ project.lock.json
|
|||||||
*.log
|
*.log
|
||||||
output.txt
|
output.txt
|
||||||
|
|
||||||
|
# Operating System
|
||||||
|
.DS_Store
|
||||||
@@ -117,12 +117,13 @@ function Get-MkwProjectPins([string]$ProjectFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-Checked([string]$FilePath, [string[]]$Arguments, [string]$Description,
|
function Invoke-Checked([string]$FilePath, [string[]]$Arguments, [string]$Description,
|
||||||
[string]$LogPrefix = 'MKWCBUILD', [string]$StepId = '') {
|
[string]$LogPrefix = 'MKWCBUILD', [string]$StepId = '', [bool]$WaitForProcessTree = $true) {
|
||||||
<#
|
<#
|
||||||
Runs a build tool and turns a non-zero exit code into a described failure. Start-Process -Wait
|
Runs a build tool and turns a non-zero exit code into a described failure. By default,
|
||||||
is deliberate: it waits for the whole process tree, since a .NET single-file bundle host may
|
Start-Process -Wait waits for the whole process tree, since a .NET single-file bundle host may
|
||||||
hand off to an extracted child that PowerShell's call operator would not wait for. Start-Process
|
hand off to an extracted child that PowerShell's call operator would not wait for. Callers that
|
||||||
doesn't publish $LASTEXITCODE, so this sets it manually for callers that check it.
|
need to avoid waiting on unrelated descendants can opt into the call-operator path.
|
||||||
|
Start-Process doesn't publish $LASTEXITCODE, so this sets it manually for callers that check it.
|
||||||
-StepId emits the machine-readable form the installer's progress bar consumes (BuildStepIds in
|
-StepId emits the machine-readable form the installer's progress bar consumes (BuildStepIds in
|
||||||
WiiCompiled.Setup/InstallProgress.cs); the human sentence stays on the same log line.
|
WiiCompiled.Setup/InstallProgress.cs); the human sentence stays on the same log line.
|
||||||
#>
|
#>
|
||||||
@@ -132,9 +133,14 @@ function Invoke-Checked([string]$FilePath, [string[]]$Arguments, [string]$Descri
|
|||||||
if ($_.Contains('"')) { throw "A native build argument contains an unsupported quote: $_" }
|
if ($_.Contains('"')) { throw "A native build argument contains an unsupported quote: $_" }
|
||||||
'"' + $_ + '"'
|
'"' + $_ + '"'
|
||||||
})
|
})
|
||||||
$process = Start-Process -FilePath $FilePath -ArgumentList $quotedArguments `
|
if ($WaitForProcessTree) {
|
||||||
-NoNewWindow -Wait -PassThru
|
$process = Start-Process -FilePath $FilePath -ArgumentList $quotedArguments `
|
||||||
$exitCode = $process.ExitCode
|
-NoNewWindow -Wait -PassThru
|
||||||
|
$exitCode = $process.ExitCode
|
||||||
|
} else {
|
||||||
|
& $FilePath @Arguments
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
}
|
||||||
$global:LASTEXITCODE = $exitCode
|
$global:LASTEXITCODE = $exitCode
|
||||||
if ($exitCode -ne 0) { throw "$Description failed with exit code $exitCode." }
|
if ($exitCode -ne 0) { throw "$Description failed with exit code $exitCode." }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,9 +136,11 @@ try {
|
|||||||
-CxxCompiler (Join-Path $compilerBin 'x86_64-w64-mingw32-clang++.exe') `
|
-CxxCompiler (Join-Path $compilerBin 'x86_64-w64-mingw32-clang++.exe') `
|
||||||
-ResourceCompiler (Join-Path $compilerBin 'x86_64-w64-mingw32-windres.exe') `
|
-ResourceCompiler (Join-Path $compilerBin 'x86_64-w64-mingw32-windres.exe') `
|
||||||
-DependenciesDirectory $dependencies -AdditionalArguments @('-DMKW_BUILD_PRODUCTS=ON')
|
-DependenciesDirectory $dependencies -AdditionalArguments @('-DMKW_BUILD_PRODUCTS=ON')
|
||||||
Invoke-Checked $cmake $configure 'Configuring the production Windows runtime'
|
Invoke-Checked $cmake $configure 'Configuring the production Windows runtime' `
|
||||||
|
-WaitForProcessTree $false
|
||||||
Invoke-Checked $cmake @('--build', $nativeBuild, '--target', 'WiiCompiled', '--parallel', "$Parallel") `
|
Invoke-Checked $cmake @('--build', $nativeBuild, '--target', 'WiiCompiled', '--parallel', "$Parallel") `
|
||||||
'Compiling and linking the synthetic product with the full runtime'
|
'Compiling and linking the synthetic product with the full runtime' `
|
||||||
|
-WaitForProcessTree $false
|
||||||
Assert-File (Join-Path $nativeBuild 'WiiCompiled.exe') 'Linked synthetic product'
|
Assert-File (Join-Path $nativeBuild 'WiiCompiled.exe') 'Linked synthetic product'
|
||||||
} finally {
|
} finally {
|
||||||
$env:PATH = $oldPath
|
$env:PATH = $oldPath
|
||||||
|
|||||||
Reference in new issue
Block a user