Skip to content

Commit 6d6e967

Browse files
authored
chore: only run mongodb tests when hotfix-store-mongodb code has changed (#297)
* Only run MongoDB tests when hotfix-store-mongodb code has changed * Dummy change to hotfix-store-mongodb to trigger tests
1 parent b403b53 commit 6d6e967

3 files changed

Lines changed: 60 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,54 @@ jobs:
2222
- name: Run clippy (all targets and features)
2323
run: cargo clippy --all-targets --all-features -- -Dclippy::all -D warnings
2424

25-
coverage:
25+
detect-changes:
2626
runs-on: ubuntu-latest
27+
outputs:
28+
mongodb: ${{ steps.filter.outputs.mongodb }}
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
- name: Detect path changes
33+
uses: dorny/paths-filter@v3
34+
id: filter
35+
with:
36+
filters: |
37+
mongodb:
38+
- 'crates/hotfix-store-mongodb/**'
39+
- 'crates/hotfix-store/**'
40+
41+
coverage-core:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
- name: Install cargo-llvm-cov
47+
uses: taiki-e/install-action@cargo-llvm-cov
48+
- name: Generate code coverage (excluding MongoDB)
49+
run: cargo llvm-cov --all-features --workspace --exclude hotfix-store-mongodb --lcov --output-path lcov.info
50+
- name: Upload coverage
51+
uses: codecov/codecov-action@v5
52+
with:
53+
fail_ci_if_error: true
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
flags: core
56+
files: lcov.info
57+
58+
coverage-mongodb:
59+
runs-on: ubuntu-latest
60+
needs: detect-changes
61+
if: needs.detect-changes.outputs.mongodb == 'true'
2762
steps:
2863
- name: Checkout
2964
uses: actions/checkout@v4
3065
- name: Install cargo-llvm-cov
3166
uses: taiki-e/install-action@cargo-llvm-cov
32-
- name: Generate code coverage
33-
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
34-
- name: Upload report
67+
- name: Generate MongoDB coverage
68+
run: cargo llvm-cov --all-features --package hotfix-store-mongodb --lcov --output-path lcov.info
69+
- name: Upload MongoDB coverage
3570
uses: codecov/codecov-action@v5
3671
with:
3772
fail_ci_if_error: true
3873
token: ${{ secrets.CODECOV_TOKEN }}
39-
verbose: true
74+
flags: mongodb
4075
files: lcov.info

codecov.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,22 @@ coverage:
1010
project:
1111
default:
1212
target: auto
13+
14+
flags:
15+
core:
16+
paths:
17+
- crates/hotfix/
18+
- crates/hotfix-cli/
19+
- crates/hotfix-codegen/
20+
- crates/hotfix-derive/
21+
- crates/hotfix-dictionary/
22+
- crates/hotfix-message/
23+
- crates/hotfix-store/
24+
- crates/hotfix-web/
25+
- crates/hotfix-web-ui/
26+
carryforward: true
27+
28+
mongodb:
29+
paths:
30+
- crates/hotfix-store-mongodb/
31+
carryforward: true

crates/hotfix-store-mongodb/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hotfix-store-mongodb"
3-
description = "MongoDB message store implementation for the hotfix FIX engine"
3+
description = "MongoDB message store implementation for the HotFIX engine"
44
version = "0.1.2"
55
authors.workspace = true
66
edition.workspace = true

0 commit comments

Comments
 (0)