-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (61 loc) · 1.95 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI
on:
push:
branches:
- main
jobs:
run-tests:
name: Test the project
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install the library and its dependencies
run: npm install
- name: Set path to a chromium browser (needed for screenshot tests)
# See https://stackoverflow.com/a/57627150/8583692
# and https://stackoverflow.com/a/4181721/8583692
run: |
echo "{\"chromiumPath\": \"$(which chromium)\"}" > local.json
- name: Run the tests (with coverage)
id: run-tests
run: ./node_modules/.bin/jest --ci --colors --coverage # OR npm run test-with-coverage
- name: Upload the test report
if: always() # Run even if the previous steps failed
uses: actions/upload-artifact@v3
with:
name: test-report
path: |
test-report.xml
test-report.html
- name: Upload the test coverage report
if: ${{ steps.run-tests.conclusion == 'success' }}
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage/
- name: Download coverage report
if: ${{ steps.run-tests.conclusion == 'success' }}
uses: actions/download-artifact@v3
with:
name: coverage-report
path: coverage/
- name: Send the report to Codecov
if: ${{ steps.run-tests.conclusion == 'success' }}
uses: codecov/codecov-action@v3
with:
files: ./coverage/clover.xml
directory: ./coverage/
verbose: true
fail_ci_if_error: false
- name: Run lint
run: npm run lint-html
- name: Upload the lint HTML report
uses: actions/upload-artifact@v3
with:
name: lint-report
path: lint.html