Repository navigation
359 lines (342 loc) · 12.7 KB
/
Copy pathci-nightly.yml
File metadata and controls
359 lines (342 loc) · 12.7 KB
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# Copyright 2021 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ci-nightly
on:
schedule:
- cron: 0 1 * * *
workflow_dispatch:
inputs:
workload:
description: Nightly workloads to run
type: choice
options: [all, java, python, connectors]
default: all
connectors:
description: CLI E2E connectors as a JSON array (subset of the default list)
type: string
default: &default-connectors '["bigquery", "dbt_redshift", "metabase", "mssql", "mysql", "redash", "snowflake", "tableau", "redshift", "quicksight", "datalake_s3", "postgres", "oracle", "athena", "bigquery_multiple_project", "exasol", "powerbi"]'
permissions:
contents: read
packages: read
env:
DEFAULT_CONNECTORS: *default-connectors
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-${{ inputs.workload }}
cancel-in-progress: true
jobs:
plan:
name: Select Python workloads
if: ${{ inputs.workload != 'java' }}
runs-on: ubuntu-latest
outputs:
python-versions: ${{ steps.versions.outputs.versions }}
python-lowest: ${{ steps.versions.outputs.lowest }}
python-highest: ${{ steps.versions.outputs.highest }}
ref: ${{ github.sha }}
connectors: ${{ steps.connectors.outputs.connectors }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.sha }}
persist-credentials: false
fetch-depth: 1
sparse-checkout: |
ingestion/pyproject.toml
scripts/python_ci.py
scripts/prepare_classification_models.py
sparse-checkout-cone-mode: false
- name: Read Python versions
id: versions
run: python3 scripts/python_ci.py versions --output "$GITHUB_OUTPUT"
- name: Select connectors
id: connectors
env:
SELECTED_CONNECTORS: ${{ inputs.connectors }}
run: python3 scripts/python_ci.py connectors --output "$GITHUB_OUTPUT"
backend:
name: Build backend image
needs: plan
uses: ./.github/workflows/reusable-build-backend.yml
with:
ref: ${{ needs.plan.outputs.ref }}
ingestion-image:
needs: plan
uses: ./.github/workflows/reusable-build-ingestion.yml
with:
ref: ${{ needs.plan.outputs.ref }}
py-static-checks:
name: py-static-checks
needs: plan
if: &run-full-python ${{ inputs.workload != 'java' && inputs.workload != 'connectors' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Python static checks
uses: ./.github/actions/python-static-checks
with:
python-version: ${{ needs.plan.outputs.python-lowest }}
check-types: 'true'
prepare-classification-models:
needs: plan
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
sparse-checkout: |
scripts/prepare_classification_models.py
ingestion/pyproject.toml
.github/actions/prepare-classification-models
.github/actions/prepare-classification-model
sparse-checkout-cone-mode: false
- uses: ./.github/actions/prepare-classification-models
python-unit:
needs:
- plan
- prepare-classification-models
if: *run-full-python
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.plan.outputs.python-versions) }}
name: Unit Tests (${{ matrix.python }})
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Python unit tests
uses: ./.github/actions/python-unit
with:
python-version: ${{ matrix.python }}
collect-coverage: ${{ github.ref == 'refs/heads/main' && matrix.python == needs.plan.outputs.python-lowest }}
run-tooling-tests: ${{ matrix.python == needs.plan.outputs.python-highest }}
python-integration:
needs:
- plan
- prepare-classification-models
- backend
if: *run-full-python
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.plan.outputs.python-versions) }}
uses: ./.github/workflows/reusable-py-integration.yml
with:
python-version: ${{ matrix.python }}
ref: ${{ needs.plan.outputs.ref }}
source-database-version: oldest
collect-coverage: ${{ github.ref == 'refs/heads/main' && matrix.python == needs.plan.outputs.python-lowest }}
python-cli-e2e:
needs:
- plan
- prepare-classification-models
- backend
- ingestion-image
permissions:
contents: read
id-token: write
uses: ./.github/workflows/reusable-py-cli-e2e-tests.yml
secrets: inherit
with:
python-version: ${{ needs.plan.outputs.python-highest }}
ref: ${{ needs.plan.outputs.ref }}
connectors: ${{ needs.plan.outputs.connectors }}
collect-coverage: ${{ github.ref == 'refs/heads/main' && inputs.workload != 'connectors' }}
python-operator:
needs: [plan, backend, ingestion-image]
if: *run-full-python
uses: ./.github/workflows/reusable-py-operator-build-test.yml
with:
ref: ${{ needs.plan.outputs.ref }}
python-version: ${{ needs.plan.outputs.python-highest }}
airflow-apis:
needs: [plan, backend]
if: *run-full-python
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Airflow API tests
uses: ./.github/actions/python-airflow-apis
with:
python-version: ${{ needs.plan.outputs.python-lowest }}
use-backend-image: 'true'
collect-coverage: ${{ github.ref == 'refs/heads/main' }}
sonar-cloud-coverage-upload:
needs:
- plan
- airflow-apis
- python-unit
- python-integration
- python-cli-e2e
if: >-
${{ !cancelled() && github.ref == 'refs/heads/main' && needs.plan.result == 'success' &&
(needs.airflow-apis.result == 'success' || contains(fromJSON('["success", "failure"]'), needs.python-unit.result)) }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
# Sonar uses history for blame and new-code analysis.
fetch-depth: 0
- name: Publish Python Sonar analysis
uses: ./.github/actions/python-sonar
with:
python-version: ${{ needs.plan.outputs.python-highest }}
python-versions: ${{ needs.plan.outputs.python-versions }}
ingestion-token: ${{ secrets.INGESTION_SONAR_SECRET }}
airflow-apis-token: ${{ secrets.AIRFLOW_APIS_SONAR_TOKEN }}
publish-ingestion: ${{ contains(fromJSON('["success", "failure"]'), needs.python-unit.result) }}
publish-airflow-apis: ${{ needs.airflow-apis.result == 'success' }}
integration-test-build:
name: Build Integration Test Runtime
runs-on: ubuntu-latest
timeout-minutes: 60
if: ${{ github.event_name == 'schedule' || inputs.workload == 'all' || inputs.workload == 'java' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Build the Java integration test runtime
uses: ./.github/actions/java-integration-build
it-mysql-elasticsearch:
needs: integration-test-build
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: mysql-elasticsearch
maven_profile: mysql-elasticsearch
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue","rdf"]'
store_database_version: oldest
# The merge queue runs these two only when Java paths change, and pushes to
# main do not run them, so the nightly is their daily run on main.
it-postgres-opensearch:
needs: integration-test-build
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: postgres-opensearch
maven_profile: postgres-opensearch
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue","rdf"]'
it-postgres-elasticsearch-redis:
needs: integration-test-build
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: postgres-elasticsearch-redis
maven_profile: cache-tests
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue"]'
maven-sonarcloud-ci:
name: Maven SonarCloud CI
runs-on: ubuntu-latest
timeout-minutes: 60
if: >-
${{ github.ref == 'refs/heads/main' &&
(github.event_name == 'schedule' || inputs.workload == 'all' || inputs.workload == 'java') }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ github.sha }}
persist-credentials: false
fetch-depth: 0
- name: Publish Java Sonar analysis
uses: ./.github/actions/java-sonar
with:
sonar-token: ${{ secrets.SONAR_TOKEN }}
nightly-status:
name: Nightly status
needs:
- plan
- backend
- ingestion-image
- prepare-classification-models
- py-static-checks
- python-unit
- python-integration
- python-cli-e2e
- python-operator
- airflow-apis
- sonar-cloud-coverage-upload
- integration-test-build
- it-mysql-elasticsearch
- it-postgres-opensearch
- it-postgres-elasticsearch-redis
- maven-sonarcloud-ci
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
sparse-checkout: .github/scripts/nightly_summary.py
sparse-checkout-cone-mode: false
- name: Summarize nightly results
id: summary
env:
NEEDS_JSON: ${{ toJSON(needs) }}
WORKLOAD: ${{ inputs.workload || 'all' }}
run: python3 .github/scripts/nightly_summary.py
# nightly_summary.py routes each failure to the team that owns the failed job.
- name: Notify ingestion on-duty of nightly failures
if: ${{ steps.summary.outputs.slack_ingestion != '' }}
continue-on-error: true
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d
with:
method: chat.postMessage
token: ${{ secrets.COLLATE_BOT_SLACK_TOKEN }}
errors: true
payload-file-path: ${{ steps.summary.outputs.slack_ingestion }}
- name: Notify Platform on-duty of nightly failures
if: ${{ steps.summary.outputs.slack_platform != '' }}
continue-on-error: true
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d
with:
method: chat.postMessage
token: ${{ secrets.COLLATE_BOT_SLACK_TOKEN }}
errors: true
payload-file-path: ${{ steps.summary.outputs.slack_platform }}
- name: Fail if a selected workload did not succeed
if: ${{ steps.summary.outputs.failed == 'true' }}
run: exit 1