forked from sequelize/sequelize
-
Notifications
You must be signed in to change notification settings - Fork 1
278 lines (276 loc) · 11.2 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
name: CI
on:
push:
branches:
- v7
pull_request:
merge_group:
# This configuration cancels previous runs if a new run is started on the same PR. Only one run at a time per PR.
# This does not affect pushes to the v7 branch itself, only PRs.
# from https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
install-and-build:
strategy:
fail-fast: false
matrix:
node-version: [16, 20]
name: Upload install and build artifact (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build sequelize
run: yarn build
- name: Compress artifact
run: tar -cf install-build-node-${{ matrix.node-version }}.tar ./packages/core/lib ./packages/core/types ./packages/validator-js/lib ./packages/validator-js/types ./node_modules
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: install-build-artifact-node-${{ matrix.node-version }}
path: install-build-node-${{ matrix.node-version }}.tar
retention-days: 1
install-and-build-on-windows:
strategy:
fail-fast: false
matrix:
node-version: [16, 20]
name: Upload install and build artifact on Windows (Node ${{ matrix.node-version }})
runs-on: windows-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build sequelize
run: yarn build
lint:
name: Lint code
runs-on: ubuntu-latest
needs: install-and-build
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-20
- name: Extract artifact
run: tar -xf install-build-node-20.tar
- run: yarn lint-no-fix
unit-test:
strategy:
fail-fast: false
matrix:
node-version: [16, 20]
name: Unit test all dialects (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-${{ matrix.node-version }}
- name: Extract artifact
run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- name: ESM / CJS export equivalence
run: yarn test-unit-esm
- name: Unit tests (validator.js)
run: yarn lerna run test-unit --scope=@sequelize/validator.js
- name: Unit tests (mariadb)
run: yarn lerna run test-unit-mariadb --scope=@sequelize/core
- name: Unit tests (mysql)
run: yarn lerna run test-unit-mysql --scope=@sequelize/core
- name: Unit tests (postgres)
run: yarn lerna run test-unit-postgres --scope=@sequelize/core
- name: Unit tests (sqlite)
run: yarn lerna run test-unit-sqlite --scope=@sequelize/core
- name: Unit tests (mssql)
run: yarn lerna run test-unit-mssql --scope=@sequelize/core
- name: Unit tests (db2)
run: yarn lerna run test-unit-db2 --scope=@sequelize/core
- name: Unit tests (ibmi)
run: yarn lerna run test-unit-ibmi --scope=@sequelize/core
- name: Unit tests (snowflake)
run: yarn lerna run test-unit-snowflake --scope=@sequelize/core
docs:
name: Generate TypeDoc
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-20
- name: Extract artifact
run: tar -xf install-build-node-20.tar
- run: yarn docs
test-typings:
strategy:
fail-fast: false
matrix:
ts-version: ["4.8", "4.9", "5.0", "5.1"]
name: TS Typings (${{ matrix.ts-version }})
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-20
- name: Extract artifact
run: tar -xf install-build-node-20.tar
- name: Install TypeScript
run: yarn add typescript@~${{ matrix.ts-version }}
- name: Typing Tests
run: yarn test-typings
test-sqlite:
strategy:
fail-fast: false
matrix:
node-version: [16, 20]
name: sqlite (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: [ unit-test, test-typings ]
env:
DIALECT: sqlite
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-${{ matrix.node-version }}
- name: Extract artifact
run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
test-postgres:
strategy:
fail-fast: false
matrix:
node-version: [16, 20]
postgres-version: [oldest, latest]
minify-aliases: [true, false]
native: [true, false]
name: postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }} (Node ${{ matrix.node-version }})${{ matrix.minify-aliases && ' (minified aliases)' || '' }}
runs-on: ubuntu-latest
needs: [ unit-test, test-typings ]
env:
DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }}
SEQ_PG_MINIFY_ALIASES: ${{ matrix.minify-aliases && '1' || '' }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-${{ matrix.node-version }}
- name: Extract artifact
run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- name: Install pg-native
run: yarn workspace @sequelize/core add pg-native
if: matrix.native
- run: yarn start-postgres-${{ matrix.postgres-version }}
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
test-oldest-latest:
strategy:
fail-fast: false
matrix:
node-version: [16,20]
database-version: [oldest, latest]
dialect: [mysql, mariadb, mssql, db2]
name: ${{ matrix.dialect }} ${{ matrix.database-version }} (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: [ unit-test, test-typings ]
env:
DIALECT: ${{ matrix.dialect }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-${{ matrix.node-version }}
- name: Extract artifact
run: tar -xf install-build-node-${{ matrix.node-version }}.tar
- run: yarn start-${{ matrix.dialect }}-${{ matrix.database-version }}
- name: Integration Tests
run: yarn lerna run test-integration --scope=@sequelize/core
release:
name: Release
runs-on: ubuntu-latest
needs:
[
docs,
test-sqlite,
test-postgres,
test-oldest-latest
]
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags.
# We need the entire history to generate the changelog properly
fetch-depth: 0
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: install-build-artifact-node-20
- name: Extract artifact
run: tar -xf install-build-node-20.tar
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "bot@sequelize.org"
- name: Set npm auth token
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- run: yarn publish-all
- id: sequelize
uses: sdepold/github-action-get-latest-release@aa12fcb2943e8899cbcc29ff6f73409b32b48fa1 # master
with:
repository: sequelize/sequelize
- name: Notify channels
run: |
curl -XPOST -u "sdepold:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/sequelize/sequelize/dispatches --data '{"event_type":"Release notifier","client_payload":{"release-id": ${{ steps.sequelize.outputs.id }}}}'
- name: Notify docs repo
run: |
curl -XPOST -u "sdepold:${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.v3+json" -H "Content-Type: application/json" https://api.github.com/repos/sequelize/website/dispatches --data '{"event_type":"Build website"}'