Skip to content

Commit

Permalink
re-add python 2.7 test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fdintino committed Sep 12, 2023
1 parent 09ed9ac commit 080aa40
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/linux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

set -eo pipefail

aptget()
{
if [ $(id -u) == 0 ]; then
apt-get "$@"
else
sudo apt-get "$@"
fi
}

aptget_update()
{
if [ ! -z $1 ]; then
echo ""
echo "Retrying apt-get update..."
echo ""
fi
output=`sudo apt-get update 2>&1`
output=`aptget update 2>&1`
echo "$output"
if [[ $output == *[WE]:\ * ]]; then
return 1
Expand All @@ -19,11 +28,12 @@ aptget_update || aptget_update retry || aptget_update retry

set -e

sudo apt-get -qq install zlib1g-dev libpng-dev libjpeg-dev \
aptget -qq install zlib1g-dev libpng-dev libjpeg-dev sudo \
libxml2-dev libffi-dev libxslt-dev cmake ninja-build nasm

if [ "$GHA_PYTHON_VERSION" == "2.7" ]; then
python2 -m pip install tox tox-gh-actions
aptget install -y python3-pip
else
python3 -m pip install 'tox<4' tox-gh-actions
fi
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
"3.9",
"3.8",
"3.7",
"2.7",
]
libavif-version: [ "0.11.0" ]
include:
- python-version: "3.7"
PYTHONOPTIMIZE: 1
Expand All @@ -29,17 +31,23 @@ jobs:
codecov-flag: GHA_Ubuntu
- os: macos-11
codecov-flag: GHA_macOS
exclude:
- python-version: "2.7"
os: "macos-11"

runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }} (libavif ${{ matrix.libavif-version }})
container:
image: ${{ matrix.python-version == '2.7' && 'python:2.7-buster' || null }}

env:
LIBAVIF_VERSION: 0.11.0
LIBAVIF_VERSION: ${{ matrix.libavif-version }}

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -74,7 +82,6 @@ jobs:
if: failure()
run: |
mkdir -p tests/errors
shell: pwsh
- name: Upload errors
uses: actions/upload-artifact@v3
Expand All @@ -89,9 +96,9 @@ jobs:
CODECOV_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }}

- name: Upload coverage
run: tox -e codecov -- -F ${{ matrix.codecov-flag }}
env:
CODECOV_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }}
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml

msys:
runs-on: windows-latest
Expand Down
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ envlist = py{27,37,38,39,310,py37}
minversion = 1.9

[gh-actions]
problem_matcher = False
python =
2.7: py27
3.7: py37
Expand All @@ -29,10 +30,10 @@ commands =
{envpython} setup.py clean
{envpython} setup.py build_ext --build-lib {envdir}/src --build-temp {envdir} develop
{envpython} -m pytest -W always {posargs: -vv --cov pillow_avif --cov tests --cov-report term}
- gcovr -r {toxinidir} --object-directory {envdir} -k
{envpython} -c "import os; os.path.exists('{toxworkdir}/coverage') or os.makedirs('{toxworkdir}/coverage')"
- gcovr -r {toxinidir} --object-directory {envdir} -k --xml \
-o {toxworkdir}/coverage/gcov_coverage.{envname}.xml
- gcovr -r {toxinidir} --object-directory {envdir} -k \
--gcov-ignore-errors=no_working_dir_found \
-o {toxworkdir}/coverage/.gcov_coverage.{envname}
deps =
gcovr
pytest
Expand All @@ -50,7 +51,7 @@ changedir = {toxworkdir}/coverage
commands =
coverage combine
coverage report
coverage xml
coverage xml -o {toxinidir}/coverage.xml

[testenv:codecov]
skip_install = true
Expand All @@ -59,4 +60,4 @@ depends = coverage-report
passenv = CODECOV_TOKEN
changedir = {toxinidir}
commands =
codecov -X gcov --file {toxworkdir}/coverage/*.xml {posargs}
codecov -X gcov --file {toxinidir}/coverage.xml {posargs}

0 comments on commit 080aa40

Please sign in to comment.