Upload image errors to GitHub Actions (#4135)

Upload image errors to GitHub Actions
This commit is contained in:
Hugo van Kemenade 2019-11-17 13:47:18 +02:00 committed by GitHub
commit 4e4bb38cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View File

@ -349,6 +349,13 @@ jobs:
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests %PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests
shell: cmd shell: cmd
- name: Upload errors
uses: actions/upload-artifact@v1
if: failure()
with:
name: errors
path: Tests/errors
- name: Upload coverage - name: Upload coverage
run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"' run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"'
shell: cmd shell: cmd

View File

@ -53,6 +53,13 @@ jobs:
run: | run: |
.travis/test.sh .travis/test.sh
- name: Upload errors
uses: actions/upload-artifact@v1
if: failure()
with:
name: errors
path: Tests/errors
- name: Docs - name: Docs
if: matrix.python-version == 3.8 if: matrix.python-version == 3.8
run: | run: |

View File

@ -24,12 +24,26 @@ if os.environ.get("SHOW_ERRORS", None):
HAS_UPLOADER = True HAS_UPLOADER = True
class test_image_results: class test_image_results:
@classmethod @staticmethod
def upload(self, a, b): def upload(a, b):
a.show() a.show()
b.show() b.show()
elif "GITHUB_ACTIONS" in os.environ:
HAS_UPLOADER = True
class test_image_results:
@staticmethod
def upload(a, b):
dir_errors = os.path.join(os.path.dirname(__file__), "errors")
os.makedirs(dir_errors, exist_ok=True)
tmpdir = tempfile.mkdtemp(dir=dir_errors)
a.save(os.path.join(tmpdir, "a.png"))
b.save(os.path.join(tmpdir, "b.png"))
return tmpdir
else: else:
try: try:
import test_image_results import test_image_results