refactor: add cache to CI #121
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test" | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
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 | |
echo "local /home/runner/.cache/nix/store" | \ | |
sudo tee -a /etc/nix/nix.conf > /dev/null | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: devenv | |
- 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 | |
macos_tests: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
runs-on: macos-latest | |
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 | |
colima delete | |
colima start --arch x86_64 | |
echo $SHELL | |
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock | |
docker --version | |
curl -s --unix-socket $HOME/.colima/default/docker.sock http/_ping | |
- uses: cachix/install-nix-action@v26 | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: devenv | |
- name: Install devenv.sh | |
run: nix profile install nixpkgs#devenv | |
- name: Build the devenv shell and run any pre-commit hooks | |
run: devenv test |