Skip to content

Commit 66a9f98

Browse files
weiji14seisman
andauthored
Upload artifacts showing diff images on test failure (#675)
Tests with @pytest-mpl.mpl_image_compare and @check_figures_equal (#555) will return an image diff on test failures in the 'tmp-test-dir-with-unique-name' directory, and we can upload those files as a Github artifact for inspection purposes. * Use GitHub Action to upload diff images on test failure * Set a unique artifact name for each OS/Python Version * Add upload-artifact to GMT Latest tests Co-Authored-By: Dongdong Tian <[email protected]>
1 parent da41929 commit 66a9f98

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ jobs:
117117
shell: bash -l {0}
118118
run: make test PYTEST_EXTRA="-r P"
119119

120+
# Upload diff images on test failure
121+
- name: Upload diff images if any test fails
122+
uses: actions/upload-artifact@v2
123+
if: ${{ failure() }}
124+
with:
125+
name: artifact-${{ runner.os }}-${{ matrix.python-version }}
126+
path: tmp-test-dir-with-unique-name
127+
120128
# Build the documentation
121129
- name: Build the documentation
122130
shell: bash -l {0}

.github/workflows/ci_tests_dev.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,11 @@ jobs:
8686
# Run the tests
8787
- name: Test with pytest
8888
run: make test PYTEST_EXTRA="-r P"
89+
90+
# Upload diff images on test failure
91+
- name: Upload diff images if any test fails
92+
uses: actions/upload-artifact@v2
93+
if: ${{ failure() }}
94+
with:
95+
name: artifact-GMT-${{ matrix.gmt_git_ref }}-${{ runner.os }}
96+
path: tmp-test-dir-with-unique-name

0 commit comments

Comments
 (0)