ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

move cargo tests to a seperate binary (#308)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

marshmallow
autofix-ci[bot]
and committed by
GitHub
28510074 b99980c6

+47 -9
+7 -8
.github/workflows/test.yml
··· 26 26 - uses: ./.github/actions/setup-nix 27 27 with: 28 28 cachixToken: ${{ secrets.CACHIX_AUTH_TOKEN }} 29 - - uses: actions/cache@v4 30 - with: 31 - path: | 32 - ~/.cargo/registry 33 - ~/.cargo/git 34 - target 35 - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 29 + - name: Build Tests 30 + run: nix build .#cargo-tests -L -vv 36 31 - name: Cargo Tests 37 - run: nix develop --print-build-logs -v --command cargo test 32 + run: | 33 + nix develop \ 34 + --print-build-logs \ 35 + -v \ 36 + --command result/bin/run-tests
+2 -1
flake.nix
··· 33 33 ./nix/hooks.nix # pre-commit hooks 34 34 ./nix/utils.nix # utility functions 35 35 ./nix/shells.nix 36 + ./nix/tests.nix 36 37 ./wire/cli 37 38 ./wire/key_agent 38 39 ./doc ··· 52 53 inherit (self.packages.x86_64-linux) docs; 53 54 } 54 55 // lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: { 55 - inherit (self.packages.${system}) wire wire-small; 56 + inherit (self.packages.${system}) wire wire-small cargo-tests; 56 57 }); 57 58 58 59 tests = lib.filterAttrs (n: _: (lib.hasPrefix "vm" n)) self.checks.x86_64-linux;
+38
nix/tests.nix
··· 1 + { 2 + perSystem = 3 + { 4 + craneLib, 5 + pkgs, 6 + commonArgs, 7 + ... 8 + }: 9 + let 10 + tests = craneLib.buildPackage ( 11 + { 12 + cargoArtifacts = craneLib.buildDepsOnly commonArgs; 13 + doCheck = false; 14 + 15 + doNotPostBuildInstallCargoBinaries = true; 16 + 17 + buildPhase = '' 18 + cargo test --no-run 19 + ''; 20 + 21 + installPhaseCommand = '' 22 + mkdir -p $out 23 + cp $(ls target/debug/deps/{wire,lib,key_agent}-* | grep -v "\.d") $out 24 + ''; 25 + } 26 + // commonArgs 27 + ); 28 + in 29 + { 30 + packages.cargo-tests = pkgs.writeShellScriptBin "run-tests" '' 31 + set -e 32 + for item in "${tests}"/*; do 33 + echo "running $item" 34 + "$item" 35 + done 36 + ''; 37 + }; 38 + }