-
Notifications
You must be signed in to change notification settings - Fork 163
573 lines (496 loc) · 23.4 KB
/
continuous-integration.yaml
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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
name: Concrete ML Tests
on:
pull_request:
push:
branches:
- main
- 'release/*'
release:
types: [published]
workflow_dispatch:
inputs:
event_name:
description: "Event that triggers the workflow"
required: true
type: choice
default: pr
options:
- pr
linux_python_versions:
description: "Space separated list of python versions (3.8, 3.9, 3.10, 3.11, 3.12 are supported) to launch on linux"
required: false
type: string
default: "3.8"
macos_python_versions:
description: "Space separated list of python versions (3.8, 3.9, 3.10, 3.11, 3.12 are supported) to launch on macos (intel)"
required: false
type: string
default: "3.8"
manual_call:
description: "Do not uncheck this!"
type: boolean
required: false
default: true
# Workflow call refers to the weekly or release process (it enables the current CI workflow to be
# called by another workflow from the same repository, in this case the release one)
# No default value is put in order to avoid running the following CI without explicitly
# indicating it in the caller workflow
# Besides, GitHub actions are not able to differentiate 'workflow_dispatch' from 'workflow_call'
# based on 'github.event_name' and both are set to 'workflow_dispatch'. Therefore, an optional
# input 'manual_call' with proper default values is added to both as a workaround, following one
# user's suggestion : https://github.com/actions/runner/discussions/1884
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/3930
workflow_call:
inputs:
event_name:
description: "Event that triggers the workflow"
required: true
type: string
manual_call:
description: 'To distinguish workflow_call from workflow_dispatch'
type: boolean
required: false
default: false
concurrency:
# Add event_name in the group as workflow dispatch means we could run this in addition to other
# workflows already running on a PR or a merge e.g.
group: "${{ github.ref }}-${{ github.event_name }}-${{ github.workflow }}"
# Cancel the previous build, except on main
cancel-in-progress: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }}
env:
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
# The CI can be triggered by the release workflow which itself can be triggered by the merge of a
# pull-request (following the 'prepare_release' workflow). Since GitHub weirdly propagates the
# original 'github.event_name' (here "pull_request") in all nested workflows, we need to
# differentiate the release CI from regular CIs by using 'inputs.event_name', which should be set
# to "release" by the release workflow
IS_PR: ${{ github.event_name == 'pull_request' && inputs.event_name != 'release' }}
# Run the weekly CI if it has been triggered manually by the weekly workflow, meaning
# 'inputs.event_name' is set to "weekly"
IS_WEEKLY: ${{ inputs.event_name == 'weekly'}}
# The 'IS_RELEASE' variable indicates that the workflow has been triggered by the releasing
# process itself, before publishing it. It should only happen when the release workflow triggers
# the CI, in which 'inputs.event_name' is set to "release"
IS_RELEASE: ${{ inputs.event_name == 'release' }}
IS_PUSH_TO_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
IS_PUSH_TO_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') }}
IS_WORKFLOW_DISPATCH: ${{ github.event_name == 'workflow_dispatch' && inputs.manual_call}}
# The 'IS_PUBLISHED_RELEASE' variable indicates that the workflow has been triggered by a
# release's successful publishing
IS_PUBLISHED_RELEASE: ${{ github.event_name == 'release'}}
AGENT_TOOLSDIRECTORY: /opt/hostedtoolcache
RUNNER_TOOL_CACHE: /opt/hostedtoolcache
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# The 'FAILED_TESTS_ARE_FLAKY' variable is used to print a warning messages if flaky tests are
# rerun. By default, we do not want to print this warning
FAILED_TESTS_ARE_FLAKY: "false"
SLAB_PROFILE: ciprofile
jobs:
commit-checks:
name: Commit Checks
runs-on: ubuntu-24.04
outputs:
commits_ok: ${{ steps.commit-conformance.outcome == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Check commit signatures
id: check-commit-signatures
if: ${{ fromJSON(env.IS_PR) }}
uses: 1Password/check-signed-commits-action@ed2885f3ed2577a4f5d3c3fe895432a557d23d52
- name: Check commits first line format
id: commit-first-line
if: ${{ fromJSON(env.IS_PR) && !cancelled() }}
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee
with:
pattern: '^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)\:) .+$'
flags: 'gs'
error: "Your first line has to contain a commit type like \"feat: message\".\
Pattern: '^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)\\:)'"
excludeDescription: 'true' # optional: this excludes the description body of a pull request
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check commits line length
id: commit-line-length
if: ${{ fromJSON(env.IS_PR) && !cancelled() }}
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee
with:
pattern: '(^.{0,74}$\r?\n?){0,20}'
flags: 'gm'
error: 'The maximum line length of 74 characters is exceeded.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Commit conformance
id: commit-conformance
if: ${{ !cancelled() }}
env:
SIGNATURE_OK: ${{ steps.check-commit-signatures.outcome == 'success' || steps.check-commit-signatures.outcome == 'skipped' }}
FIRST_LINE_OK: ${{ (fromJSON(env.IS_PR) && steps.commit-first-line.outcome == 'success') || steps.commit-first-line.outcome == 'skipped' }}
LINE_LENGTH_OK: ${{ (fromJSON(env.IS_PR) && steps.commit-line-length.outcome == 'success') || steps.commit-line-length.outcome == 'skipped' }}
run: |
if [[ "${SIGNATURE_OK}" != "true" || "${FIRST_LINE_OK}" != "true" || "${LINE_LENGTH_OK}" != "true" ]]; then
echo "Issues with commits. Signature ok: ${SIGNATURE_OK}. First line ok: ${FIRST_LINE_OK}. Line length ok: ${LINE_LENGTH_OK}."
exit 1
fi
matrix-preparation:
name: Prepare versions and OS
needs: [commit-checks]
# We skip the CI in cases of pushing to internal main (because all pushes to main internal are now from the bot)
if: ${{ !( github.repository != 'zama-ai/concrete-ml' && github.event_name == 'push' && github.ref == 'refs/heads/main' ) }}
runs-on: ubuntu-24.04
timeout-minutes: 5
outputs:
linux-matrix: ${{ steps.set-matrix.outputs.linux-matrix }}
macos-matrix: ${{ steps.set-matrix.outputs.macos-matrix }}
needs-38-linux-runner: ${{ steps.set-matrix.outputs.needs-38-linux-runner }}
needs-39-linux-runner: ${{ steps.set-matrix.outputs.needs-39-linux-runner }}
needs-310-linux-runner: ${{ steps.set-matrix.outputs.needs-310-linux-runner }}
needs-311-linux-runner: ${{ steps.set-matrix.outputs.needs-311-linux-runner }}
needs-312-linux-runner: ${{ steps.set-matrix.outputs.needs-312-linux-runner }}
instance-type: ${{ steps.set-matrix.outputs.instance-type }}
linux-python-versions: ${{ steps.set-matrix.outputs.linux-python-versions }}
macos-python-versions: ${{ steps.set-matrix.outputs.macos-python-versions }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set matrix
id: set-matrix
run: |
echo "${{ github.event_name }}"
# Manage build type that will condition the rest of the CI
if [[ "${IS_PR}" == "true" ]]; then
BUILD_TYPE="pr"
elif [[ "${IS_WEEKLY}" == "true" ]]; then
BUILD_TYPE="weekly"
elif [[ "${IS_RELEASE}" == "true" ]]; then
BUILD_TYPE="release"
elif [[ "${IS_PUSH_TO_MAIN}" == "true" ]]; then
BUILD_TYPE="push_to_main"
elif [[ "${IS_PUSH_TO_RELEASE}" == "true" ]]; then
BUILD_TYPE="push_to_release"
elif [[ "${IS_WORKFLOW_DISPATCH}" == "true" ]];then
BUILD_TYPE="${{ inputs.event_name }}"
elif [[ "${IS_PUBLISHED_RELEASE}" == "true" ]];then
BUILD_TYPE="published_release"
else
echo "Unknown BUILD_TYPE! Aborting"
exit 1
fi
# Manage instance type
INSTANCE_TYPE="c5.4xlarge"
if [[ "${BUILD_TYPE}" == "weekly" ]]; then
INSTANCE_TYPE="c6i.32xlarge"
elif [[ "${BUILD_TYPE}" == "release" ]]; then
INSTANCE_TYPE="c6i.32xlarge"
fi
# Manage python versions
if [[ "${IS_WORKFLOW_DISPATCH}" == "true" ]]; then
LINUX_PYTHON_VERSIONS="${{ inputs.linux_python_versions }}"
MACOS_PYTHON_VERSIONS="${{ inputs.macos_python_versions }}"
elif [[ "${BUILD_TYPE}" == "pr" ]]; then
LINUX_PYTHON_VERSIONS="3.8 3.12"
MACOS_PYTHON_VERSIONS=""
elif [[ "${BUILD_TYPE}" == "weekly" ]]; then
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10 3.11 3.12"
MACOS_PYTHON_VERSIONS="3.9"
elif [[ "${BUILD_TYPE}" == "release" ]] || [[ "${BUILD_TYPE}" == "published_release" ]]; then
LINUX_PYTHON_VERSIONS="3.8 3.9 3.10 3.11 3.12"
MACOS_PYTHON_VERSIONS=""
elif [[ "${BUILD_TYPE}" == "push_to_main" ]]; then
LINUX_PYTHON_VERSIONS="3.8"
MACOS_PYTHON_VERSIONS=""
elif [[ "${BUILD_TYPE}" == "push_to_release" ]]; then
LINUX_PYTHON_VERSIONS="3.8"
MACOS_PYTHON_VERSIONS=""
else
echo "Unknown BUILD_TYPE! Aborting"
exit 1
fi
echo "LINUX_PYTHON_VERSIONS: ${LINUX_PYTHON_VERSIONS}"
echo "MACOS_PYTHON_VERSIONS: ${MACOS_PYTHON_VERSIONS}"
# Used for the slack report
echo "linux-python-versions=${LINUX_PYTHON_VERSIONS}" >> $GITHUB_OUTPUT
echo "macos-python-versions=${MACOS_PYTHON_VERSIONS}" >> $GITHUB_OUTPUT
echo "BUILD_TYPE: ${BUILD_TYPE}"
echo "INSTANCE_TYPE: ${INSTANCE_TYPE}"
MATRIX_JSON=$(mktemp --suffix=.json)
echo "Prepared build matrix:"
python3 ./script/actions_utils/generate_test_matrix.py \
--output-json "${MATRIX_JSON}" \
--linux-python-versions ${LINUX_PYTHON_VERSIONS} \
--macos-python-versions ${MACOS_PYTHON_VERSIONS}
LINUX_MATRIX=$(jq -rc '. | map(select(.os_kind=="linux"))' "${MATRIX_JSON}")
MACOS_MATRIX=$(jq -rc '. | map(select(.os_kind=="macos"))' "${MATRIX_JSON}")
echo "Linux Matrix:"
echo "${LINUX_MATRIX}" | jq '.'
echo "macOS Matrix:"
echo "${MACOS_MATRIX}" | jq '.'
echo "linux-matrix=${LINUX_MATRIX}" >> $GITHUB_OUTPUT
echo "macos-matrix=${MACOS_MATRIX}" >> $GITHUB_OUTPUT
NEEDS_LINUX_38_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.8")) | length > 0')
NEEDS_LINUX_39_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.9")) | length > 0')
NEEDS_LINUX_310_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.10")) | length > 0')
NEEDS_LINUX_311_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.11")) | length > 0')
NEEDS_LINUX_312_RUNNER=$(echo "${LINUX_MATRIX}" | \
jq -rc '. | map(select(.os_kind=="linux" and .python_version=="3.12")) | length > 0')
echo "Needs Linux 3.8 runner:"
echo "${NEEDS_LINUX_38_RUNNER}"
echo "Needs Linux 3.9 runner:"
echo "${NEEDS_LINUX_39_RUNNER}"
echo "Needs Linux 3.10 runner:"
echo "${NEEDS_LINUX_310_RUNNER}"
echo "Needs Linux 3.11 runner:"
echo "${NEEDS_LINUX_311_RUNNER}"
echo "Needs Linux 3.12 runner:"
echo "${NEEDS_LINUX_312_RUNNER}"
echo "needs-38-linux-runner=${NEEDS_LINUX_38_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-39-linux-runner=${NEEDS_LINUX_39_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-310-linux-runner=${NEEDS_LINUX_310_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-311-linux-runner=${NEEDS_LINUX_311_RUNNER}" >> $GITHUB_OUTPUT
echo "needs-312-linux-runner=${NEEDS_LINUX_312_RUNNER}" >> $GITHUB_OUTPUT
echo "instance-type=${INSTANCE_TYPE}" >> $GITHUB_OUTPUT
build-linux:
name: Single Python Version (Linux)
needs: [matrix-preparation]
# Run in a clean container
#container:
# image: ubuntu:20.04
strategy:
fail-fast: false
matrix: ${{ fromJSON(format('{{"include":{0}}}', needs.matrix-preparation.outputs.linux-matrix)) }}
uses: ./.github/workflows/continuous-integration-common.yaml
with:
python_version: ${{ matrix.python_version }}
gh_event_name: ${{ github.event_name }}
inp_event_name: ${{ inputs.event_name }}
manual_call: ${{ inputs.manual_call || false }}
secrets: inherit
provenance:
needs: [build-linux]
permissions:
actions: read
contents: write
id-token: write # Needed to access the workflow's OIDC identity.
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] # Not pinned by commit on purpose
# see https://github.com/slsa-framework/slsa-github-generator/blob/main/README.md#referencing-slsa-builders-and-generators
if: ${{ needs.build-linux.outputs.hashes != '' }}
with:
base64-subjects: "${{ needs.build-linux.outputs.hashes }}"
# This is to manage build matrices and have a single status point for PRs
# This can be updated to take macOS into account but it is impractical because of long builds
# and therefore expensive macOS testing
linux-build-status:
name: Build Status (Linux)
needs: [build-linux]
runs-on: ubuntu-24.04
timeout-minutes: 2
if: success() || failure()
steps:
- name: Fail on unsuccessful Linux build
shell: bash
run: |
# success always if wasn't launched due to CI not supposed to be launched
if ${{ github.repository == 'zama-ai/concrete-ml-internal' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
then
exit 0
fi
if [[ ${{ needs.build-linux.result }} != "success" ]]; then
exit 1
fi
build-macos-intel:
name: Python on macOS
needs: [matrix-preparation]
if: ${{ needs.matrix-preparation.outputs.macos-matrix != '[]' }}
runs-on: ${{ matrix.runs_on }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix: ${{ fromJSON(format('{{"include":{0}}}', needs.matrix-preparation.outputs.macos-matrix)) }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Add masks
run: |
echo "::add-mask::${{ secrets.INTERNAL_PYPI_URL_FOR_MASK }}"
echo "::add-mask::${{ secrets.INTERNAL_REPO_URL_FOR_MASK }}"
# By default, `git clone` downloads all LFS files, which we want to avoid in CIs
- name: Disable LFS download by default
run: |
git lfs install --skip-smudge
# Checkout the code
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# Pull necessary LFS files (and thus avoid downloading files stored for benchmarks, use cases, ...)
- name: Pull LFS files
run: |
git lfs pull --include "tests/data/**, src/concrete/ml/pandas/_client_server_files/**" --exclude ""
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: ${{ matrix.python_version }}
- name: Check python3 version
env:
SYSTEM_VERSION_COMPAT: 0
run: |
which python3
which pip3
sw_vers
- name: Install dependencies
id: install-deps
env:
SYSTEM_VERSION_COMPAT: 0
run: |
./script/make_utils/setup_os_deps.sh
mkdir -p ~/.aws
echo "[default]\nregion=eu-west-3\noutput=json\n" >> ~/.aws/config
which python3
which pip3
PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
echo "PATH=${PATH}" >> "$GITHUB_ENV"
echo
echo "Using these tools:"
which python3
which pip3
echo
make setup_env
# macOS builds are already long, so we decide not to use --weekly on them, it could be
# changed. Remark also that, for mac, due to unexpected issues with GitHub, we have a
# slightly different way to launch pytest
- name: PyTest Source Code
shell: bash +e {0}
run: |
make pytest_macOS_for_GitHub
# If regular tests failed, check for flaky tests
if [ $? -ne 0 ]; then
# Convert pytest report to formatted report with only information about failed tests
poetry run python ./script/actions_utils/pytest_failed_test_report.py \
--pytest-input-report "pytest_report.json" \
--failed-tests-report "failed_tests_report.json" \
--failed-tests-comment "failed_tests_comment_${{ inputs.python_version }}.txt" \
--failed-tests-list "failed_tests_slack_list_${{ inputs.python_version }}.txt"
# Check if all failed tests are known flaky tests
FAILED_TESTS_ARE_FLAKY=$(jq .all_failed_tests_are_flaky "failed_tests_report.json")
echo "Are all failed tests flaky: ${FAILED_TESTS_ARE_FLAKY}."
# If all failed tests are known flaky tests, report success
if [[ "${FAILED_TESTS_ARE_FLAKY}" == "true" ]]; then
exit 0
# Else, return exit status 1 in order to make this step fail
else
exit 1
fi
else
echo "No flaky tests were reported!"
fi
decide-slack-report:
name: Decide Slack report
runs-on: ubuntu-24.04
outputs:
send_slack_report: ${{ steps.set-decision.outputs.send_slack_report }}
steps:
- name: Set decision
id: set-decision
run: |
SEND_SLACK_REPORT="${{ fromJSON(env.IS_WEEKLY) || fromJSON(env.IS_PUSH_TO_MAIN) || fromJSON(env.IS_PUSH_TO_RELEASE) }}"
echo "Send Slack report:"
echo "${SEND_SLACK_REPORT}"
echo "send_slack_report=${SEND_SLACK_REPORT}" >> $GITHUB_OUTPUT
# Only send a report for the following CI:
# - when pushing to main
# - when pushing to a release branch
# - when running weekly tests
# In these cases, we want to send the report whenever one of the step was triggered, which is
# basically when the `matrix-preparation` has not been skipped
# Side note: environmental variables cannot be used for jobs conditions, so we need to determine
# if the job should be run or not in an previous job and store it in its output
slack-report:
name: Slack report
runs-on: ubuntu-24.04
if: |
always()
&& needs.matrix-preparation.result != 'skipped'
&& fromJSON(needs.decide-slack-report.outputs.send_slack_report)
timeout-minutes: 2
needs:
[
matrix-preparation,
build-linux,
build-macos-intel,
decide-slack-report,
]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Prepare whole job status
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
echo "${NEEDS_JSON}" > /tmp/needs_context.json
JOB_STATUS=$(python3 ./script/actions_utils/actions_combine_status.py \
--needs_context_json /tmp/needs_context.json)
echo "JOB_STATUS=${JOB_STATUS}" >> "$GITHUB_ENV"
- name: Set message title
run: |
if [[ "${{ env.IS_WEEKLY }}" == "true" ]]; then
TITLE_START="Weekly Tests"
elif [[ "${{ fromJSON(env.IS_PUSH_TO_MAIN) || fromJSON(env.IS_PUSH_TO_RELEASE) }}" == "true" ]]; then
TITLE_START="Push to '${{ github.ref_name }}'"
fi
if [[ "${{ env.JOB_STATUS }}" == "success" ]]; then
TITLE_STATUS="passed ✅"
elif [[ "${{ env.JOB_STATUS }}" == "cancelled" ]]; then
TITLE_STATUS="cancelled :black_square_for_stop:"
elif [[ "${{ env.JOB_STATUS }}" == "skipped" ]]; then
TITLE_STATUS="skipped :fast_forward:"
else
TITLE_STATUS="failed ❌"
fi
echo "SLACK_TITLE=${TITLE_START} ${TITLE_STATUS}" >> "$GITHUB_ENV"
# Retrieve the list of flaky tests that have been re-run if they were some
# Enable 'merge-multiple' to download all files in the root directory
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
merge-multiple: true
pattern: failed_flaky_*
- name: Set message body
run: |
{
echo "SLACK_BODY<<EOF"
echo "Build status ([Action URL](${{ env.ACTION_RUN_URL }})):"
echo " - Linux: ${{ needs.build-linux.result }}"
echo " - macOS (intel): ${{ needs.build-macos-intel.result }}"
} >> "$GITHUB_ENV"
LINUX_PYTHON_VERSIONS="${{ needs.matrix-preparation.outputs.linux-python-versions }}"
for linux_python_version in ${LINUX_PYTHON_VERSIONS}; do
file_name="failed_tests_slack_list_${linux_python_version}.txt"
if [ -f ${file_name} ]; then
FAILED_TESTS_LIST=$(cat "${file_name}")
{
echo "Linux (Python ${linux_python_version}):"
echo "${FAILED_TESTS_LIST}"
} >> "$GITHUB_ENV"
fi
done
echo "EOF" >> "$GITHUB_ENV"
- name: Send Slack report
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990
env:
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
SLACK_COLOR: ${{ env.JOB_STATUS || 'failure' }}
SLACK_TITLE: ${{ env.SLACK_TITLE || 'Unexpected CI' }}
SLACK_MESSAGE: ${{ env.SLACK_BODY || 'Unexpected CI' }}
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACKIFY_MARKDOWN: true