CI: Fix Meson mixup between Conda and system Python headers #1483
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: [push, pull_request] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| # macos-15-large is an intel runner, macos-14 is an arm64 runner | |
| platform: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-15-large, macos-14] | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 # required for version resolution | |
| - name: Set up Conda | |
| uses: conda-incubator/setup-miniconda@v3.2.0 | |
| with: | |
| channels: conda-forge | |
| miniforge-version: latest | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: test | |
| auto-activate-base: false | |
| - name: Install build dependencies and compilers | |
| run: | | |
| conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler | |
| - name: Install clang | |
| if: matrix.platform == 'macos-15-large' | |
| run: conda install -y 'clang>=12.0.1,<17' | |
| - name: Show conda environment info | |
| run: | | |
| conda info | |
| conda config --show-sources | |
| conda list --show-channel-urls | |
| - name: Meson args - prefer Conda over system Python (Ubuntu) | |
| if: startsWith(matrix.platform, 'ubuntu') | |
| run: | | |
| echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV | |
| PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" | |
| echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV | |
| - name: Install numcodecs | |
| run: | | |
| # TODO: Remove this conditional when pcodec supports Python 3.14 | |
| if [[ "${{ matrix.python-version }}" == "3.14" ]]; then | |
| python -m pip install -v \ | |
| ".[test,test_extras,msgpack,google_crc32c,crc32c,zfpy]" \ | |
| pytest | |
| else | |
| python -m pip install -v \ | |
| ".[test,test_extras,msgpack,google_crc32c,crc32c,pcodec,zfpy]" \ | |
| pytest | |
| fi | |
| - name: List installed packages | |
| run: python -m pip list | |
| - name: Run tests | |
| run: python -m pytest -v | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| test-crc32c: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: google-crc32c | |
| extras: "google_crc32c" | |
| - name: crc32c | |
| extras: "crc32c" | |
| - name: no-crc32c | |
| extras: "" | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up Conda | |
| uses: conda-incubator/setup-miniconda@v3.2.0 | |
| with: | |
| channels: conda-forge | |
| miniforge-version: latest | |
| python-version: "3.13" | |
| activate-environment: test | |
| auto-activate-base: false | |
| - name: Install build dependencies and compilers | |
| run: | | |
| conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler | |
| - name: Meson args - prefer Conda over system Python (Ubuntu) | |
| run: | | |
| echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV | |
| PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" | |
| echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV | |
| - name: Install numcodecs | |
| run: | | |
| if [[ -n "${{ matrix.extras }}" ]]; then | |
| python -m pip install -v ".[${{ matrix.extras }},test]" | |
| else | |
| python -m pip install -v ".[test]" | |
| fi | |
| - name: List installed packages | |
| run: python -m pip list | |
| - name: Run checksum tests | |
| run: python -m pytest -v tests/test_checksum32.py | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| test-zarr: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - zarr-version: "308" | |
| zarr-pkg: "zarr==3.0.8" | |
| - zarr-version: "316" | |
| zarr-pkg: "zarr==3.1.6" | |
| - zarr-version: "main" | |
| zarr-pkg: "zarr @ git+https://github.com/zarr-developers/zarr-python.git@main" | |
| defaults: | |
| run: | |
| shell: bash -el {0} | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 # required for version resolution | |
| - name: Set up Conda | |
| uses: conda-incubator/setup-miniconda@v3.2.0 | |
| with: | |
| channels: conda-forge | |
| miniforge-version: latest | |
| python-version: "3.13" | |
| activate-environment: test | |
| auto-activate-base: false | |
| - name: Install build dependencies and compilers | |
| run: | | |
| conda install -y python numpy cython meson meson-python ninja c-compiler cxx-compiler | |
| - name: Meson args - prefer Conda over system Python (Ubuntu) | |
| run: | | |
| echo "MESONPY_PYTHON=$(python -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV | |
| PY_INC="$(python -c 'import sysconfig; print(sysconfig.get_path("include"))')" | |
| echo "CFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CFLAGS:-}" >> $GITHUB_ENV | |
| echo "CPPFLAGS=-I${PY_INC} -I${CONDA_PREFIX}/include ${CPPFLAGS:-}" >> $GITHUB_ENV | |
| echo "LDFLAGS=-L${CONDA_PREFIX}/lib ${LDFLAGS:-}" >> $GITHUB_ENV | |
| - name: Install numcodecs and Zarr | |
| run: | | |
| python -m pip install -v ".[test,test_extras]" "${{ matrix.zarr-pkg }}" crc32c | |
| - name: List installed packages | |
| run: python -m pip list | |
| - name: Run Zarr integration tests | |
| run: python -m pytest tests/test_zarr3.py tests/test_zarr3_import.py | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true |