From fbb213c5318c054da38d3c9aee717c93f2c5e257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sat, 26 Dec 2020 15:06:38 +0000 Subject: [PATCH] github actions: cache nix store contents --- .github/workflows/check-build.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index e0cecd3..b7ee4b0 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -1,4 +1,4 @@ -name: "Test" +name: "Check Build" on: pull_request: push: @@ -6,7 +6,8 @@ on: - master - develop jobs: - tests: + check: + name: Flake Check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,4 +19,24 @@ jobs: install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install extra_nix_config: | experimental-features = nix-command flakes - - run: nix flake check -L + - name: Retrieve /nix/store archive + uses: actions/cache@v2 + id: cache-nix-store + with: + path: nix-store.dump + key: nix-store-${{ hashFiles('flake.*') }} + restore-keys: | + nix-store- + - name: Import /nix/store contents + if: ${{ steps.cache-nix-store.outputs.cache-hit }} + run: | + if [[ -f nix-store.dump ]]; then + nix-store --import < nix-store.dump || true + rm nix-store.dump + fi + - run: | + nix flake check -L + - name: Export /nix/store contents + if: ${{ !steps.cache-nix-store.outputs.cache-hit }} + run: | + nix-store --export $(nix-store -qR /nix/store/*-doom-emacs) > nix-store.dump