Nix flake checks now do ci-checks (#88)
* Nix flake checks now do ci-checks * Make sure checks actually run
This commit is contained in:
parent
898d053c70
commit
444a9fd8f2
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
@ -22,13 +22,13 @@ jobs:
|
||||||
path: ~/.ci-store
|
path: ~/.ci-store
|
||||||
key: lint-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
|
key: lint-store-x86_64-linux-${{ hashFiles('**/Cargo.lock', '**/flake.lock') }}-v1
|
||||||
- name: Check rustfmt
|
- name: Check rustfmt
|
||||||
run: nix develop --store ~/.ci-store --command ci-check-rustfmt
|
run: nix develop --store ~/.ci-store --command check-rustfmt
|
||||||
- name: Check Spelling
|
- name: Check Spelling
|
||||||
run: nix develop --store ~/.ci-store --command ci-check-spelling
|
run: nix develop --store ~/.ci-store --command check-spelling
|
||||||
- name: Check nixpkgs-fmt formatting
|
- name: Check nixpkgs-fmt formatting
|
||||||
run: nix develop --store ~/.ci-store --command ci-check-nixpkgs-fmt
|
run: nix develop --store ~/.ci-store --command check-nixpkgs-fmt
|
||||||
- name: Check EditorConfig conformance
|
- name: Check EditorConfig conformance
|
||||||
run: nix develop --store ~/.ci-store --command ci-check-editorconfig
|
run: nix develop --store ~/.ci-store --command check-editorconfig
|
||||||
|
|
||||||
build-x86_64-linux:
|
build-x86_64-linux:
|
||||||
name: Build x86_64 Linux
|
name: Build x86_64 Linux
|
||||||
|
|
42
flake.nix
42
flake.nix
|
@ -50,15 +50,8 @@
|
||||||
devShells = forAllSystems ({ system, pkgs, ... }:
|
devShells = forAllSystems ({ system, pkgs, ... }:
|
||||||
let
|
let
|
||||||
toolchain = fenixToolchain system;
|
toolchain = fenixToolchain system;
|
||||||
ci = import ./nix/ci.nix { inherit pkgs; };
|
|
||||||
eclint = import ./nix/eclint.nix { inherit pkgs; };
|
eclint = import ./nix/eclint.nix { inherit pkgs; };
|
||||||
|
check = import ./nix/check.nix { inherit pkgs eclint toolchain; };
|
||||||
spellcheck = pkgs.writeScriptBin "spellcheck" ''
|
|
||||||
${pkgs.codespell}/bin/codespell \
|
|
||||||
--ignore-words-list crate,pullrequest,pullrequests,ser \
|
|
||||||
--skip target \
|
|
||||||
.
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
|
@ -82,8 +75,11 @@
|
||||||
git
|
git
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
eclint
|
eclint
|
||||||
|
check.check-rustfmt
|
||||||
|
check.check-spelling
|
||||||
|
check.check-nixpkgs-fmt
|
||||||
|
check.check-editorconfig
|
||||||
]
|
]
|
||||||
++ ci
|
|
||||||
++ lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ libiconv darwin.apple_sdk.frameworks.Security ]);
|
++ lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ libiconv darwin.apple_sdk.frameworks.Security ]);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -93,14 +89,30 @@
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
|
toolchain = fenixToolchain system;
|
||||||
|
eclint = import ./nix/eclint.nix { inherit pkgs; };
|
||||||
|
check = import ./nix/check.nix { inherit pkgs eclint toolchain; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
format = pkgs.runCommand "check-format"
|
check-rustfmt = pkgs.runCommand "check-rustfmt" { buildInputs = [ check.check-rustfmt ]; } ''
|
||||||
{
|
cd ${./.}
|
||||||
buildInputs = with pkgs; [ rustfmt cargo ];
|
check-rustfmt
|
||||||
} ''
|
touch $out
|
||||||
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}
|
'';
|
||||||
touch $out # it worked!
|
check-spelling = pkgs.runCommand "check-spelling" { buildInputs = [ check.check-spelling ]; } ''
|
||||||
|
cd ${./.}
|
||||||
|
check-spelling
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
check-nixpkgs-fmt = pkgs.runCommand "check-nixpkgs-fmt" { buildInputs = [ check.check-nixpkgs-fmt ]; } ''
|
||||||
|
cd ${./.}
|
||||||
|
check-nixpkgs-fmt
|
||||||
|
touch $out
|
||||||
|
'';
|
||||||
|
check-editorconfig = pkgs.runCommand "check-editorconfig" { buildInputs = [ pkgs.git check.check-editorconfig ]; } ''
|
||||||
|
cd ${./.}
|
||||||
|
check-editorconfig
|
||||||
|
touch $out
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
44
nix/check.nix
Normal file
44
nix/check.nix
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{ pkgs, eclint, toolchain }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs) writeShellApplication;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
|
||||||
|
# Format
|
||||||
|
check-rustfmt = (writeShellApplication {
|
||||||
|
name = "check-rustfmt";
|
||||||
|
runtimeInputs = [ toolchain ];
|
||||||
|
text = "cargo fmt --check";
|
||||||
|
});
|
||||||
|
|
||||||
|
# Spelling
|
||||||
|
check-spelling = (writeShellApplication {
|
||||||
|
name = "check-spelling";
|
||||||
|
runtimeInputs = with pkgs; [ git codespell ];
|
||||||
|
text = ''
|
||||||
|
codespell \
|
||||||
|
--ignore-words-list ba,sur,crate,pullrequest,pullrequests,ser \
|
||||||
|
--skip target \
|
||||||
|
.
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
# NixFormatting
|
||||||
|
check-nixpkgs-fmt = (writeShellApplication {
|
||||||
|
name = "check-nixpkgs-fmt";
|
||||||
|
runtimeInputs = with pkgs; [ git nixpkgs-fmt findutils ];
|
||||||
|
text = ''
|
||||||
|
nixpkgs-fmt --check .
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
# EditorConfig
|
||||||
|
check-editorconfig = (writeShellApplication {
|
||||||
|
name = "check-editorconfig";
|
||||||
|
runtimeInputs = with pkgs; [ eclint ];
|
||||||
|
text = ''
|
||||||
|
eclint .
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
}
|
39
nix/ci.nix
39
nix/ci.nix
|
@ -1,39 +0,0 @@
|
||||||
{ pkgs }:
|
|
||||||
|
|
||||||
let
|
|
||||||
inherit (pkgs) writeScriptBin;
|
|
||||||
in
|
|
||||||
[
|
|
||||||
|
|
||||||
# Format
|
|
||||||
(writeScriptBin "ci-check-rustfmt" "cargo fmt --check")
|
|
||||||
|
|
||||||
# Test
|
|
||||||
(writeScriptBin "ci-test-rust" "cargo test")
|
|
||||||
|
|
||||||
# Spelling
|
|
||||||
(writeScriptBin "ci-check-spelling" ''
|
|
||||||
codespell \
|
|
||||||
--ignore-words-list ba,sur,crate,pullrequest,pullrequests,ser \
|
|
||||||
--skip target \
|
|
||||||
.
|
|
||||||
'')
|
|
||||||
|
|
||||||
# NixFormatting
|
|
||||||
(writeScriptBin "ci-check-nixpkgs-fmt" ''
|
|
||||||
git ls-files '*.nix' | xargs | nixpkgs-fmt --check
|
|
||||||
'')
|
|
||||||
|
|
||||||
# EditorConfig
|
|
||||||
(writeScriptBin "ci-check-editorconfig" ''
|
|
||||||
eclint
|
|
||||||
'')
|
|
||||||
|
|
||||||
(writeScriptBin "ci-all" ''
|
|
||||||
ci-check-rustfmt
|
|
||||||
ci-test-rust
|
|
||||||
ci-check-spelling
|
|
||||||
ci-check-nixpkgs-fmt
|
|
||||||
ci-check-editorconfig
|
|
||||||
'')
|
|
||||||
]
|
|
Loading…
Reference in a new issue