Skip to content

Commit

Permalink
tests(ci): run flake checks in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Feb 21, 2025
1 parent 2633a58 commit 2744dc1
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 6 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Nix Flake actions

on:
push:
branches: [ "main", "next-major" ]
pull_request:
branches: [ "main", "next-major" ]

jobs:
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
matrix="$(nix eval --json '.#githubActions.matrix')"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
nix-build:
name: ${{ matrix.name }} (${{ matrix.system }})
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- run: nix build -L '.#${{ matrix.attr }}'
31 changes: 26 additions & 5 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,7 +3,7 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
systems.url = "github:nix-systems/default-linux";
systems.url = "github:nix-systems/default";

rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -13,6 +13,9 @@

git-hooks.url = "github:chrjabs/git-hooks.nix";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";

nix-github-actions.url = "github:nix-community/nix-github-actions";
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = {
Expand All @@ -22,6 +25,7 @@
rust-overlay,
nix-tools,
git-hooks,
nix-github-actions,
}: let
lib = nixpkgs.lib;
forAllSystems = lib.genAttrs (import systems);
Expand Down Expand Up @@ -164,5 +168,9 @@
};
};
});

githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = self.checks // self.packages;
};
};
}

0 comments on commit 2744dc1

Please sign in to comment.