Skip to content

Commit

Permalink
Simplify testing setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Dec 4, 2023
1 parent 371f7f5 commit bf43e8a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 72 deletions.
66 changes: 14 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,29 @@ on: [push, pull_request]

jobs:
test:
name: Test ${{ matrix.os }} / ${{ matrix.toxenv }}
name: Test ${{ matrix.os }}-python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: windows-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: windows-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: windows-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: windows-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: ubuntu-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: ubuntu-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: ubuntu-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: ubuntu-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: macos-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: macos-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: macos-latest, python_Version: '3.8', toxenv: 'py38'}
# missing numcodecs wheels on 3.9. conda not yet an option. see gh-51
# {os: macos-latest, python_Version: '3.9', toxenv: 'py39'}

python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

- name: Install ubuntu libraries
if: startsWith(matrix.os, 'ubuntu')
run: "\
sudo apt-get install -y \
libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
libxcb-render-util0 libxcb-xinerama0 \
libxcb-xinput0 libxcb-xfixes0"

- name: Install & test
run: |
python -m pip install tox
tox -e ${{ matrix.toxenv }}
test_coverage:
name: Test coverage
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python '3.10'
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install -r requirements/requirements-dev.txt
- name: Test
run: tox -e 'py310-coverage'
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox --conf tox.ini

- uses: codecov/codecov-action@v2
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
fail_ci_if_error: false
fail_ci_if_error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build
dist/
target/
docs/build/

# Testing files
.tox*
.coverage*
coverage.xml
1 change: 0 additions & 1 deletion requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pytest
pytest-cov
codecov
30 changes: 11 additions & 19 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py{38,39,310,311}
envlist = py{38,39,310,311,312}


[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
# passenv = DISPLAY XAUTHORITY
passenv = GITHUB_ACTIONS
deps =
-rrequirements/requirements-dev.txt
pytest-xvfb ; sys_platform == 'linux'

commands =
pytest {posargs:tests -s}
-r requirements/requirements-test.txt

[testenv:py310-coverage]
passenv =
CI
GITHUB_ACTIONS
usedevelop = true
commands =
pytest --cov-report=xml --cov=./ome_zarr --cov-append {posargs:-v}
codecov -f codecov.xml

0 comments on commit bf43e8a

Please sign in to comment.