Skip to content

Commit

Permalink
ci: add cargo test reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanp committed Mar 29, 2024
1 parent 210229f commit 3fc0cec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ jobs:

- name: kairos x86_64-linux
if: matrix.os == 'ubuntu-latest'
run: nix build -L --no-link --show-trace .#packages.x86_64-linux.kairos
run: nix build -L --out-link kairos-result --show-trace .#packages.x86_64-linux.kairos

- name: Create JUnit Kairos Test Report x86_64-linux
if: matrix.os == 'ubuntu-latest'
run: cat kairos-result/test-result.json | nix run nixpkgs#cargo2junit > kairos-test-result.xml

- name: Publish Kairos Test Report
uses: mikepenz/action-junit-report@v4
if: matrix.os == 'ubuntu-latest' || success() || failure() # always run even if the previous step fails
with:
report_paths: '*test-result.xml'

- name: kairos x86_64-darwin
if: matrix.os == 'macos-latest'
Expand Down
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
];
perSystem = { config, self', inputs', system, pkgs, lib, ... }:
let
rustToolchain = inputs'.fenix.packages.stable.toolchain;
rustToolchain = inputs'.fenix.packages.latest.toolchain;
craneLib = inputs.crane.lib.${system}.overrideToolchain rustToolchain;

kairosNodeAttrs = {
Expand Down Expand Up @@ -83,6 +83,11 @@

kairos = craneLib.buildPackage (kairosNodeAttrs // {
cargoArtifacts = self'.packages.kairos-deps;
cargoTestExtraArgs = "-- -Z unstable-options --format json --report-time | tee test-output.json";
postCheck = ''
mkdir -p $out
cp test-output.json $out
'';
});

default = self'.packages.kairos;
Expand Down

0 comments on commit 3fc0cec

Please sign in to comment.