CI job: build, test and self-evaluate test results

This commit is contained in:
Michal Dorner 2020-11-17 22:47:18 +01:00
parent e97dbdd3e5
commit e516b7cf46
5 changed files with 84 additions and 21 deletions

30
.github/workflows/ci.yml vendored Normal file
View file

@ -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

View file

@ -1,20 +0,0 @@
name: 'build-test'
on:
pull_request:
paths-ignore: [ 'README.md' ]
push:
paths-ignore: [ 'README.md' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci
- run: npm run all
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./

View file

@ -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
package-lock.json generated
View file

@ -7312,6 +7312,35 @@
"throat": "^4.0.0" "throat": "^4.0.0"
} }
}, },
"jest-junit": {
"version": "12.0.0",
"resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-12.0.0.tgz",
"integrity": "sha512-+8K35LlboWiPuCnXSyiid7rFdxNlpCWWM20WEYe6IZH6psfUWKZmSpSRQ5tk0C0cBeDsvsnIzcef5mYhyJsbug==",
"dev": true,
"requires": {
"mkdirp": "^1.0.4",
"strip-ansi": "^5.2.0",
"uuid": "^3.3.3",
"xml": "^1.0.1"
},
"dependencies": {
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
}
}
},
"jest-leak-detector": { "jest-leak-detector": {
"version": "24.9.0", "version": "24.9.0",
"resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz",
@ -9919,6 +9948,12 @@
"async-limiter": "~1.0.0" "async-limiter": "~1.0.0"
} }
}, },
"xml": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz",
"integrity": "sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=",
"dev": true
},
"xml-name-validator": { "xml-name-validator": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",

View file

@ -10,7 +10,7 @@
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt", "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", "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\"", "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\"", "dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
@ -49,9 +49,20 @@
"eslint-plugin-jest": "^24.0.2", "eslint-plugin-jest": "^24.0.2",
"jest": "^24.9.0", "jest": "^24.9.0",
"jest-circus": "^26.6.1", "jest-circus": "^26.6.1",
"jest-junit": "^12.0.0",
"js-yaml": "^3.14.0", "js-yaml": "^3.14.0",
"prettier": "2.1.2", "prettier": "2.1.2",
"ts-jest": "^24.3.0", "ts-jest": "^24.3.0",
"typescript": "^4.0.3" "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}"
} }
} }