Skip to content

Commit 8cd7b3e

Browse files
committed
fix(ci): separate coverage job to prevent cancellation
Coverage was not updating on gh-pages because cancel-in-progress: true was cancelling the workflow before the deployment step could complete. - Split test job into 'test' (fast, no coverage) and 'coverage' (full) - Coverage job has its own concurrency group with cancel-in-progress: false - Coverage will now queue and complete even with frequent commits
1 parent f0c5e30 commit 8cd7b3e

File tree

7 files changed

+525
-334
lines changed

7 files changed

+525
-334
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,29 @@ jobs:
5050
test:
5151
name: Test
5252
runs-on: platform-runner
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: dtolnay/rust-toolchain@stable
56+
- uses: taiki-e/install-action@v2
57+
with:
58+
tool: cargo-nextest
59+
- uses: Swatinem/rust-cache@v2
60+
with:
61+
shared-key: "platform-ci"
62+
save-if: false
63+
64+
- name: Run tests
65+
run: cargo nextest run --workspace -E 'not (test(/live/) | test(/integration/))'
66+
67+
# Coverage runs in a separate job with its own concurrency group
68+
# This prevents coverage deployment from being cancelled by new commits
69+
coverage:
70+
name: Coverage
71+
runs-on: platform-runner
72+
if: github.ref == 'refs/heads/main'
73+
concurrency:
74+
group: coverage-deploy
75+
cancel-in-progress: false
5376
permissions:
5477
contents: write
5578
steps:
@@ -65,25 +88,18 @@ jobs:
6588
shared-key: "platform-ci"
6689
save-if: false
6790

68-
- name: Run tests
69-
if: github.ref != 'refs/heads/main'
70-
run: cargo nextest run --workspace -E 'not (test(/live/) | test(/integration/))'
71-
7291
- name: Run tests with coverage
73-
if: github.ref == 'refs/heads/main'
7492
run: |
7593
cargo llvm-cov nextest --workspace --json --output-path coverage.json -E 'not (test(/live/) | test(/integration/))'
7694
cargo llvm-cov report --html --output-dir coverage-html
7795
7896
- name: Upload coverage HTML report
79-
if: github.ref == 'refs/heads/main'
8097
uses: actions/upload-artifact@v4
8198
with:
8299
name: coverage-html
83100
path: coverage-html/
84101

85102
- name: Publish coverage HTML to GitHub Pages
86-
if: github.ref == 'refs/heads/main'
87103
uses: peaceiris/actions-gh-pages@v4
88104
with:
89105
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -92,7 +108,6 @@ jobs:
92108
keep_files: true
93109

94110
- name: Generate and deploy coverage badge
95-
if: github.ref == 'refs/heads/main'
96111
run: |
97112
COVERAGE=$(jq '.data[0].totals.lines.percent // 0 | round' coverage.json)
98113
echo "Coverage: $COVERAGE%"
@@ -103,8 +118,8 @@ jobs:
103118
else COLOR="red"; fi
104119
curl -s "https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR}" > badges/coverage.svg
105120
106-
- uses: peaceiris/actions-gh-pages@v4
107-
if: github.ref == 'refs/heads/main'
121+
- name: Deploy coverage badge
122+
uses: peaceiris/actions-gh-pages@v4
108123
with:
109124
github_token: ${{ secrets.GITHUB_TOKEN }}
110125
publish_dir: ./badges

crates/storage/src/dynamic.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,12 @@ impl DynamicStorage {
328328
let mut map = match existing {
329329
None => HashMap::new(),
330330
Some(StorageValue::Map(map)) => map,
331-
Some(_) => return Err(MiniChainError::TypeMismatch(format!(
331+
Some(_) => {
332+
return Err(MiniChainError::TypeMismatch(format!(
332333
"Cannot set map field on non-map value at key {:?}. Existing value is not a map.",
333334
key
334-
))),
335+
)))
336+
}
335337
};
336338

337339
map.insert(field.into(), value);

0 commit comments

Comments
 (0)