Skip to content

Commit

Permalink
ci: Use nix-github-actions
Browse files Browse the repository at this point in the history
GHA is running out of disk, let's run in parallell.
  • Loading branch information
adisbladis committed Nov 4, 2024
1 parent 927e667 commit c3e18bc
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 23 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/ci.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/workflows/nix-github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Nix Flake actions

on:
pull_request:
push:

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 }}'
23 changes: 22 additions & 1 deletion flake.lock

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

8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

zephyr.url = "github:zephyrproject-rtos/zephyr/v3.7.0";
zephyr.flake = false;

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

outputs =
Expand All @@ -21,6 +24,7 @@
zephyr,
pyproject-nix,
nixpkgs-python,
nix-github-actions,
}:
(
let
Expand All @@ -42,6 +46,10 @@
{
checks = self.packages;

githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" "aarch64-darwin" ] self.checks;
};

packages = forAllSystems (
system:
let
Expand Down

0 comments on commit c3e18bc

Please sign in to comment.