Skip to content

Add CI and cache

Add CI and cache #1

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Nix Format Check
run: nix fmt -- . --check
- name: Nix Syntax Check
run: nix flake check
build-plan:
# Save some computation. If the checks fail, don't build.
needs: checks
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Generate Build Matrix
id: set-matrix
run: |
matrix="$(nix eval --json .#githubActions.matrix)"
echo "matrix=$matrix" >> $GITHUB_OUTPUT
build:
needs: build-plan
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.build-plan.outputs.matrix)}}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v24
- name: Setup Cache
uses: ryanccn/attic-action@f75ac4b827cc5ce58fbf5d56a958db7aee78879c
with:
endpoint: https://hercules.servers.lowrisc.org/nix-cache/
cache: public
token: ${{ secrets.NIX_CACHE_TOKEN }}
- name: Build ${{ matrix.attr }}
run: nix build ".#{{ matrix.attr }}"