diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-14 22:07:08 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-14 22:07:08 +0300 |
| commit | 012e819b5b8e17c6f608b730088101a29318d475 (patch) | |
| tree | 2473581f2f2e6228ab55fdcc39283bcab37fb729 /.github/workflows | |
| parent | b88aa1301e324c80d46cac767f87109f38cf4fe2 (diff) | |
ci: restore fast reliable checks
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ci.yml | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca1ebce8..dc715802 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,7 @@ jobs: uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 with: version: 0.15.2 + use-cache: ${{ matrix.kind != 'windows' }} - name: Restore Homebrew Zig cache if: runner.os == 'macOS' @@ -107,8 +108,19 @@ jobs: run: | HOMEBREW_NO_AUTO_UPDATE=1 brew install zig@0.15 echo "$(brew --prefix zig@0.15)/bin" >> "$GITHUB_PATH" + echo "ZIG_GLOBAL_CACHE_DIR=$GITHUB_WORKSPACE/.zig-cache" >> "$GITHUB_ENV" + echo "ZIG_LOCAL_CACHE_DIR=$GITHUB_WORKSPACE/.zig-cache" >> "$GITHUB_ENV" "$(brew --prefix zig@0.15)/bin/zig" version + - name: Restore Zig build cache + if: runner.os == 'macOS' || matrix.kind == 'windows' + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 + with: + path: .zig-cache + key: zig-build-v1-${{ runner.os }}-${{ runner.arch }}-0.15.2-${{ github.run_id }}-${{ github.run_attempt }} + restore-keys: | + zig-build-v1-${{ runner.os }}-${{ runner.arch }}-0.15.2- + - name: Install macOS build tools if: runner.os == 'macOS' run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake ninja @@ -119,14 +131,6 @@ jobs: cache-bin: false key: ${{ matrix.os }} - - name: Remove Zig caches - if: matrix.kind == 'windows' - shell: pwsh - run: | - Remove-Item -Recurse -Force .zig-cache -ErrorAction SilentlyContinue - Remove-Item -Recurse -Force vendor/libghostty-vt/.zig-cache -ErrorAction SilentlyContinue - Remove-Item -Recurse -Force vendor/libghostty-vt/zig-out -ErrorAction SilentlyContinue - - name: Run checks if: matrix.kind == 'unix' run: just ci '${{ matrix.nextest_filter }}' @@ -143,8 +147,21 @@ jobs: throw "command failed with exit code $LASTEXITCODE`: $Command $($Arguments -join ' ')" } } + function Invoke-CargoWithZigCacheRecovery { + param([string[]]$Arguments) + & cargo @Arguments + if ($LASTEXITCODE -eq 0) { + return + } + + Write-Warning "cargo compile failed; clearing Zig build caches and retrying once" + Remove-Item -Recurse -Force .zig-cache -ErrorAction SilentlyContinue + Remove-Item -Recurse -Force vendor/libghostty-vt/.zig-cache -ErrorAction SilentlyContinue + Remove-Item -Recurse -Force vendor/libghostty-vt/zig-out -ErrorAction SilentlyContinue + Invoke-Checked cargo $Arguments + } Invoke-Checked cargo @("fmt", "--check") - Invoke-Checked cargo @("clippy", "--bin", "herdr", "--locked", "--target", "x86_64-pc-windows-msvc", "--", "-D", "warnings") + Invoke-CargoWithZigCacheRecovery @("clippy", "--bin", "herdr", "--locked", "--target", "x86_64-pc-windows-msvc", "--", "-D", "warnings") Invoke-Checked cargo @("test", "--locked", "--target", "x86_64-pc-windows-msvc", "--bin", "herdr", "windows_") Invoke-Checked cargo @("test", "--locked", "--target", "x86_64-pc-windows-msvc", "--bin", "herdr", "server::client_transport::tests") Invoke-Checked cargo @("build", "--locked", "--target", "x86_64-pc-windows-msvc") |
