Skip to content

Commit 63e7d41

Browse files
sfc-gh-pcyreksfc-gh-fpawlowski
authored andcommitted
SNOW-2021009: Improving CICD, flakiness fixes (#2569)
(cherry picked from commit cfa0ad8)
1 parent aac8852 commit 63e7d41

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

.github/workflows/build_test.yml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ on:
1919
required: true
2020
tags:
2121
description: "Test scenario tags"
22+
required: false
23+
type: string
24+
25+
permissions:
26+
contents: read
27+
actions: read
28+
checks: write
29+
pull-requests: write
2230

2331
concurrency:
2432
# older builds for the same pull request number or branch should be cancelled
@@ -223,7 +231,6 @@ jobs:
223231
# To run a single test on GHA use the below command:
224232
# run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-single-ci | sed 's/ /,/g'`
225233
run: python -m tox run -e `echo py${PYTHON_VERSION/\./}-{extras,unit-parallel,integ-parallel,pandas-parallel,sso}-ci | sed 's/ /,/g'`
226-
227234
env:
228235
PYTHON_VERSION: ${{ matrix.python-version }}
229236
cloud_provider: ${{ matrix.cloud-provider }}
@@ -232,17 +239,16 @@ jobs:
232239
# To specify the test name (in single test mode) pass this env variable:
233240
# SINGLE_TEST_NAME: test/path/filename.py::test_name
234241
shell: bash
235-
- name: Combine coverages
236-
run: python -m tox run -e coverage --skip-missing-interpreters false
237-
shell: bash
238242
- uses: actions/upload-artifact@v4
243+
if: always()
239244
with:
240245
include-hidden-files: true
241246
name: coverage_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
242247
path: |
243248
.tox/.coverage
244249
.tox/coverage.xml
245250
- uses: actions/upload-artifact@v4
251+
if: always()
246252
with:
247253
include-hidden-files: true
248254
name: junit_${{ matrix.os.download_name }}-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
@@ -370,13 +376,15 @@ jobs:
370376
TOX_PARALLEL_NO_SPINNER: 1
371377
shell: bash
372378
- uses: actions/upload-artifact@v4
379+
if: always()
373380
with:
374381
include-hidden-files: true
375382
name: coverage_linux-fips-3.9-${{ matrix.cloud-provider }}
376383
path: |
377384
.coverage
378385
coverage.xml
379386
- uses: actions/upload-artifact@v4
387+
if: always()
380388
with:
381389
include-hidden-files: true
382390
name: junit_linux-fips-3.9-${{ matrix.cloud-provider }}
@@ -432,13 +440,15 @@ jobs:
432440
TOX_PARALLEL_NO_SPINNER: 1
433441
shell: bash
434442
- uses: actions/upload-artifact@v4
443+
if: always()
435444
with:
436445
include-hidden-files: true
437446
name: coverage_linux-lambda-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
438447
path: |
439448
.coverage.py${{ env.shortver }}-lambda-ci
440449
junit.py${{ env.shortver }}-lambda-ci-dev.xml
441450
- uses: actions/upload-artifact@v4
451+
if: always()
442452
with:
443453
include-hidden-files: true
444454
name: junit_linux-lambda-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
@@ -555,7 +565,7 @@ jobs:
555565
shell: bash
556566

557567
combine-coverage:
558-
if: ${{ success() || failure() }}
568+
if: always()
559569
name: Combine coverage
560570
needs: [lint, test, test-fips, test-lambda, test-aio]
561571
runs-on: ubuntu-latest
@@ -587,6 +597,7 @@ jobs:
587597
dst_file = dst_dir / ".coverage.{}".format(src_file.parent.name[9:])
588598
print("{} copy to {}".format(src_file, dst_file))
589599
shutil.copy(str(src_file), str(dst_file))'
600+
590601
- name: Collect all JUnit XML files to one dir
591602
run: |
592603
python -c '
@@ -596,33 +607,43 @@ jobs:
596607
src_dir = Path("artifacts")
597608
dst_dir = Path(".") / "junit_results"
598609
dst_dir.mkdir()
599-
# Collect all JUnit XML files with different naming patterns
600-
for pattern in ["*/junit.*.xml", "*/junit.py*-lambda-ci-dev.xml"]:
601-
for src_file in src_dir.glob(pattern):
602-
dst_file = dst_dir / src_file.name
603-
print("{} copy to {}".format(src_file, dst_file))
604-
shutil.copy(str(src_file), str(dst_file))'
610+
for src_file in src_dir.glob("*/junit*.xml"):
611+
artifact_name = src_file.parent.name
612+
dst_file = dst_dir / f"{artifact_name}_{src_file.name}"
613+
print("{} copy to {}".format(src_file, dst_file))
614+
shutil.copy(str(src_file), str(dst_file))'
605615
- name: Combine coverages
606-
run: python -m tox run -e coverage
616+
run: |
617+
if [ -d ".tox" ] && [ "$(find .tox -name ".coverage*" -type f | wc -l)" -gt 0 ]; then
618+
python -m tox run -e coverage
619+
else
620+
echo "No coverage files found, skipping coverage combination"
621+
fi
607622
- name: Publish html coverage
623+
if: ${{ success() }}
608624
uses: actions/upload-artifact@v4
609625
with:
610626
include-hidden-files: true
611627
name: overall_cov_html
612628
path: .tox/htmlcov
613629
- name: Publish xml coverage
630+
if: ${{ success() }}
614631
uses: actions/upload-artifact@v4
615632
with:
616633
include-hidden-files: true
617634
name: overall_cov_xml
618635
path: .tox/coverage.xml
619636
- uses: codecov/codecov-action@v4
637+
if: ${{ success() }}
620638
with:
621639
files: .tox/coverage.xml
622640
token: ${{ secrets.CODECOV_TOKEN }}
641+
name: coverage-${{ github.run_id }}
642+
fail_ci_if_error: false
643+
verbose: true
623644
- name: Upload test results to Codecov
624645
if: ${{ !cancelled() }}
625646
uses: codecov/test-results-action@v1
626647
with:
627648
token: ${{ secrets.CODECOV_TOKEN }}
628-
files: junit_results/junit.*.xml
649+
files: junit_results/*.xml

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ depends = py39, py310, py311, py312, py313
188188
[pytest]
189189
log_level = info
190190
addopts = -ra --strict-markers
191-
junit_family = legacy
191+
junit_family = xunit2
192192
filterwarnings =
193193
error::UserWarning:cryptography.*
194194
error::cryptography.utils.CryptographyDeprecationWarning

0 commit comments

Comments
 (0)