-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (89 loc) · 2.68 KB
/
ci_pull_request.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Lint | Test
on:
workflow_dispatch:
pull_request:
# types: [opened, reopened, synchronize] # Default
# types: [opened, reopened, synchronize, edited, unlocked]
# branches:
# - main
# Only run when push includes commits with changes to:
paths:
- 'src/**.ts'
- 'test/**.ts'
- 'test/**.pot?'
- 'jest.config.ts'
- 'tsup.config.js'
- 'tsconfig.json'
- 'package.json'
- 'package-lock.json'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Run ESlint
run: npm run lint
test:
name: Test (Node ${{ matrix.node-version }} on ${{ matrix.os }})
strategy:
fail-fast: false
matrix:
node-version:
# - 12.x
# - 14.x
# - 16.x
- 18.x
- 20.x
os:
- ubuntu-latest
- windows-latest
# - macos-latest
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Jest
if: matrix.os != 'ubuntu-latest' || matrix.node-version != '20.x'
run: npm test
- name: Run Jest with coverage
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
run: npm test -- --coverage
# Save coverage report in Coveralls
- name: Coveralls
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./test/coverage/lcov.info
# - name: Codecov
# if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
# uses: codecov/codecov-action@v2
# with:
# directory: ./test/coverage/
# # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# # files: ./coverage1.xml,./coverage2.xml # optional
# flags: unittests # optional
# # path_to_write_report: ./coverage/codecov_report.txt
# # fail_ci_if_error: true # optional (default = false)
# verbose: true # optional (default = false)
- name: Build package
run: npm run build