From af0121698b91b6bec03475f67dc9111b4c1f145f Mon Sep 17 00:00:00 2001 From: barentine <31105780+barentine@users.noreply.github.com> Date: Fri, 20 Mar 2026 13:43:53 -0700 Subject: [PATCH 1/5] add a new test workflow which runs weekly and on pull requests --- .github/workflows/pytest.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..73043cd --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,34 @@ +name: Run Tests + +on: + pull_request: + schedule: + - cron: '0 6 * * 1' # Every Monday at 06:00 UTC + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ['3.10', '3.11', '3.12', '3.13'] + + 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 build dependencies + run: | + python -m pip install --upgrade pip + pip install meson-python meson ninja numpy cython pytest + + - name: Build and install package + run: pip install . --no-build-isolation + + - name: Run tests + run: pytest test_pymecompress.py -v From df1b6afa30f3a71536369d9383f3392e9c62fa1e Mon Sep 17 00:00:00 2001 From: barentine <31105780+barentine@users.noreply.github.com> Date: Fri, 20 Mar 2026 13:44:22 -0700 Subject: [PATCH 2/5] fix badge typo, but also point it towards new workflow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6137325..d5b2b36 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # PYMECompress -![testing](https://github.com/python-microscocopy/pymecompress/actions/workflows/test.yml/badge.svg) +![testing](https://github.com/python-microscopy/pymecompress/actions/workflows/pytest.yml/badge.svg) ![conda](https://img.shields.io/conda/v/david_baddeley/pymecompress) ![pypi](https://img.shields.io/pypi/v/pymecompress) ![pyversions](https://img.shields.io/pypi/pyversions/pymecompress) From 2d54d5ab5574d2225b4a287f4b6a2d0a8bec820c Mon Sep 17 00:00:00 2001 From: barentine <31105780+barentine@users.noreply.github.com> Date: Fri, 20 Mar 2026 13:53:17 -0700 Subject: [PATCH 3/5] pytest runs from repo root, want to use site-packages --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 37648f2..f0eb4c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,6 @@ classifiers = [ [project.urls] "Homepage" = "https://github.com/python-microscopy/pymecompress" + +[tool.pytest.ini_options] +addopts = "--import-mode=importlib" From 12b33cb3f6d1c413578b247ef105ac4d4e10cba2 Mon Sep 17 00:00:00 2001 From: barentine <31105780+barentine@users.noreply.github.com> Date: Fri, 20 Mar 2026 13:56:28 -0700 Subject: [PATCH 4/5] delete the old test workflow --- .github/workflows/test.yml | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index ae821c3..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Python Package using Conda - -on: [push] - -jobs: - build-linux: - runs-on: ubuntu-latest - strategy: - max-parallel: 5 - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.8 - uses: actions/setup-python@v3 - with: - python-version: 3.8 - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Install dependencies - run: | - #conda env update --file environment.yml --name base - conda install numpy cython - - name: Lint with flake8 - run: | - conda install flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Build extensions - run: | - python setup.py build_ext -i - - name: Test with pytest - run: | - conda install pytest - pytest From b990d15261554d0311003080d2bd1124c4e1d2cd Mon Sep 17 00:00:00 2001 From: barentine <31105780+barentine@users.noreply.github.com> Date: Fri, 20 Mar 2026 14:54:57 -0700 Subject: [PATCH 5/5] try and use mingw32 for windows tests --- .github/workflows/pytest.yml | 52 +++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 73043cd..8f310b1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -11,24 +11,62 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, macos-latest] python-version: ['3.10', '3.11', '3.12', '3.13'] + include: + # Windows builds require mingw/gcc (MSVC cannot compile the AVX intrinsics). + # Use conda + m2w64-toolchain to match the wheel build workflow. + - os: windows-latest + python-version: '3.10' + - os: windows-latest + python-version: '3.11' + - os: windows-latest + python-version: '3.12' + - os: windows-latest + python-version: '3.13' steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + # --- Linux / macOS: plain pip install --- + - name: Set up Python ${{ matrix.python-version }} (non-Windows) + if: runner.os != 'Windows' uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - pip install meson-python meson ninja numpy cython pytest + - name: Install build dependencies (non-Windows) + if: runner.os != 'Windows' + run: pip install meson-python meson ninja numpy cython pytest - - name: Build and install package + - name: Build and install (non-Windows) + if: runner.os != 'Windows' run: pip install . --no-build-isolation + # --- Windows: conda + mingw so gcc is used instead of MSVC --- + - name: Set up conda + Python ${{ matrix.python-version }} (Windows) + if: runner.os == 'Windows' + uses: conda-incubator/setup-miniconda@v3 + with: + python-version: ${{ matrix.python-version }} + auto-activate-base: false + activate-environment: test + + - name: Install build dependencies (Windows) + if: runner.os == 'Windows' + shell: bash -el {0} + run: | + conda install -y numpy cython libpython m2w64-toolchain + pip install meson-python meson ninja pytest + + - name: Build and install (Windows) + if: runner.os == 'Windows' + shell: bash -el {0} + run: | + pip install . --no-build-isolation \ + -Csetup-args="--native-file=${{ github.workspace }}/mingw_native.ini" + + # --- Run tests --- - name: Run tests + shell: bash -el {0} run: pytest test_pymecompress.py -v