-
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (174 loc) · 6.25 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: ci
on:
pull_request:
branches:
- '**'
paths-ignore:
- '**/*.md'
push: # run ci workflow so thats status badges can always point to main branch.
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
IS_UBUNTU: false
NODE_VERSION: v0.0.0
NPM_CACHE_DIR: ~/.npm
NPM_VERSION: 0.0.0
jobs:
lint:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'chore(release)')"
env:
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: lint - ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
target: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: List versions
run: |
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
echo "${{ github.workflow }}-${{ github.ref || github.run_id }}"
pwd
ls -la
which npm
# npm x -y -- envinfo@latest
- name: Cache dependencies
id: npm-cache
uses: actions/cache@v3
with:
# See this glob workaround at https://github.com/actions/toolkit/issues/713.
path: |
${{ env.NPM_CACHE_DIR }}/*
!${{ env.NPM_CACHE_DIR }}/_npx
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}
- name: Debugging
run: |
echo "Debugging `github` payload:"
echo "::group::$JSON"
echo "::endgroup::"
env:
JSON: ${{ toJSON(github) }}
- name: Install dependencies
run: |
npm pkg delete scripts.postinstall
npm ci
sh $(npm root)/@reallyland/tools/list-npx-cache.sh
- name: Lint
run: |
npm run lint:build
test:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') && !contains(github.event.head_commit.message, 'chore(release)')"
env:
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: test - ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
target: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
# - name: Setup node@${{ matrix.target }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.target }}
- name: List versions
run: |
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
echo "${{ github.workflow }}-${{ github.ref || github.run_id }}"
pwd
ls -la
which npm
# npm x -y -- envinfo@latest
- name: Cache dependencies
id: npm-cache
uses: actions/cache@v3
with:
# See this glob workaround at https://github.com/actions/toolkit/issues/713.
path: |
${{ env.NPM_CACHE_DIR }}/*
!${{ env.NPM_CACHE_DIR }}/_npx
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}
- name: Install dependencies
run: |
npm pkg delete scripts.postinstall
npm ci
sh $(npm root)/@reallyland/tools/list-npx-cache.sh
- name: Test
if: env.IS_UBUNTU == 'false'
run: |
npm t -- --no-coverage --no-watch
- name: Test with coverage
if: env.IS_UBUNTU != 'false'
run: |
npm t -- --color --no-watch
- name: Upload coverage to codecov
if: env.IS_UBUNTU != 'false' && success()
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
flags: unit_tests
bench:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') && !contains(github.event.head_commit.message, 'chore(release)')"
env:
IS_UBUNTU: ${{ contains(matrix.os, 'ubuntu') }}
name: bench - ${{ matrix.os }} ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
matrix:
os: [ubuntu-latest]
target: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: List versions
run: |
echo "NODE_VERSION=$(node -v)" >> $GITHUB_ENV
echo "NPM_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV
echo "NPM_VERSION=$(npm -v)" >> $GITHUB_ENV
echo "${{ github.workflow }}-${{ github.ref || github.run_id }}"
pwd
ls -la
which npm
# npm x -y -- envinfo@latest
- name: Cache dependencies
id: npm-cache
uses: actions/cache@v3
with:
# See this glob workaround at https://github.com/actions/toolkit/issues/713.
path: |
${{ env.NPM_CACHE_DIR }}/*
!${{ env.NPM_CACHE_DIR }}/_npx
key: ${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-${{ env.NODE_VERSION }}-npm-${{ env.NPM_VERSION }}
- name: Install dependencies
run: |
npm pkg delete scripts.postinstall
npm ci
sh $(npm root)/@reallyland/tools/list-npx-cache.sh
- name: Benchmark
run: |
npm run bench -- --no-watch