From eb65c4dbc62cc5c51951cab05e4aecc98728954f Mon Sep 17 00:00:00 2001 From: Luiz Irber Date: Sun, 11 Feb 2024 15:31:37 -0800 Subject: [PATCH 1/2] use cargo llvm-cov for coverage reports --- .github/workflows/rust.yml | 30 ++++++++++-------------------- flake.nix | 3 ++- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ddce31eb49..502f87aedf 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -85,31 +85,21 @@ jobs: coverage: runs-on: ubuntu-latest + env: + CARGO_TERM_COLOR: always steps: - uses: actions/checkout@v4 - - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - - name: Install cargo-binstall - run: | - wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-gnu.tgz - tar xf cargo-binstall-x86_64-unknown-linux-gnu.tgz - chmod +x cargo-binstall - mv cargo-binstall "$HOME/.cargo/bin" - - - name: Install cargo-tarpaulin - run: cargo binstall --no-confirm cargo-tarpaulin - - - name: Coverage with tarpaulin - run: cargo tarpaulin --all --all-features --timeout 600 --out xml -- --test-threads 1 - - - name: Upload Rust coverage to codecov + - name: Install Rust + run: rustup update stable + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --all-features --workspace --codecov --output-path codecov.json + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: flags: rust + files: codecov.json fail_ci_if_error: true lints: diff --git a/flake.nix b/flake.nix index 6739271d50..094869d510 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ inherit system overlays; }; rustVersion = pkgs.rust-bin.stable.latest.default.override { - #extensions = [ "rust-src" ]; + extensions = [ "rust-src" "llvm-tools-preview" ]; #targets = [ "x86_64-unknown-linux-musl" ]; targets = [ "wasm32-wasi" "wasm32-unknown-unknown" "wasm32-unknown-emscripten" ]; }; @@ -130,6 +130,7 @@ cargo-deny #cargo-semver-checks nixpkgs-fmt + cargo-llvm-cov ]; shellHook = '' From c53004519de00b6259dde3928b6c71d15505ba29 Mon Sep 17 00:00:00 2001 From: Luiz Irber Date: Sun, 11 Feb 2024 15:49:22 -0800 Subject: [PATCH 2/2] add linux-only deps --- flake.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 094869d510..dcd3e85cc9 100644 --- a/flake.nix +++ b/flake.nix @@ -59,14 +59,14 @@ { packages = { - lib = rustPlatform.buildRustPackage ( commonArgs // { + lib = rustPlatform.buildRustPackage (commonArgs // { name = "libsourmash"; copyLibs = true; cargoLock.lockFile = ./Cargo.lock; nativeBuildInputs = with rustPlatform; [ bindgenHook ]; }); - sourmash = python.buildPythonPackage ( commonArgs // rec { + sourmash = python.buildPythonPackage (commonArgs // rec { pname = "sourmash"; version = "4.8.6"; format = "pyproject"; @@ -128,14 +128,15 @@ cargo-outdated cargo-udeps cargo-deny - #cargo-semver-checks nixpkgs-fmt + ] ++ lib.optionals (!stdenv.isDarwin) [ + cargo-semver-checks cargo-llvm-cov ]; shellHook = '' - export MACOSX_DEPLOYMENT_TARGET=10.14 - ''; + export MACOSX_DEPLOYMENT_TARGET=10.14 + ''; # Needed for matplotlib LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ];