Files
workavia-drive/.github/workflows/coverage.yml
T
Romaric Mourgues 4ec4db27a3 Update coverage.yml
2023-04-19 16:13:21 +02:00

39 lines
1.9 KiB
YAML

name: backend-coverage
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
branches: [main]
paths:
- "tdrive/backend/node/**"
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- name: unit-test
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:unit
- name: e2e-mongo-test
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:e2e
- name: generate coverage summary json
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:merge:json
- name: generate coverage summary text
run: cd tdrive && docker-compose -f docker-compose.tests.yml run -e NODE_OPTIONS=--unhandled-rejections=warn node npm run test:merge:text
- name: check generation
run: |
cp ./tdrive/coverage/merged/coverage-summary.json report.json
echo '{ "numFailedTestSuites": 0, "numFailedTests": 0, "numPassedTestSuites": 1, "numPassedTests": 1, "numPendingTestSuites": 0, "numPendingTests": 0, "numRuntimeErrorTestSuites": 0, "numTodoTests": 0, "numTotalTestSuites": 56, "numTotalTests": 156, "openHandles": [], "snapshot": {}, "startTime": 0, "success": true, "testResults": [], "wasInterrupted": false, "coverageMap": ' > tmp.txt
cat report.json >> tmp.txt
echo "}" >> tmp.txt
cat tmp.txt > report.json
cat report.json
- name: Coverage
uses: ArtiomTr/jest-coverage-report-action@v2.2.2
with:
coverage-file: report.json
base-coverage-file: report.json
skip-step: all