Skip to content

Commit

Permalink
upload image errors to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Oct 12, 2019
1 parent 6595ce1 commit f60ce1a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build:

runs-on: windows-2016
strategy:
fail-fast: false
Expand All @@ -26,9 +26,9 @@ jobs:
- python-version: "pypy3.6"
architecture: "x64"
timeout-minutes: 30

name: Python ${{ matrix.python-version }} ${{ matrix.architecture }}

steps:
- uses: actions/checkout@v1

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
"%pythonLocation%\python.exe" -m pip install wheel pytest pytest-cov
pip install codecov
- name: Fetch dependencies
run: |
curl -fsSL -o nasm.zip https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/win64/nasm-2.14.02-win64.zip
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
rem Add GhostScript and Raqm binaries (copied to INCLIB) to PATH.
path %INCLIB%;%PATH%
%PYTHON%\python.exe selftest.py --installed
- name: Test Pillow
run: |
set PYTHON=%pythonLocation%
Expand All @@ -333,7 +333,14 @@ jobs:
path %INCLIB%;%PATH%
cd /D %GITHUB_WORKSPACE%
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests
- name: Upload errors
uses: actions/upload-artifact@v1
if: failure()
with:
name: errors
path: Tests/errors

- name: Upload coverage
run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"'

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ jobs:
run: |
.travis/test.sh
- name: Upload errors
uses: actions/upload-artifact@v1
if: failure()
with:
name: errors
path: Tests/errors

- name: Docs
if: matrix.python-version == 3.7
run: |
Expand Down
18 changes: 16 additions & 2 deletions Tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,26 @@
HAS_UPLOADER = True

class test_image_results:
@classmethod
def upload(self, a, b):
@staticmethod
def upload(a, b):
a.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:
try:
import test_image_results
Expand Down

0 comments on commit f60ce1a

Please sign in to comment.