Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try adding a CI job matrix #141

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@ on:
workflow_call:

jobs:
check:
matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"

build:
name: ${{ matrix.name }} (${{ matrix.system }})
needs: matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix flake check
- run: nix build -L '.#${{ matrix.attr }}'
41 changes: 24 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nix-github-actions = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/nix-github-actions";
};
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:numtide/treefmt-nix";
};
};

outputs =
Expand All @@ -16,6 +23,7 @@
./nix/dev-shell.nix
./nix/lint.nix
./nix/web.nix
./nix/ci.nix
];
};
}
12 changes: 12 additions & 0 deletions nix/ci.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
inputs,
self,
lib,
...
}:
{
flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
# To save time, we only test on x86 Linux in CI.
checks = lib.getAttrs [ "x86_64-linux" ] self.checks;
};
}
Loading