MNT: Create and test universal wheels #67
Workflow file for this run
This file contains 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: Build, test, deploy | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
test: | |
name: Test repo install | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- ["conda", "2.7"] | |
- ["conda", "3.6"] | |
- ["conda", "3.7"] | |
- ["native", "3.8"] | |
- ["native", "3.9"] | |
- ["native", "3.10"] | |
- ["native", "3.11"] | |
- ["native", "3.12"] | |
requires: ["", "requirements.txt"] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} (native) | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python[1] }} | |
allow-prereleases: true | |
if: matrix.python[0] == 'native' | |
- name: Set up Python ${{ matrix.python-version }} (miniconda) | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python[1] }} | |
if: matrix.python[0] == 'conda' | |
- name: Check environment | |
run: | | |
which python | |
which python3 | |
echo $CONDA_PREFIX | |
echo $PATH | |
- name: Update pip and pytest | |
run: python -m pip install --upgrade pip pytest pytest-cov | |
- name: Install requires | |
run: | | |
python -m pip install -r ${{ matrix.requires }} | |
if: ${{ matrix.requires }} | |
- name: Install gradunwarp | |
run: | | |
python -m pip install . | |
- name: Test | |
run: pytest --pyargs gradunwarp --cov gradunwarp | |
working-directory: /tmp | |
build: | |
name: Build packages | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build sdist and wheel | |
run: pipx run build | |
- name: Check packages | |
run: pipx run twine check dist/* | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist/* | |
test-dist: | |
name: Test package install | |
needs: [build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] | |
python: | |
- ['conda', '2.7'] | |
- ['native', '3'] | |
package: ['sdist', 'wheel'] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- name: Set up Python ${{ matrix.python[1] }} (native) | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python[1] }} | |
allow-prereleases: true | |
if: matrix.python[0] == 'native' | |
- name: Set up Python ${{ matrix.python[1] }} (miniconda) | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python[1] }} | |
if: matrix.python[0] == 'conda' | |
- name: Install sdist | |
run: pip install dist/*.tar.gz | |
if: matrix.package == 'sdist' | |
- name: Install wheel | |
run: pip install dist/*.whl | |
if: matrix.package == 'wheel' | |
- name: Check gradunwarp version | |
shell: bash -el -c python {0} | |
run: | | |
from gradunwarp.core.globals import VERSION | |
print(VERSION) | |
- name: Install pytest | |
run: pip install pytest | |
- name: Run tests | |
run: pytest -v --pyargs gradunwarp | |
publish: | |
name: Upload to PyPI | |
runs-on: ubuntu-latest | |
environment: "Package deployment" | |
needs: [test, test-dist] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 |