diff --git a/.github/workflows/nix-ci.yml b/.github/workflows/nix-ci.yml index 45c42a253b..169d928a51 100644 --- a/.github/workflows/nix-ci.yml +++ b/.github/workflows/nix-ci.yml @@ -71,12 +71,6 @@ jobs: run: | sudo chown -R root:nixbld /nix/var/cache sudo chmod -R 770 /nix/var/cache - - name: Install Cachix - uses: cachix/cachix-action@v12 - with: - name: lean4 - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - skipPush: true # we push specific outputs only - name: Build run: | nix build $NIX_BUILD_ARGS .#cacheRoots -o push-build @@ -98,9 +92,6 @@ jobs: # gmplib.org consistently times out from GH actions # the GitHub token is to avoid rate limiting args: --base './dist' --no-progress --github-token ${{ secrets.GITHUB_TOKEN }} --exclude 'gmplib.org' './dist/**/*.html' - - name: Push to Cachix - run: | - [ -z "${{ secrets.CACHIX_AUTH_TOKEN }}" ] || cachix push -j4 lean4 ./push-* || true - name: Rebuild Nix Store Cache run: | rm -rf nix-store-cache || true diff --git a/.github/workflows/update-stage0.yml b/.github/workflows/update-stage0.yml index a2f051acd8..c18e3e79ef 100644 --- a/.github/workflows/update-stage0.yml +++ b/.github/workflows/update-stage0.yml @@ -40,18 +40,32 @@ jobs: run: | git config --global user.name "Lean stage0 autoupdater" git config --global user.email "<>" - - if: env.should_update_stage0 == 'yes' - uses: DeterminateSystems/nix-installer-action@main # Would be nice, but does not work yet: # https://github.com/DeterminateSystems/magic-nix-cache/issues/39 # This action does not run that often and building runs in a few minutes, so ok for now #- if: env.should_update_stage0 == 'yes' # uses: DeterminateSystems/magic-nix-cache-action@v2 - if: env.should_update_stage0 == 'yes' - name: Install Cachix - uses: cachix/cachix-action@v12 + name: Restore Build Cache + uses: actions/cache/restore@v3 with: - name: lean4 + path: nix-store-cache + key: Nix Linux-nix-store-cache-${{ github.sha }} + # fall back to (latest) previous cache + restore-keys: | + Nix Linux-nix-store-cache + - if: env.should_update_stage0 == 'yes' + name: Further Set Up Nix Cache + shell: bash -euxo pipefail {0} + run: | + # Nix seems to mutate the cache, so make a copy + cp -r nix-store-cache nix-store-cache-copy || true + - if: env.should_update_stage0 == 'yes' + name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + extra-conf: | + substituters = file://${{ github.workspace }}/nix-store-cache-copy?priority=10&trusted=true https://cache.nixos.org - if: env.should_update_stage0 == 'yes' run: nix run .#update-stage0-commit - if: env.should_update_stage0 == 'yes'