-
-
Notifications
You must be signed in to change notification settings - Fork 2
95 lines (77 loc) · 2.3 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
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
name: CI
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'http/**'
- '*.md'
- 'templates/**'
pull_request:
branches:
- develop
- main
paths-ignore:
- 'docs/**'
- 'http/**'
- '*.md'
- 'templates/**'
types: [opened, synchronize, closed]
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
# dependency-review:
# name: Dependency Review
# if: github.event_name == 'pull_request'
# runs-on: ubuntu-latest
# permissions:
# contents: read
# steps:
# - name: Check out repo
# uses: actions/checkout@v4
# with:
# persist-credentials: false
# - name: Dependency review
# uses: actions/dependency-review-action@v3
build-test:
if: (!(github.event.action == 'closed' && github.event.pull_request.merged != true))
name: Build & ESLint & Unit test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: ESLint Check
run: npm run lint
- name: Run unit tests
run: npm run test:unit:ci
- name: Build
run: npm run build
- name: Upload test results
uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-result-${{ matrix.node-version }}
path: reports/jest-*.xml