Skip to content

Commit

Permalink
ci: update codecov with nix
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto committed Apr 23, 2024
1 parent 1bead32 commit 16b4d7d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
31 changes: 6 additions & 25 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, llvm-tools-preview
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
run: nix develop .#codecov -c cargo build --release
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
run: nix develop .#codecov -c cargo test --all-features --no-fail-fast
- name: Install grcov
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
run: nix develop .#codecov -c cargo install grcov
- name: Generate coverage
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
run: nix develop .#codecov -c grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
*.swp

/dep_test
default*.profraw
9 changes: 9 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
wasm-pack
];
};

codecov = mkShell {
buildInputs = [
rust-bin.stable.latest.default
];
CARGO_INCREMENTAL = "0";
RUSTFLAGS = "-Cinstrument-coverage";
RUSTDOCFLAGS = "-Cinstrument-coverage";
};
};
}
);
Expand Down

0 comments on commit 16b4d7d

Please sign in to comment.