Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"Reentrancy",
"SFID",
"EXTCODECOPY",
"EXTCODEHASH",
"solady",
"SLOAD",
"Bitmask",
Expand Down Expand Up @@ -101,6 +102,18 @@
"hexlify",
"repoint",
"repointed",
"cutover"
"cutover",
"autonumber",
"dedup",
"runbook",
"selfdestruct",
"SELFDESTRUCT",
"proxiable",
"codehash",
"codehashes",
"immediates",
"newbase",
"newcontract",
"opping"
]
}
40 changes: 38 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: yarn

- name: Run coverage
run: forge coverage --match-path "test/{Swarm*,ServiceProvider,FleetIdentity}*.t.sol" --ir-minimum --report lcov --report-file coverage.lcov
run: forge coverage --match-path "test/{Swarm*,ServiceProvider,FleetIdentity,collections/*}*.t.sol" --ir-minimum --report lcov --report-file coverage.lcov

- name: Upload coverage report
uses: actions/upload-artifact@v4
Expand All @@ -73,7 +73,7 @@ jobs:
update-comment: true
working-directory: ./

- name: Check line coverage threshold
- name: Check line coverage threshold (swarms)
run: |
# Extract line coverage from lcov report for src/swarms/ contracts only
# Parse lcov format: find swarm file sections and sum their LF/LH values
Expand Down Expand Up @@ -108,6 +108,42 @@ jobs:

echo "Coverage check passed: $COVERAGE% >= $THRESHOLD%"

- name: Check line coverage threshold (collections)
run: |
# Extract line coverage from lcov report for src/collections/ contracts only.
# While src/collections/ is documentation-only, this step skips cleanly with a
# warning. As soon as Solidity sources land, the gate enforces the same 95%
# threshold as swarms.
LINES_FOUND=$(awk '
/^SF:.*src\/collections\// { in_section = 1 }
/^end_of_record/ { in_section = 0 }
in_section && /^LF:/ { sum += substr($0, 4) }
END { print sum+0 }
' coverage.lcov)

LINES_HIT=$(awk '
/^SF:.*src\/collections\// { in_section = 1 }
/^end_of_record/ { in_section = 0 }
in_section && /^LH:/ { sum += substr($0, 4) }
END { print sum+0 }
' coverage.lcov)

if [ "$LINES_FOUND" -eq 0 ]; then
echo "::warning::No Solidity sources found under src/collections/ — coverage gate skipped (will enforce once contracts land)"
exit 0
fi

COVERAGE=$(awk "BEGIN {printf \"%.2f\", ($LINES_HIT / $LINES_FOUND) * 100}")
echo "Collections line coverage: $COVERAGE% ($LINES_HIT / $LINES_FOUND lines)"

THRESHOLD=95
if awk "BEGIN {exit !($COVERAGE < $THRESHOLD)}"; then
echo "Error: Line coverage ($COVERAGE%) is below the required threshold ($THRESHOLD%)"
exit 1
fi

echo "Coverage check passed: $COVERAGE% >= $THRESHOLD%"

Specification-PDF:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.base_ref == 'main'
Expand Down
Loading
Loading