mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-03-31 00:00:03 +03:00
chore(nix): structure github CI nix flake checks
Not sure about this but it might make it easier to tell what the issue is when the nix CI is failing. Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
This commit is contained in:
parent
80d0a21ed3
commit
affc1b35d1
41
.github/workflows/nix-flake.yml
vendored
41
.github/workflows/nix-flake.yml
vendored
@ -1,22 +1,31 @@
|
|||||||
name: "Nix-Tests"
|
name: Nix Flake actions
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nix-flake-check:
|
nix-matrix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: cachix/install-nix-action@v27
|
- uses: cachix/install-nix-action@v30
|
||||||
with:
|
- id: set-matrix
|
||||||
extra_nix_config: |
|
name: Generate Nix Matrix
|
||||||
experimental-features = nix-command flakes
|
run: |
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
set -Eeu
|
||||||
- uses: cachix/cachix-action@v15
|
matrix="$(nix eval --json '.#githubActions.matrix')"
|
||||||
with:
|
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
||||||
name: bcachefs-tools
|
|
||||||
# If you chose API tokens for write access OR if you have a private cache
|
nix-build:
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
name: ${{ matrix.name }} (${{ matrix.system }})
|
||||||
- run: nix flake show
|
needs: nix-matrix
|
||||||
- run: nix flake check --print-build-logs
|
runs-on: ${{ matrix.os }}
|
||||||
- run: nix build --print-build-logs
|
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 }}'
|
||||||
|
21
flake.lock
generated
21
flake.lock
generated
@ -49,6 +49,26 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-github-actions": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1737420293,
|
||||||
|
"narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nix-github-actions",
|
||||||
|
"rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nix-github-actions",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1742422364,
|
"lastModified": 1742422364,
|
||||||
@ -85,6 +105,7 @@
|
|||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
"nix-github-actions": "nix-github-actions",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay",
|
"rust-overlay": "rust-overlay",
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
89
flake.nix
89
flake.nix
@ -22,6 +22,11 @@
|
|||||||
url = "github:edolstra/flake-compat";
|
url = "github:edolstra/flake-compat";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix-github-actions = {
|
||||||
|
url = "github:nix-community/nix-github-actions";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
@ -33,6 +38,7 @@
|
|||||||
crane,
|
crane,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
flake-compat,
|
flake-compat,
|
||||||
|
nix-github-actions,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
systems = nixpkgs.lib.filter (s: nixpkgs.lib.hasSuffix "-linux" s) nixpkgs.lib.systems.flakeExposed;
|
systems = nixpkgs.lib.filter (s: nixpkgs.lib.hasSuffix "-linux" s) nixpkgs.lib.systems.flakeExposed;
|
||||||
@ -40,6 +46,13 @@
|
|||||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
imports = [ inputs.treefmt-nix.flakeModule ];
|
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||||
|
|
||||||
|
flake = {
|
||||||
|
githubActions = nix-github-actions.lib.mkGithubMatrix {
|
||||||
|
# github actions supports fewer architectures
|
||||||
|
checks = nixpkgs.lib.getAttrs [ "aarch64-linux" "x86_64-linux" ] self.checks;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
inherit systems;
|
inherit systems;
|
||||||
|
|
||||||
perSystem =
|
perSystem =
|
||||||
@ -225,49 +238,55 @@
|
|||||||
default = config.packages.${name};
|
default = config.packages.${name};
|
||||||
};
|
};
|
||||||
|
|
||||||
checks.cargo-clippy = common.craneLib.cargoClippy (
|
checks = {
|
||||||
common.args
|
inherit (config.packages)
|
||||||
// {
|
bcachefs-tools
|
||||||
inherit (common) cargoArtifacts;
|
bcachefs-tools-fuse
|
||||||
cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings";
|
bcachefs-tools-fuse-i686-linux
|
||||||
}
|
;
|
||||||
);
|
|
||||||
|
|
||||||
# we have to build our own `craneLib.cargoTest`
|
cargo-clippy = common.craneLib.cargoClippy (
|
||||||
checks.cargo-test = common.craneLib.mkCargoDerivation (
|
|
||||||
common.args
|
|
||||||
// {
|
|
||||||
inherit (common) cargoArtifacts;
|
|
||||||
doCheck = true;
|
|
||||||
|
|
||||||
enableParallelChecking = true;
|
|
||||||
|
|
||||||
pnameSuffix = "-test";
|
|
||||||
buildPhaseCargoCommand = "";
|
|
||||||
checkPhaseCargoCommand = ''
|
|
||||||
make ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}} $makeFlags libbcachefs.a
|
|
||||||
cargo test --profile release -- --nocapture
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
# cargo clippy with the current minimum supported rust version
|
|
||||||
# according to Cargo.toml
|
|
||||||
checks.msrv =
|
|
||||||
let
|
|
||||||
rustVersion = cargoToml.package.rust-version;
|
|
||||||
common = pkgs.callPackage mkCommon { inherit crane rustVersion; };
|
|
||||||
in
|
|
||||||
common.craneLib.cargoClippy (
|
|
||||||
common.args
|
common.args
|
||||||
// {
|
// {
|
||||||
pname = "msrv";
|
|
||||||
inherit (common) cargoArtifacts;
|
inherit (common) cargoArtifacts;
|
||||||
cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
checks."32-bit" = config.packages."${cargoToml.package.name}-i686-linux";
|
# we have to build our own `craneLib.cargoTest`
|
||||||
|
cargo-test = common.craneLib.mkCargoDerivation (
|
||||||
|
common.args
|
||||||
|
// {
|
||||||
|
inherit (common) cargoArtifacts;
|
||||||
|
doCheck = true;
|
||||||
|
|
||||||
|
enableParallelChecking = true;
|
||||||
|
|
||||||
|
pnameSuffix = "-test";
|
||||||
|
buildPhaseCargoCommand = "";
|
||||||
|
checkPhaseCargoCommand = ''
|
||||||
|
make ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}} $makeFlags libbcachefs.a
|
||||||
|
cargo test --profile release -- --nocapture
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# cargo clippy with the current minimum supported rust version
|
||||||
|
# according to Cargo.toml
|
||||||
|
msrv =
|
||||||
|
let
|
||||||
|
rustVersion = cargoToml.package.rust-version;
|
||||||
|
common = pkgs.callPackage mkCommon { inherit crane rustVersion; };
|
||||||
|
in
|
||||||
|
common.craneLib.cargoClippy (
|
||||||
|
common.args
|
||||||
|
// {
|
||||||
|
pname = "msrv";
|
||||||
|
inherit (common) cargoArtifacts;
|
||||||
|
cargoClippyExtraArgs = "--all-targets --all-features -- --deny warnings";
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
inputsFrom = [
|
inputsFrom = [
|
||||||
|
Loading…
Reference in New Issue
Block a user