-
Notifications
You must be signed in to change notification settings - Fork 13
285 lines (275 loc) · 9.36 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
name: CI
run-name: "CI${{ vars.CI_ENABLE_BUILD && ((github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || (!github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.clone_url == github.event.pull_request.base.repo.clone_url)) && ' & Build:' || ':' }} ${{ github.event_name == 'push' && format('[{0}] {1}', github.ref_name, github.event.head_commit.message) || github.event_name == 'pull_request' && format('PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) || github.event_name == 'release' && format('{0}', github.event.release.name) || github.event_name == 'release' && format('{0}', github.event.release.name) || github.event_name == 'schedule' && format('Scheduled: {0}', github.ref_name) || github.ref_name }}"
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths-ignore:
- '**/README.md'
release:
types: [published]
schedule:
# Every Monday
- cron: 0 0 * * 1
# # First Sunday of every month
# # See: https://crontab.guru/#0_0_1-7_*_*/7
# - cron: '0 0 1-7 * */7' # https://stackoverflow.com/a/73826599
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test-data:
name: "Test: Data"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: data-node_modules
with:
path: Data/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('Data/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd Data
yarn install
- name: Typecheck
run: |
cd Data
yarn run typecheck
- name: Test
run: |
cd Data
FORCE_COLOR=true yarn test --verbose
test-app:
name: "Test: App"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: app-node_modules
with:
path: App/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('App/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd App
yarn install
- name: Typecheck
run: |
cd App
yarn run typecheck
- name: Test
run: |
cd App
FORCE_COLOR=true yarn test --verbose
test-epc-utils:
name: "Test: epc-utils"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: epc-utils-node_modules
with:
path: packages/epc-utils/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('packages/epc-utils/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd packages/epc-utils
yarn install
- name: Typecheck
run: |
cd packages/epc-utils
yarn run typecheck
- name: Test
run: |
cd packages/epc-utils
FORCE_COLOR=true yarn test --verbose
test-data-storage-couchdb:
name: "Test: data-storage-couchdb"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: data-storage-couchdb-node_modules
with:
path: packages/data-storage-couchdb/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('packages/data-storage-couchdb/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd packages/data-storage-couchdb
yarn install
- name: Typecheck
run: |
cd packages/data-storage-couchdb
yarn run typecheck
- name: Test
run: |
cd packages/data-storage-couchdb
FORCE_COLOR=true yarn test --verbose
test-data-storage-couchdb-remote:
name: "Test: data-storage-couchdb w/CouchDB"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: data-storage-couchdb-node_modules
with:
path: packages/data-storage-couchdb/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('packages/data-storage-couchdb/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Setup CouchDB
uses: zetavg/couchdb-action@master
- name: Create CouchDB Database
run: |
curl -X PUT http://user:password@localhost:5984/test
- name: Yarn Install
run: |
cd packages/data-storage-couchdb
yarn install
- name: Test
run: |
cd packages/data-storage-couchdb
COUCHDB_URI='http://127.0.0.1:5984/test' COUCHDB_USERNAME=user COUCHDB_PASSWORD=password yarn test lib/__tests__/data-storage-couchdb.test.ts --runInBand
test-integration-airtable:
name: "Test: integration-airtable"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: integration-airtable-node_modules
with:
path: packages/integration-airtable/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('packages/integration-airtable/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd packages/integration-airtable
yarn install
- name: Typecheck
run: |
cd packages/integration-airtable
yarn run typecheck
- name: Test
run: |
cd packages/integration-airtable
FORCE_COLOR=true yarn test --verbose
test-integration-snipe-it:
name: "Test: integration-snipe-it"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: integration-snipe-it-node_modules
with:
path: packages/integration-snipe-it/node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('packages/integration-snipe-it/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Yarn Install
run: |
cd packages/integration-snipe-it
yarn install
- name: Typecheck
run: |
cd packages/integration-snipe-it
yarn run typecheck
- name: Test
run: |
cd packages/integration-snipe-it
FORCE_COLOR=true yarn test --verbose
paths-filter:
runs-on: ubuntu-latest
outputs:
app: ${{ steps.filter.outputs.app }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
app:
- 'App/**'
data:
- 'Data/**'
data-storage-couchdb:
- 'packages/data-storage-couchdb/**'
epc-utils:
- 'packages/epc-utils/**'
integration-airtable:
- 'packages/integration-airtable/**'
build:
name: "Build App"
needs:
- test-app
- paths-filter
# Build if the app has changes, and event is not a pull request, or if the pull request is not a draft and the pull request is not from a fork (runs of fork PRs will not have access to secrets that are required for building the app).
if: ${{ vars.CI_ENABLE_BUILD && (github.event_name == 'release' || github.event_name == 'schedule' || needs.paths-filter.outputs.app == 'true' || needs.paths-filter.outputs.data == 'true' || needs.paths-filter.outputs.data-storage-couchdb == 'true' || needs.paths-filter.outputs.epc-utils == 'true' || needs.paths-filter.outputs.integration-airtable == 'true') && ((github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || (!github.event.pull_request.draft && github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.clone_url == github.event.pull_request.base.repo.clone_url)) }}
uses: ./.github/workflows/build_app.yml
with:
build-release: ${{ github.event_name == 'release' }}
secrets: inherit