-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (63 loc) · 1.56 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
64
65
66
name: CI
on:
push:
branches: [ dev, main ]
pull_request:
branches: [ dev, main ]
jobs:
lint-and-test:
name: Lint and test
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm i
env:
CI: true
- name: Lint JavaScript and JSON files
run: npm run lint
env:
CI: true
- name: Run tests
if: matrix.node != 20
run: npm run coverage
env:
CI: true
- name: Run tests with coverage
if: matrix.node == 20
run: npm run coverage
env:
CI: true
- name: Save code coverage to artifact
if: matrix.node == 20
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: "coverage/lcov.info"
retention-days: 5
coverage:
runs-on: ubuntu-latest
needs:
- lint-and-test
steps:
- uses: actions/checkout@v4
- name: Fetch code coverage artifact
uses: actions/download-artifact@v4
with:
name: code-coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true