Skip to content

Commit

Permalink
CI job: build, test and self-evaluate test results
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Dorner committed Nov 17, 2020
1 parent e97dbdd commit e516b7c
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 21 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'build-test'
on:
pull_request:
paths-ignore: [ 'README.md' ]
push:
paths-ignore: [ 'README.md' ]
branches:
- main
workflow_dispatch:

jobs:
build-test:
name: 'Build & Test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- run: npm test
continue-on-error: true
- name: 'Evaluate test results'
uses: ./
with:
name: 'JEST Tests'
path: '__tests__/__results__/jest-junit.xml'
reporter: 'jest-junit'
- name: 'Sanity check' # re-run tests in case this action failed to detected failing test
run: npm test
20 changes: 0 additions & 20 deletions .github/workflows/test.yml

This file was deleted.

7 changes: 7 additions & 0 deletions __tests__/__results__/jest-junit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="jest tests" tests="1" failures="0" errors="0" time="2.249">
<testsuite name="__tests__\jest-junit.test.ts" errors="0" failures="0" skipped="0" timestamp="2020-11-17T21:26:30" time="2.195" tests="1">
<testcase classname="jest-junit tests" name="matches report snapshot" time="0.014">
</testcase>
</testsuite>
</testsuites>
35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
"test": "jest --ci --reporters=default --reporters=jest-junit",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
"dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
Expand Down Expand Up @@ -49,9 +49,20 @@
"eslint-plugin-jest": "^24.0.2",
"jest": "^24.9.0",
"jest-circus": "^26.6.1",
"jest-junit": "^12.0.0",
"js-yaml": "^3.14.0",
"prettier": "2.1.2",
"ts-jest": "^24.3.0",
"typescript": "^4.0.3"
},
"jest-junit": {
"suiteName": "jest tests",
"outputDirectory": "__tests__/__results__",
"outputName": "jest-junit.xml",
"ancestorSeparator": "",
"uniqueOutputName": "false",
"suiteNameTemplate": "{filepath}",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}"
}
}

0 comments on commit e516b7c

Please sign in to comment.