Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions .github/workflows/coprocessor-cargo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203
with:
toolchain: stable
toolchain: "1.91.1"
components: llvm-tools-preview

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@a37010ded18ff788be4440302bd6830b1ae50d8b # v2.68.25
with:
tool: cargo-llvm-cov

- name: Install cargo dependencies
run: |
Expand All @@ -71,8 +77,8 @@ jobs:
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-coverage-

- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
Expand Down Expand Up @@ -101,7 +107,26 @@ jobs:
run: |
docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:latest

- name: Run tests
- name: Run tests with coverage
run: |
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
TEST_GLOBAL_LOCALSTACK=1 \
cargo llvm-cov --workspace --profile coverage -- --test-threads=1
working-directory: coprocessor/fhevm-engine

- name: Coverage summary
if: always()
run: |
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor TEST_GLOBAL_LOCALSTACK=1 cargo test --release -- --test-threads=1
REPORT=$(DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
cargo llvm-cov report --workspace --profile coverage 2>/dev/null) || true
{
echo '## Coverage: coprocessor/fhevm-engine'
if [ -n "$REPORT" ]; then
echo '```'
echo "$REPORT"
echo '```'
else
echo '*No coverage data available (tests may have failed before producing profiling data).*'
fi
} >> "$GITHUB_STEP_SUMMARY"
working-directory: coprocessor/fhevm-engine
7 changes: 7 additions & 0 deletions coprocessor/fhevm-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,10 @@ inherits = "release"
opt-level = 1
lto = false
codegen-units = 16

[profile.coverage]
inherits = "release"
opt-level = 1
lto = false
debug = 1
codegen-units = 16
1 change: 1 addition & 0 deletions coprocessor/fhevm-engine/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[toolchain]
channel = "1.91.1"
components = ["llvm-tools-preview"]
Loading