diff options
| author | Leitwolf11 | 2026-11-16 15:13:28 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-11-16 15:13:28 +0300 |
| commit | 5cee06d1887911764fc134d84cd412bbaa574c38 (patch) | |
| tree | c219efa998fb8d890f7988ad88873d188fd2fb10 | |
| parent | 3b6c73b515eff6a176cbdae712ae9c0ef41a1678 (diff) | |
| download | tazelish-ci/remote-cache.tar.gz | |
Build against the Progmasoft remote cacheci/remote-cache
The Bazel jobs read from remotecache.progmasoft.com, and pushes to the
default branch also write to it. The write credential reaches only those
pushes; pull requests read with the read credential and upload nothing,
and a pull request from a fork, which gets no secrets, builds without
the cache.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
| -rw-r--r-- | .github/workflows/ci.yml | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2046393..7840607 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,27 @@ jobs: - if: runner.os == 'Windows' shell: pwsh run: '"BAZEL_LLVM=C:\Program Files\LLVM" | Out-File -FilePath $env:GITHUB_ENV -Append' + # Pushes to the default branch write to the Progmasoft remote cache and + # pull requests only read it; a pull request from a fork gets no secrets + # and builds without it. + - name: Use the Progmasoft remote cache + shell: bash + env: + WRITES: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch }} + CACHE_READ: ${{ secrets.BAZEL_CACHE_READ }} + CACHE_WRITE: ${{ github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && secrets.BAZEL_CACHE_WRITE || '' }} + run: | + auth=$([ "$WRITES" = true ] && echo "$CACHE_WRITE" || echo "$CACHE_READ") + if [ -z "$auth" ]; then + echo "No cache credentials: building without the remote cache." + exit 0 + fi + { + echo "common --remote_cache=https://remotecache.progmasoft.com" + echo "common --remote_header=\"Authorization=Basic $auth\"" + [ "$WRITES" = true ] || echo "common --remote_upload_local_results=false" + } >> "$HOME/.bazelrc" + - run: bazelisk test //... - run: bazelisk build //:tazelish |