-
Notifications
You must be signed in to change notification settings - Fork 88
108 lines (103 loc) · 3.13 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
96
97
98
99
100
101
102
103
104
105
106
107
108
name: CI
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
RUNNER_NODE_VERSION: 22
jobs:
install_deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.RUNNER_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.RUNNER_NODE_VERSION }}
- name: cache dependencies
uses: actions/cache@v4
id: cache-dependencies
with:
path: 'node_modules'
key: depends-node${{ env.RUNNER_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: npm i
typecheck:
runs-on: ubuntu-latest
needs: install_deps
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.RUNNER_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.RUNNER_NODE_VERSION }}
- name: restore dependencies cache
uses: actions/cache/restore@v4
with:
path: 'node_modules'
key: depends-node${{ env.RUNNER_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: typecheck
run: npm run typecheck
lint:
runs-on: ubuntu-latest
needs: install_deps
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.RUNNER_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.RUNNER_NODE_VERSION }}
- name: restore dependencies cache
uses: actions/cache/restore@v4
with:
path: 'node_modules'
key: depends-node${{ env.RUNNER_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: lint
run: npm run lint && npm run format-check
build:
runs-on: ubuntu-latest
needs: install_deps
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.RUNNER_NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.RUNNER_NODE_VERSION }}
- name: restore dependencies cache
uses: actions/cache/restore@v4
with:
path: 'node_modules'
key: depends-node${{ env.RUNNER_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: build
run: npm run build
test:
runs-on: ubuntu-latest
needs: install_deps
strategy:
matrix:
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: restore dependencies cache
uses: actions/cache/restore@v4
with:
path: 'node_modules'
key: depends-node${{ env.RUNNER_NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: test
run: npm run test
test_result:
runs-on: ubuntu-latest
needs: test
if: ${{ always() }}
steps:
- run: exit 1
if: ${{ needs.test.result != 'success' }}