-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
307 lines (305 loc) · 12.8 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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: CI
on:
push:
branches:
- renovate/**
pull_request:
merge_group:
workflow_dispatch:
# 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: [18, 20]
name: Upload install and build artifact (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build sequelize
run: yarn build
- name: Reset NX cache
run: yarn nx reset
- name: Compress artifact
run: tar -cf install-build-node-${{ matrix.node-version }}.tar ./packages/*/lib ./node_modules ./packages/*/node_modules
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: install-build-artifact-node-${{ matrix.node-version }}
path: install-build-node-${{ matrix.node-version }}.tar
retention-days: 1
lint:
name: Lint code
runs-on: ubuntu-latest
needs: install-and-build
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: install-build-artifact-node-20
- name: Extract artifact
run: tar -xf install-build-node-20.tar
- run: yarn test:format
unit-test:
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
name: Unit test all dialects (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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 (cli)
run: yarn lerna run test-unit --scope=@sequelize/cli
- name: Unit tests (utils)
run: yarn lerna run test-unit --scope=@sequelize/utils
- name: Unit tests (core - mariadb)
run: yarn lerna run test-unit-mariadb --scope=@sequelize/core
- name: Unit tests (mariadb package)
run: yarn lerna run test-unit --scope=@sequelize/mariadb
- name: Unit tests (core - mysql)
run: yarn lerna run test-unit-mysql --scope=@sequelize/core
- name: Unit tests (mysql package)
run: yarn lerna run test-unit --scope=@sequelize/mysql
- name: Unit tests (core - postgres)
run: yarn lerna run test-unit-postgres --scope=@sequelize/core
- name: Unit tests (postgres package)
run: yarn lerna run test-unit --scope=@sequelize/postgres
- name: Unit tests (core - sqlite3)
run: yarn lerna run test-unit-sqlite3 --scope=@sequelize/core
- name: Unit tests (core - mssql)
run: yarn lerna run test-unit-mssql --scope=@sequelize/core
- name: Unit tests (mssql package)
run: yarn lerna run test-unit --scope=@sequelize/mssql
- name: Unit tests (core - db2)
run: yarn lerna run test-unit-db2 --scope=@sequelize/core
- name: Unit tests (core - ibmi)
run: yarn lerna run test-unit-ibmi --scope=@sequelize/core
- name: Unit tests (core - snowflake)
run: yarn lerna run test-unit-snowflake --scope=@sequelize/core
- name: SQLite SSCCE
run: yarn sscce-sqlite3
test-win:
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
name: Build and test on Windows (Node ${{ matrix.node-version }})
runs-on: windows-latest
needs: lint # don't bother running if lint tests fail
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install dependencies
run: yarn install --immutable
- name: Build sequelize
run: yarn build
- name: Unit tests
run: yarn lerna run test-unit
- name: SSCCE
run: yarn sscce-sqlite3
- name: Integration tests (sqlite3)
run: yarn lerna run test-integration-sqlite3 --scope=@sequelize/core
docs:
name: Generate TypeDoc
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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: ['5.1', '5.2', '5.3', '5.4']
name: TS Typings (${{ matrix.ts-version }})
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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-sqlite3:
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
name: sqlite3 (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
needs: [unit-test, test-typings]
env:
DIALECT: sqlite3
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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: [18, 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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: [18, 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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-sqlite3, test-postgres, test-oldest-latest]
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
env:
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
steps:
- name: Generate Sequelize Bot Token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: '${{ secrets.SEQUELIZE_BOT_APP_ID }}'
private-key: '${{ secrets.SEQUELIZE_BOT_PRIVATE_KEY }}'
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
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
# The credentials used for checkout are persisted
# Lerna will use the same credentials later for "git push".
# This must be done using the Sequelize bot.
token: '${{ steps.generate-token.outputs.token }}'
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20.x
cache: yarn
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
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
env:
GITHUB_TOKEN: '${{ steps.generate-token.outputs.token }}'
GH_TOKEN: '${{ steps.generate-token.outputs.token }}'
- 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"}'