Skip to content

Commit

Permalink
Merge pull request #4081 from hugovk/test-with-github-actions
Browse files Browse the repository at this point in the history
Test Linux and macOS with GitHub Actions
  • Loading branch information
hugovk authored Oct 12, 2019
2 parents 078a767 + a4d7861 commit 6595ce1
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ codecov:
# https://docs.codecov.io/v4.3.6/docs/comparing-commits
allow_coverage_offsets: true

token: 6dafc396-e7f5-4221-a38a-8b07a49fbdae

comment: off
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7]
python-version: ["3.7"]

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

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/macos-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

brew install libtiff libjpeg webp little-cms2

PYTHONOPTIMIZE=0 pip install cffi
pip install coverage
pip install olefile
pip install -U pytest
pip install -U pytest-cov
pip install pyroma
pip install test-image-results
pip install numpy

# extra test images
pushd depends && ./install_extra_test_images.sh && popd
67 changes: 67 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Test

on: [push, pull_request]

jobs:
build:

strategy:
fail-fast: false
matrix:
os: [
"ubuntu-18.04",
"macOS-10.14",
]
python-version: [
"pypy3",
"3.7",
"3.5",
"3.6",
]
include:
- python-version: "3.5"
env: PYTHONOPTIMIZE=2
- python-version: "3.6"
env: PYTHONOPTIMIZE=1
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
.travis/install.sh
- name: Install macOS dependencies
if: startsWith(matrix.os, 'macOS')
run: |
.github/workflows/macos-install.sh
- name: Build
run: |
.travis/build.sh
- name: Test
run: |
.travis/test.sh
- name: Docs
if: matrix.python-version == 3.7
run: |
pip install sphinx-rtd-theme
make doccheck
- name: After success
if: success()
run: |
.travis/after_success.sh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ script:
if [ "$LINT" == "true" ]; then
tox -e lint
elif [ "$DOCKER" == "" ]; then
.travis/script.sh
.travis/build.sh
.travis/test.sh
elif [ "$DOCKER" ]; then
# the Pillow user in the docker container is UID 1000
sudo chown -R 1000 $TRAVIS_BUILD_DIR
Expand Down
7 changes: 7 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

coverage erase
make clean
make install-coverage
4 changes: 0 additions & 4 deletions .travis/script.sh → .travis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

set -e

coverage erase
make clean
make install-coverage

python -m pytest -v -x --cov PIL --cov-report term Tests

# Docs
Expand Down

0 comments on commit 6595ce1

Please sign in to comment.