From e4c4644a8eb740b8b1541daaaaa4e3734b4bd742 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 18 Nov 2023 19:46:02 +0100 Subject: [PATCH 1/2] ci: cache using nix-community/cache-nix-action https://github.com/nix-community/cache-nix-action --- .forgejo/workflows/check.yml | 39 +++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index 1fd318bf..32899209 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -1,17 +1,54 @@ name: Flake checks on: [pull_request] +env: + USER: ci jobs: Check: - runs-on: nix-flakes + runs-on: ubuntu-latest steps: - name: Check out repository code uses: https://code.forgejo.org/actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update && sudo apt-get install --yes zstd jq + + - uses: https://github.com/nixbuild/nix-quick-install-action@v26 + with: + load_nixConfig: false + nix_conf: | + substituters = https://cache.nixos.org/ https://nix-community.cachix.org + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= + keep-outputs = true + + - name: Calculate flake.lock hash + id: flake-lock-hash + run: | + echo "hash=$(md5sum flake.lock | awk '{print $1}')" >> $GITHUB_OUTPUT + + - name: Restore and cache Nix store + uses: https://github.com/nix-community/cache-nix-action@v4 + id: nix-store-cache + with: + key: cache-${{ runner.os }}-nix-store-${{ steps.flake-lock-hash.outputs.hash }} + restore-keys: | + cache-${{ runner.os }}-nix-store- + + gc-linux: true + gc-max-store-size-linux: 10000000000 + + purge-caches: true + purge-keys: cache-${{ runner.os }}-nix-store- + purge-created: true + purge-created-max-age: 42 + - name: Prepare cachix uses: https://github.com/cachix/cachix-action@v12 with: name: pub-solar authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Run flake checks run: | nix --print-build-logs --verbose --accept-flake-config flake check From ebc7abf6855a4b4d477b1a28f1485a3f8a2094b1 Mon Sep 17 00:00:00 2001 From: teutat3s Date: Wed, 13 Dec 2023 01:52:01 +0100 Subject: [PATCH 2/2] ci: dependencies now included in actions-base-image https://git.pub.solar/pub-solar/actions-base-image --- .forgejo/workflows/check.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index 32899209..a10626b2 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -10,10 +10,6 @@ jobs: - name: Check out repository code uses: https://code.forgejo.org/actions/checkout@v4 - - name: Install dependencies - run: | - sudo apt-get update && sudo apt-get install --yes zstd jq - - uses: https://github.com/nixbuild/nix-quick-install-action@v26 with: load_nixConfig: false