Skip to content

Commit

Permalink
Merge pull request foundationdb-rs#191 from foundationdb-rs/189-fix-c…
Browse files Browse the repository at this point in the history
…overage-ci

189 fix coverage ci
  • Loading branch information
PierreZ authored Nov 15, 2024
2 parents c00898d + c6623a8 commit 664b67c
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 62 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,58 +133,6 @@ jobs:
- name: Clippy
run: cargo clippy --features num-bigint,embedded-fdb-include,tenant-experimental,fdb-7_3 --no-default-features

coverage:
name: Code coverage
runs-on: ubuntu-latest

env:
CARGO_INCREMENTAL: "0"
RUST_BACKTRACE: 1
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"

steps:
- uses: actions/checkout@v3

- name: Install FoundationDB
uses: foundationdb-rs/[email protected]
with:
version: "7.3.27"

- name: Enable tenant
run: fdbcli --exec "configure single memory tenant_mode=optional_experimental"

- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly

- name: Build bindingtester
run: cargo build -p bindingtester --target x86_64-unknown-linux-gnu

- name: Test
# doc tests are disabled fow now as they do not compile with -Cpanic=abort
run: cargo test -p foundationdb --tests --no-fail-fast --target x86_64-unknown-linux-gnu --features=num-bigint,embedded-fdb-include,tenant-experimental,fdb-7_3

- name: Setup bindingtester
run: scripts/setup_bindingtester.sh target/x86_64-unknown-linux-gnu/debug/bindingtester

- name: Run bindingtester
run: scripts/run_bindingtester.sh 50

- id: coverage
uses: actions-rs/[email protected]

- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}

- name: Codecov upload
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ steps.coverage.outputs.report }}

audit:
name: Cargo audit
runs-on: ubuntu-latest
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Coverage

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

jobs:
codecov:
name: Code coverage
runs-on: ubuntu-latest

env:
CARGO_INCREMENTAL: "0"

steps:
- uses: actions/checkout@v4

- name: Install FoundationDB
uses: foundationdb-rs/[email protected]
with:
version: "7.3.27"

- name: Enable tenant
run: fdbcli --exec "configure single memory tenant_mode=optional_experimental"

- name: Install Rust
run: rustup update stable

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Install Rust
run: rustup update stable

- name: llvm-cov show-env
run: cargo llvm-cov show-env --export-prefix

- name: Build bindingTester
run: source <(cargo llvm-cov show-env --export-prefix) && cargo build -p bindingtester

- name: Test main crate
run: source <(cargo llvm-cov show-env --export-prefix) && cargo test -p foundationdb --tests --no-fail-fast --features=num-bigint,embedded-fdb-include,tenant-experimental,fdb-7_3

- name: Setup bindingtester
run: scripts/setup_bindingtester.sh target/debug/bindingtester

- name: Run bindingtester
run: source <(cargo llvm-cov show-env --export-prefix) && scripts/run_bindingtester.sh 50

- name: Generate code coverage
run: source <(cargo llvm-cov show-env --export-prefix) && cargo llvm-cov report --lcov --output-path lcov.info

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true
10 changes: 5 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,24 @@
cargo-expand
cargo-edit
cargo-msrv
# uncomment when https://github.com/NixOS/nixpkgs/issues/354058 is fixed
# cargo-llvm-cov
cargo-audit
rust-analyzer
(rust-bin.${rustChannel}.latest.default.override {
extensions = [ "rust-src" ];
extensions = [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"rust-analyzer"
"llvm-tools-preview"
];
})
rust-bin.${rustChannel}.latest.rustfmt
rust-bin.${rustChannel}.latest.clippy

git-cliff
release-plz
release-plz

# FDB part
libfdb73
Expand All @@ -62,7 +70,7 @@
RUST_TOOLCHAIN_PATH = "${pkgs.rust-bin.${rustChannel}.latest.default}/bin";
RUST_SRC_PATH = "${pkgs.rust-bin.${rustChannel}.latest.rust-src}/lib/rustlib/src/rust/library";

RUST_BACKTRACE= "1";
RUST_BACKTRACE = "1";
};
};
}
1 change: 1 addition & 0 deletions foundationdb/tests/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ fn test_get() {
futures::executor::block_on(test_set_raw_option_async()).expect("failed to run");
futures::executor::block_on(test_fails_to_set_unknown_raw_option()).expect("failed to run");
#[cfg(any(
feature = "fdb-7_3",
feature = "fdb-7_1",
feature = "fdb-7_0",
feature = "fdb-6_3",
Expand Down

0 comments on commit 664b67c

Please sign in to comment.