Skip to content

Commit

Permalink
Run CI on a matrix of OSes and platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
w4 committed Jan 6, 2025
1 parent 1d58bbd commit 6da5324
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 65 deletions.
83 changes: 24 additions & 59 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,32 @@ on: [push, pull_request]
name: CI

jobs:
check:
name: Check
nix-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check

# TODO: the build for this started failing in 1b34a74891423e118c567368c95b7e04f3b9ca63
#test:
# name: Test Suite
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
# - uses: actions-rs/cargo@v1
# with:
# command: test
- 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"
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt

cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1

clippy:
name: Clippy
runs-on: ubuntu-latest
check:
name: ${{ matrix.name }} (${{ matrix.system }})
needs: nix-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
- name: Authenticate with Cachix
uses: cachix/cachix-action@v15
with:
command: clippy
name: rgit
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: nix build -L '.#${{ matrix.attr }}'
21 changes: 21 additions & 0 deletions flake.lock

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

23 changes: 17 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@
url = "github:JordanForks/helix";
flake = false;
};

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

outputs = { self, nixpkgs, utils, crane, advisory-db, treefmt-nix, helix }:
outputs = { self, nixpkgs, utils, crane, advisory-db, treefmt-nix, helix, nix-github-actions }:
{
githubActions = nix-github-actions.lib.mkGithubMatrix {
checks = { inherit (self.checks) x86_64-linux x86_64-darwin aarch64-darwin; };
};
}
//
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
Expand Down Expand Up @@ -57,11 +68,11 @@
in
{
checks = {
inherit rgit;
rgit-clippy = craneLib.cargoClippy buildArgs;
rgit-doc = craneLib.cargoDoc buildArgs;
rgit-audit = craneLib.cargoAudit { inherit advisory-db; src = cargoOnlySrc; };
rgit-test = craneLib.cargoNextest (buildArgs // {
build = rgit;
clippy = craneLib.cargoClippy buildArgs;
doc = craneLib.cargoDoc buildArgs;
audit = craneLib.cargoAudit { inherit advisory-db; src = cargoOnlySrc; };
test = craneLib.cargoNextest (buildArgs // {
partitions = 1;
partitionType = "count";
});
Expand Down

0 comments on commit 6da5324

Please sign in to comment.