From 54910b4aff3e9967d60eb29cad04c987a1ba2ec8 Mon Sep 17 00:00:00 2001 From: Mac Malone Date: Tue, 21 Oct 2025 19:44:41 +0200 Subject: [PATCH 1/3] chore: use Lake remote cache in CI --- .github/workflows/build-template.yml | 16 ++++++++++++++++ .github/workflows/ci.yml | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-template.yml b/.github/workflows/build-template.yml index f5e3f656ede1..9102b484388e 100644 --- a/.github/workflows/build-template.yml +++ b/.github/workflows/build-template.yml @@ -102,6 +102,7 @@ jobs: if: matrix.cmultilib - name: Restore Cache id: restore-cache + if: matrix.name != 'Linux Lake (Cached)' uses: actions/cache/restore@v4 with: # NOTE: must be in sync with `save` below and with `restore-cache` in `update-stage0.yml` @@ -131,6 +132,10 @@ jobs: else echo "TARGET_STAGE=stage1" >> $GITHUB_ENV fi + - name: Download Lake Cache + if: matrix.name == 'Linux Lake (Cached)' + run: lake cache get --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + continue-on-error: true - name: Build run: | ulimit -c unlimited # coredumps @@ -187,6 +192,17 @@ jobs: build/stage1/**/*.c build/stage1/**/*.c.o*' || '' }} key: ${{ steps.restore-cache.outputs.cache-primary-key }} + - name: Upload Lake Cache + # Caching on cancellation created some mysterious issues perhaps related to improper build + # shutdown + if: matrix.name == 'Linux Lake' && !cancelled() + run: | + lake build -o build/lake-mappings.json + lake cache put build/lake-mappings.json --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + env: + LAKE_CACHE_KEY: ${{ secrets.LAKE_CACHE_KEY }} + LAKE_ARTIFACT_ENDPOINT: ${{ secrets.LAKE_ARTIFACT_ENDPOINT }} + LAKE_REVISION_ENDPOINT: ${{ secrets.LAKE_REVISION_ENDPOINT }} - name: Install run: | make -C build/$TARGET_STAGE install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4ce117fcbf7..173d5fdfea80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -200,8 +200,20 @@ jobs: "test": true, // NOTE: `test-speedcenter` currently seems to be broken on `ubuntu-latest` "test-speedcenter": large && level >= 2, - // made explicit until it can be assumed to have propagated to PRs - "CMAKE_OPTIONS": "-DUSE_LAKE=ON", + // `-DUSE_LAKE=ON` made explicit until it can be assumed to have propagated to PRs + "CMAKE_OPTIONS": "-DUSE_LAKE=ON -DUSE_LAKE_CACHE=ON", + }, + { + "name": "Linux Lake (Cached)", + "os": large ? "nscloud-ubuntu-22.04-amd64-8x16-with-cache" : "ubuntu-latest", + "enabled": true, + "check-rebootstrap": level >= 1, + "check-stage3": level >= 2, + "test": true, + "secondary": true, + // NOTE: `test-speedcenter` currently seems to be broken on `ubuntu-latest` + "test-speedcenter": large && level >= 2, + "CMAKE_OPTIONS": "-DUSE_LAKE=ON -DUSE_LAKE_CACHE=ON", }, { "name": "Linux Reldebug", From 2527ee4b3334377d5f2191f402ca45521aaf5831 Mon Sep 17 00:00:00 2001 From: Mac Malone Date: Tue, 21 Oct 2025 21:51:07 +0200 Subject: [PATCH 2/3] fix: use stage0 lake (& split build to have it) --- .github/workflows/build-template.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-template.yml b/.github/workflows/build-template.yml index 9102b484388e..75b906124f3d 100644 --- a/.github/workflows/build-template.yml +++ b/.github/workflows/build-template.yml @@ -102,7 +102,6 @@ jobs: if: matrix.cmultilib - name: Restore Cache id: restore-cache - if: matrix.name != 'Linux Lake (Cached)' uses: actions/cache/restore@v4 with: # NOTE: must be in sync with `save` below and with `restore-cache` in `update-stage0.yml` @@ -132,11 +131,7 @@ jobs: else echo "TARGET_STAGE=stage1" >> $GITHUB_ENV fi - - name: Download Lake Cache - if: matrix.name == 'Linux Lake (Cached)' - run: lake cache get --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} - continue-on-error: true - - name: Build + - name: Configure Build run: | ulimit -c unlimited # coredumps [ -d build ] || mkdir build @@ -173,6 +168,19 @@ jobs: fi # contortion to support empty OPTIONS with old macOS bash cmake .. --preset ${{ matrix.CMAKE_PRESET || 'release' }} -B . ${{ matrix.CMAKE_OPTIONS }} ${OPTIONS[@]+"${OPTIONS[@]}"} -DLEAN_INSTALL_PREFIX=$PWD/.. + - name: Build Stage 0 + run: | + ulimit -c unlimited # coredumps + cd build + time make stage0 -j$NPROC + - name: Download Lake Cache + if: matrix.name == 'Linux Lake (Cached)' + run: build/stage0/bin/lake cache get --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + continue-on-error: true + - name: Build Target Stage + run: | + ulimit -c unlimited # coredumps + cd build time make $TARGET_STAGE -j$NPROC # Should be done as early as possible and in particular *before* "Check rebootstrap" which # changes the state of stage1/ @@ -197,8 +205,8 @@ jobs: # shutdown if: matrix.name == 'Linux Lake' && !cancelled() run: | - lake build -o build/lake-mappings.json - lake cache put build/lake-mappings.json --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + build/stage0/bin/lake build -o build/lake-mappings.jsonl + build/stage0/bin/lake cache put build/lake-mappings.jsonl --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} env: LAKE_CACHE_KEY: ${{ secrets.LAKE_CACHE_KEY }} LAKE_ARTIFACT_ENDPOINT: ${{ secrets.LAKE_ARTIFACT_ENDPOINT }} From d406a90002616e45353b9c35499b00cdd508ae19 Mon Sep 17 00:00:00 2001 From: Mac Malone Date: Tue, 21 Oct 2025 22:39:46 +0200 Subject: [PATCH 3/3] fix: `cd src` --- .github/workflows/build-template.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-template.yml b/.github/workflows/build-template.yml index 75b906124f3d..75f5498bd7cb 100644 --- a/.github/workflows/build-template.yml +++ b/.github/workflows/build-template.yml @@ -175,7 +175,10 @@ jobs: time make stage0 -j$NPROC - name: Download Lake Cache if: matrix.name == 'Linux Lake (Cached)' - run: build/stage0/bin/lake cache get --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + run: | + cd src + ../build/stage0/bin/lake cache get \ + --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} continue-on-error: true - name: Build Target Stage run: | @@ -205,8 +208,10 @@ jobs: # shutdown if: matrix.name == 'Linux Lake' && !cancelled() run: | - build/stage0/bin/lake build -o build/lake-mappings.jsonl - build/stage0/bin/lake cache put build/lake-mappings.jsonl --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} + cd src + ../build/stage0/bin/lake build -o build/lake-mappings.jsonl + ../build/stage0/bin/lake cache put build/lake-mappings.jsonl \ + --repo=${{ github.event.pull_request.head.repo.full_name || github.repository }} env: LAKE_CACHE_KEY: ${{ secrets.LAKE_CACHE_KEY }} LAKE_ARTIFACT_ENDPOINT: ${{ secrets.LAKE_ARTIFACT_ENDPOINT }}