|
31 | 31 | - .github/workflows/coprocessor-cargo-tests.yml |
32 | 32 | - coprocessor/fhevm-engine/** |
33 | 33 | - coprocessor/proto/** |
| 34 | + - ci/coverage-thresholds.json |
34 | 35 | cargo-tests: |
35 | 36 | name: coprocessor-cargo-test/cargo-tests (bpr) |
36 | 37 | needs: check-changes |
|
54 | 55 | uses: dtolnay/rust-toolchain@a54c7afa936fefeb4456b2dd8068152669aa8203 |
55 | 56 | with: |
56 | 57 | toolchain: stable |
| 58 | + components: llvm-tools-preview |
| 59 | + |
| 60 | + - name: Install cargo-llvm-cov |
| 61 | + uses: taiki-e/install-action@a37010ded18ff788be4440302bd6830b1ae50d8b # v2.68.25 |
| 62 | + with: |
| 63 | + tool: cargo-llvm-cov |
57 | 64 |
|
58 | 65 | - name: Install cargo dependencies |
59 | 66 | run: | |
|
71 | 78 | ~/.cargo/registry |
72 | 79 | ~/.cargo/git |
73 | 80 | target |
74 | | - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
75 | | - restore-keys: ${{ runner.os }}-cargo- |
| 81 | + key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }} |
| 82 | + restore-keys: ${{ runner.os }}-cargo-coverage- |
76 | 83 |
|
77 | 84 | - name: Login to GitHub Container Registry |
78 | 85 | uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 |
@@ -101,7 +108,19 @@ jobs: |
101 | 108 | run: | |
102 | 109 | docker run --rm -d -p 4566:4566 --name localstack localstack/localstack:latest |
103 | 110 |
|
104 | | - - name: Run tests |
| 111 | + - name: Run tests with coverage |
| 112 | + run: | |
| 113 | + DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \ |
| 114 | + TEST_GLOBAL_LOCALSTACK=1 \ |
| 115 | + cargo llvm-cov --workspace --profile coverage -- --test-threads=1 |
| 116 | + working-directory: coprocessor/fhevm-engine |
| 117 | + |
| 118 | + - name: Coverage summary |
| 119 | + if: always() |
105 | 120 | run: | |
106 | | - DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor TEST_GLOBAL_LOCALSTACK=1 cargo test --release -- --test-threads=1 |
| 121 | + echo '## Coverage: coprocessor/fhevm-engine' >> "$GITHUB_STEP_SUMMARY" |
| 122 | + echo '```' >> "$GITHUB_STEP_SUMMARY" |
| 123 | + DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \ |
| 124 | + cargo llvm-cov report --workspace --profile coverage >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || echo 'No coverage data available' >> "$GITHUB_STEP_SUMMARY" |
| 125 | + echo '```' >> "$GITHUB_STEP_SUMMARY" |
107 | 126 | working-directory: coprocessor/fhevm-engine |
0 commit comments