Tests #789
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: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| schedule: | |
| # Run weekly, Friday at 7:15 EST. | |
| - cron: '15 12 * * 5' | |
| jobs: | |
| build: | |
| if: | | |
| startsWith(github.ref, 'refs/tags/v0') || | |
| startsWith(github.ref, 'refs/tags/v1') || | |
| startsWith(github.ref, 'refs/tags/v2') || | |
| startsWith(github.ref, 'refs/tags/v3') || | |
| startsWith(github.ref, 'refs/tags/v4') || | |
| startsWith(github.ref, 'refs/tags/v5') || | |
| startsWith(github.ref, 'refs/tags/v6') || | |
| startsWith(github.ref, 'refs/tags/v7') || | |
| startsWith(github.ref, 'refs/tags/v8') || | |
| startsWith(github.ref, 'refs/tags/v9') | |
| name: Build Wheels | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install build | |
| - name: Build | |
| run: python -m build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: | | |
| ./dist/*.whl | |
| ./dist/*.tar.gz | |
| tests: | |
| name: Tests | |
| # always run, but wait for build if publishing | |
| if: ${{ ! cancelled() }} | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| env: | |
| PUBLISH: > | |
| ${{ | |
| startsWith(github.ref, 'refs/tags/v0') || | |
| startsWith(github.ref, 'refs/tags/v1') || | |
| startsWith(github.ref, 'refs/tags/v2') || | |
| startsWith(github.ref, 'refs/tags/v3') || | |
| startsWith(github.ref, 'refs/tags/v4') || | |
| startsWith(github.ref, 'refs/tags/v5') || | |
| startsWith(github.ref, 'refs/tags/v6') || | |
| startsWith(github.ref, 'refs/tags/v7') || | |
| startsWith(github.ref, 'refs/tags/v8') || | |
| startsWith(github.ref, 'refs/tags/v9') | |
| }} | |
| strategy: | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Pre-install dependencies | |
| run: | | |
| sudo apt-get install libgsl-dev | |
| pip install -vU pip | |
| pip install -vU Cython numpy setuptools wheel | |
| - name: "Python 3.13: pre-install dependencies" | |
| # waiting for 3.13 wheels and/or release to fix cmake build issue | |
| if: matrix.python-version == '3.13' | |
| run: | | |
| pip install -v git+https://github.com/Blosc/python-blosc.git@e9094341a845b3a9da49c3b7b39a02ee157a0dba | |
| - name: Install package from source | |
| if: ${{ env.PUBLISH != 'true' }} | |
| run: | | |
| pip install -vU .[test] | |
| make -C pipe_asdf | |
| - name: Fetch wheel | |
| if: ${{ env.PUBLISH == 'true' }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifact | |
| path: dist | |
| - name: Install package from wheel | |
| if: ${{ env.PUBLISH == 'true' }} | |
| run: | | |
| pip install $(ls dist/*.whl)[test] | |
| - name: Test Python with pytest | |
| run: | | |
| # TODO: set up environment in tox | |
| export NUMBA_THREADING_LAYER=forksafe | |
| pytest -v | |
| - name: Test pipe_asdf | |
| # no C test client from wheels | |
| if: ${{ env.PUBLISH != 'true' }} | |
| run: | | |
| ./tests/test_pipe_asdf.sh | |
| upload: | |
| name: PyPI Upload | |
| if: | | |
| startsWith(github.ref, 'refs/tags/v0') || | |
| startsWith(github.ref, 'refs/tags/v1') || | |
| startsWith(github.ref, 'refs/tags/v2') || | |
| startsWith(github.ref, 'refs/tags/v3') || | |
| startsWith(github.ref, 'refs/tags/v4') || | |
| startsWith(github.ref, 'refs/tags/v5') || | |
| startsWith(github.ref, 'refs/tags/v6') || | |
| startsWith(github.ref, 'refs/tags/v7') || | |
| startsWith(github.ref, 'refs/tags/v8') || | |
| startsWith(github.ref, 'refs/tags/v9') | |
| needs: [build, tests] | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: artifact | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 |