From 23d15942d3db5861215c74c2721eee08070d9881 Mon Sep 17 00:00:00 2001 From: Farbod Ahmadian Date: Tue, 5 Nov 2024 10:55:42 +0100 Subject: [PATCH] refactor: add cache to CI --- .github/workflows/test.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ff70e3f..8845f9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,14 +7,18 @@ on: - main jobs: - # Mac tests and Ubuntu tests are separated so that Ubuntu tests can - # run on both PRs and main; and Mac tests only on main branch. ubuntu_tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v26 + + - name: Setup Nix Store in User Directory + run: | + mkdir -p ~/.cache/nix/store + sudo echo "local /home/runner/.cache/nix/store" > /etc/nix/nix.conf + - uses: cachix/cachix-action@v14 with: name: devenv @@ -22,6 +26,14 @@ jobs: - name: Install devenv.sh run: nix profile install nixpkgs#devenv + - name: Cache Nix Store + uses: actions/cache@v3 + with: + path: ~/.cache/nix/store + key: nix-store-${{ runner.os }}-${{ hashFiles('**/shell.nix') }} + restore-keys: | + nix-store-${{ runner.os }}- + - name: Build the devenv shell and run any pre-commit hooks run: devenv test @@ -31,6 +43,14 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Cache Nix Store + uses: actions/cache@v3 + with: + path: /nix/store + key: nix-store-${{ runner.os }}-${{ hashFiles('**/shell.nix') }} + restore-keys: | + nix-store-${{ runner.os }}- + - name: Setup Docker (macOS) with Colima run: | brew install docker docker-compose colima