From c2a6f6200b8576c001c734c123df22762d357bce Mon Sep 17 00:00:00 2001 From: Gregor Lichtner Date: Wed, 2 Oct 2024 20:38:38 +0200 Subject: [PATCH] test: add numpy<2 and >=2 tests --- .github/workflows/run-tests.yml | 40 +++++++++++++++++++++++++-------- tox.ini | 24 +++++++++----------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 811702a..dd3f92a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,31 +6,53 @@ on: - main pull_request: - jobs: test: - name: test ${{ matrix.python-version }} - ${{ matrix.os }} + name: test py==${{ matrix.python-version }} - numpy==${{ matrix.numpy-version }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: [macos-latest, windows-latest, ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] - exclude: - - os: macos-latest - python-version: "3.7" + python-version: ["3.9", "3.10", "3.11", "3.12"] + numpy-version: ["1.26", "2.0"] + include: + + - python-version: "3.7" + os: windows-latest + numpy-version: "1.21" + + - python-version: "3.7" + os: ubuntu-latest + numpy-version: "1.21" + + - python-version: "3.8" + os: windows-latest + numpy-version: "1.21" + - python-version: "3.8" + os: macos-latest + numpy-version: "1.21" + + - python-version: "3.8" + os: ubuntu-latest + numpy-version: "1.21" steps: - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install tox and dependencies run: | - python -m pip install --upgrade pip + python -m pip install --upgrade pip setuptools wheel pip install tox - - name: Test with tox + + - name: Run tests with numpy ${{ matrix.numpy-version }} + env: + NUMPY_VERSION: ${{ matrix.numpy-version }} # Pass numpy version to tox run: | tox -e py diff --git a/tox.ini b/tox.ini index bbe1343..3d32396 100644 --- a/tox.ini +++ b/tox.ini @@ -1,17 +1,15 @@ [tox] -requires = - numpy - tqdm +envlist = py [testenv] -deps= - -rrequirements.txt - tifffile - pytest - setuptools - numpy +deps = + pytest + tifffile + numpy=={env:NUMPY_VERSION} + setuptools + wheel + -rrequirements.txt -commands= - pip install -e . - python setup.py install - pytest {posargs:} +commands = + pip install -e . + pytest {posargs:}