-
Notifications
You must be signed in to change notification settings - Fork 38
87 lines (74 loc) · 2 KB
/
build-and-test.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
name: airtasker/spot/build-and-test
on:
pull_request:
branches:
- master
push:
branches:
- master
release:
types: [published]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
test:
name: test-node-${{ matrix.node-version }}
runs-on: runs-on,runner=4cpu-linux-x64
strategy:
fail-fast: true # if one job fails, stop the rest
matrix:
node-version: [14, 16, 18, 20]
shard:
[
"1",
"2",
"3",
"4",
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
uses: "./.github/actions/build-and-test"
with:
node_version: ${{ matrix.node-version }}
shard: ${{ matrix.shard }}
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results-node-${{ matrix.node-version }}-${{ matrix.shard }}
path: ./test-reports
test-summary-publish:
runs-on: runs-on,runner=4cpu-linux-x64
needs: [test]
steps:
- name: Test summary
uses: test-summary/action@v2
with:
paths: ./test-reports/**/*.xml
lint-check:
runs-on: runs-on,runner=4cpu-linux-x64
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare-repository
- name: Run lint checker
run: yarn lint:check
publish:
runs-on: runs-on,runner=4cpu-linux-x64
if: github.event_name == 'release'
needs:
- test
- lint-check
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare-repository
- name: Authenticate with NPM registry
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- name: Publish
run: npm publish --access=public