Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8a7d14b
chore: migrate from nyc to c8 for test coverage
eablack Mar 3, 2026
2be4b01
chore: complete c8 migration and improve coverage reporting
eablack Mar 3, 2026
46a35f2
chore: replace third-party coverage action with gh cli script
eablack Mar 3, 2026
f62140d
feat: add coverage comparison to PR comments
eablack Mar 3, 2026
f2fab94
refactor: move coverage reporting to separate workflow
eablack Mar 3, 2026
49a5772
chore: only upload coverage artifacts on PR runs
eablack Mar 3, 2026
4d3b745
fix: correct YAML indentation in coverage-report workflow
eablack Mar 3, 2026
c434930
fix: use heredoc to avoid YAML pipe parsing issues
eablack Mar 3, 2026
1e36d1c
fix: use printf instead of multiline strings for YAML
eablack Mar 3, 2026
18bc852
chore: lower coverage thresholds to 60%
eablack Mar 3, 2026
cd4977e
refactor: change coverage workflow to pull_request trigger with polling
eablack Mar 3, 2026
ffb05f0
perf: run base branch tests in parallel with PR tests
eablack Mar 3, 2026
de45c20
fix: use actions/download-artifact@v7 to bypass IP allowlist
eablack Mar 3, 2026
1a8cf2a
refactor: run base coverage tests in parallel with PR tests
eablack Mar 3, 2026
7d78148
fix: use github.event.pull_request check instead of event_name
eablack Mar 3, 2026
22fed74
fix: make coverage workflow handle both pull_request and push events
eablack Mar 3, 2026
3e01272
fix: simplify coverage workflow to only run on pull_request events
eablack Mar 3, 2026
a154904
fix: add pull_request trigger to enable coverage reporting
eablack Mar 3, 2026
580a046
fix: limit push trigger to main branches to avoid duplicate runs
eablack Mar 3, 2026
273ecb6
fix: handle missing base coverage data gracefully
eablack Mar 4, 2026
c193fa3
feat: add coverage comparison check that fails on decrease
eablack Mar 4, 2026
dba0ffa
feat: allow coverage decrease if all metrics >= 90%
eablack Mar 4, 2026
4bccf39
refactor: extract coverage comparison logic to reusable script
eablack Mar 4, 2026
6b58d3a
chore: cleanup .c8rc.json excludes
eablack Mar 4, 2026
c79effe
perf: optimize CI by running c8 coverage only on ubuntu-22.x
eablack Mar 4, 2026
d229e7e
fix: use bash shell for conditional test script in CI
eablack Mar 4, 2026
4cbb351
add src to c8 definition to improve --all performance
eablack Mar 4, 2026
090f6b0
more performance improvements for c8
eablack Mar 4, 2026
f2b1bb6
update download and upload artifact versions.
eablack Mar 4, 2026
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
27 changes: 27 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"src": ["src"],
"extension": [".ts"],
"exclude": [
"**/*.d.ts",
"**/*.test.ts",
"test/**/*",
"dist/**/*",
"coverage/**",
"bin/**/*",
"scripts/**/*",
"tmp/**/*",
"**/*.mjs"
],
"include": [
"src/**/*.ts"
],
"reporter": [
"text-summary",
"html",
"lcov"
],
"statements": 60,
"branches": 60,
"functions": 60,
"lines": 60
}
110 changes: 105 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
name: Tests

on:
[push, workflow_dispatch]
push:
# Only run on pushes to main branches and long-lived feature branches
# PRs will trigger via pull_request event to avoid duplicate runs
branches:
- main
- v11.0.0
# Add any long-lived feature branches here
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22.x
cache: npm
- run: npm ci
- name: linting
run: npm run lint

test:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -19,9 +40,88 @@ jobs:
cache: npm
- run: npm ci
- name: unit tests
run: npm test
- name: linting
run: npm run lint
shell: bash
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ] && [ "${{ matrix.node-version }}" = "22.x" ]; then
npm run pretest && npm run test:unit:justTest:ci:coverage
else
npm test
fi
- name: Upload coverage reports
if: always() && github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30
- name: Coverage summary
if: always() && matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x'
run: |
if [ -f coverage/lcov.info ]; then
echo "## 📊 Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Coverage |" >> $GITHUB_STEP_SUMMARY
echo "|--------|----------|" >> $GITHUB_STEP_SUMMARY

# Parse coverage from lcov.info
LINES_FOUND=$(grep -o "LF:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')
LINES_HIT=$(grep -o "LH:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')
FUNCS_FOUND=$(grep -o "FNF:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')
FUNCS_HIT=$(grep -o "FNH:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')
BRANCHES_FOUND=$(grep -o "BRF:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')
BRANCHES_HIT=$(grep -o "BRH:[0-9]*" coverage/lcov.info | cut -d: -f2 | awk '{s+=$1} END {print s}')

LINES_PCT=$(awk "BEGIN {printf \"%.2f\", ($LINES_HIT/$LINES_FOUND)*100}")
FUNCS_PCT=$(awk "BEGIN {printf \"%.2f\", ($FUNCS_HIT/$FUNCS_FOUND)*100}")
BRANCHES_PCT=$(awk "BEGIN {printf \"%.2f\", ($BRANCHES_HIT/$BRANCHES_FOUND)*100}")

echo "| Lines | ${LINES_PCT}% (${LINES_HIT}/${LINES_FOUND}) |" >> $GITHUB_STEP_SUMMARY
echo "| Functions | ${FUNCS_PCT}% (${FUNCS_HIT}/${FUNCS_FOUND}) |" >> $GITHUB_STEP_SUMMARY
echo "| Branches | ${BRANCHES_PCT}% (${BRANCHES_HIT}/${BRANCHES_FOUND}) |" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Coverage report not found" >> $GITHUB_STEP_SUMMARY
fi

base-coverage:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 22.x
cache: npm
- run: npm ci
- name: Run tests on base branch with full coverage
run: npm run pretest && npm run test:unit:justTest:ci:coverage
- name: Upload base coverage
uses: actions/upload-artifact@v6
with:
name: coverage-base
path: coverage/
retention-days: 1

coverage-check:
runs-on: ubuntu-latest
needs: [test, base-coverage]
if: github.event_name == 'pull_request' && needs.test.result == 'success' && needs.base-coverage.result == 'success'
steps:
- uses: actions/checkout@v6
- name: Download PR coverage
uses: actions/download-artifact@v7
with:
name: coverage-report
path: coverage-pr/
- name: Download base coverage
uses: actions/download-artifact@v7
with:
name: coverage-base
path: coverage-base/
- name: Compare coverage and fail if decreased
run: ./scripts/ci/compare-coverage.sh coverage-pr coverage-base --fail-on-decrease

integration:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -94,7 +194,7 @@ jobs:
# dummy job needed to pass changeling compliance because it only watches one build
done:
runs-on: macos-latest
needs: [test, integration, acceptance]
needs: [lint, test, integration, acceptance]
steps:
- run: echo done
working-directory: /
3 changes: 3 additions & 0 deletions cspell-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ ECCN
echoerr
Edmonds
elif
EOFCOMMENT
EOFTABLE
EMEA
envfile
envl
Expand Down Expand Up @@ -315,6 +317,7 @@ resetstat
reviewapps
rikki
rollbar
romeovs
rootdir
rootfulroot
routable
Expand Down
34 changes: 0 additions & 34 deletions nyc-config.js

This file was deleted.

Loading
Loading