1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 10:14:06 +02:00

nix check/test

This commit is contained in:
Robin Appelman 2023-06-03 15:04:53 +02:00
commit a4e66aa3b0
2 changed files with 28 additions and 21 deletions

View file

@ -22,29 +22,12 @@ jobs:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- uses: Swatinem/rust-cache@v2
- uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828
with:
command: "cargo check"
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- uses: Swatinem/rust-cache@v2
- uses: lriesebos/nix-develop-command@6f5f4830884d1957767e920c51d6118c9b0ac828
with:
command: "cargo test"
- run: nix build .#check
build:
name: Build
runs-on: ubuntu-latest
needs: check
strategy:
fail-fast: false
matrix:
@ -64,3 +47,17 @@ jobs:
with:
name: parser-${{ matrix.target }}
path: result/bin/parse_demo
test:
name: Test
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#test

View file

@ -31,13 +31,23 @@
cargo = toolchain;
rustc = toolchain;
};
src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["Cargo.*" "(src|tests|benches)(/.*)?"];
src = lib.sources.sourceByRegex (lib.cleanSource ./.) ["Cargo.*" "(src|benches|tests|test_data)(/.*)?"];
in rec {
packages = (lib.attrsets.genAttrs targets (target: (naerskForTarget target).buildPackage {
pname = "tf-demo-parser";
root = src;
})) // rec {
tf-demo-parser = packages.${hostTarget};
check = (naerskForTarget hostTarget).buildPackage {
pname = "tf-demo-parser";
cargoBuild = _: ''cargo $cargo_options check $cargo_build_options >> $cargo_build_output_json'';
root = src;
};
test = (naerskForTarget hostTarget).buildPackage {
pname = "tf-demo-parser";
root = src;
doCheck = true;
};
default = tf-demo-parser;
};