ci(check): add check workflow #8
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: "Check" | |
on: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
workflow_dispatch: | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- uses: DeterminateSystems/magic-nix-cache-action@v7 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: sunziping2016 | |
# Create a personal auth token from https://app.cachix.org/personal-auth-tokens, | |
# login to cachix, and then generate a signing key and provision it. | |
# cachix authtoken --stdin # paste personal auth token | |
# cachix generate-keypair sunziping2016 | |
# gh secret set CACHIX_SIGNING_KEY # paste signing key | |
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | |
- name: Run nix flake show | |
run: nix flake show --all-systems | |
- name: Run nix flake check | |
run: nix flake check --all-systems --accept-flake-config | |
- name: Run nix build | |
run: | | |
set -euo pipefail | |
IFS=$'\n' | |
system="$(nix eval --impure --raw --expr "builtins.currentSystem")" | |
checks="$(nix eval ".#checks.\"$system\"" --apply builtins.attrNames --json)" | |
for check in $(echo "$checks" | jq -r '.[]'); do | |
nix build ".#checks.\"$system\".\"$check\"" --accept-flake-config | |
done |