Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enhance ci reports #497

Merged
merged 14 commits into from
May 6, 2024
Merged
31 changes: 31 additions & 0 deletions .github/workflows/annotate-test-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Annotate CI run with test results
on:
workflow_run:
workflows:
- "Run Tests"
types:
- completed
permissions:
actions: read
contents: read
checks: write
pull-requests: write

jobs:
annotate:
name: Annotate CI run with test results
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'cancelled' }}
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x, 22.x]
timeout-minutes: 5
steps:
- name: Annotate CI run with test results
uses: dorny/[email protected]
with:
artifact: test-reports-${{ matrix.node-version }}
name: Test Results (${{matrix.node-version}}
path: "test-results.json"
reporter: mocha-json
42 changes: 42 additions & 0 deletions .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Comment PR Coverage
on:
pull_request:
branches:
- 'main'
permissions:
contents: read
pull-requests: write

jobs:
coverage_report:
name: Generate coverage report
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install Node Modules
run: npm ci

- name: Run Coverage Check
run: npm run lcov

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1

- name: Report code coverage
uses: zgosalvez/github-actions-report-lcov@v3
with:
coverage-files: coverage/lcov.info
minimum-coverage: 90
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
- main
permissions:
contents: read
checks: write
pull-requests: write

jobs:
build:
Expand All @@ -34,7 +36,7 @@ jobs:
- name: Run Tests and Linting
run: npm run test

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.node-version }}
path: test/reports/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"build": "npm run clean && npm run compile && npm run add-package-jsons",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"test:unit": "mocha --recursive --full-trace --exit",
"test:unit": "mocha --recursive --full-trace --exit --reporter json > test/reports/test-results.json",
"pretest:integration:init": "npm run build",
"test:integration:init": "sh ./test/scripts/initIntTests.sh",
"test:integration": "npm run test:integration:init && cucumber-js --config ./test/config/cucumber.mjs",
Expand Down
6 changes: 3 additions & 3 deletions test/config/cucumber.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
parallel: 0,
format: ['html:test/reports/cucumber-report.html'],
paths: ['test/features'],
forceExit: true
format: ["json:test/reports/cucumber-report.json"],
paths: ["test/features"],
forceExit: true,
};
Loading