Skip to content

Improve Pylance support for Raster (#68) #162

Improve Pylance support for Raster (#68)

Improve Pylance support for Raster (#68) #162

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
tags:
- v*.*.*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
artifact_prefix: snaphu-py
jobs:
build-and-test:
strategy:
matrix:
include:
- label: Linux x86_64
runner: ubuntu-latest
- label: macOS x86_64
runner: macos-latest
- label: macOS arm64
runner: macos-14
fail-fast: false
name: Build & test (${{ matrix.label }})
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- uses: actions/setup-python@v5
with: { python-version: ">=3.9" }
- run: pip install ".[raster,test]" -vv
- run: pytest -vv
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
min-reqs:
name: Build & test (minimum requirements)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- uses: actions/setup-python@v5
with: { python-version: "3.9" }
- run: pip install -c ci/min-reqs.txt ".[raster,test]" -vv
- run: pytest -vv
no-optional-deps:
name: Build & test (no optional dependencies)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- uses: actions/setup-python@v5
with: { python-version: ">=3.9" }
- run: pip install ".[test]" -vv
- run: pytest -vv
build-wheels:
if: github.event_name == 'push'
strategy:
matrix:
include:
- label: Linux x86_64
runner: ubuntu-latest
arch: x86_64
- label: macOS x86_64
runner: macos-latest
arch: x86_64
- label: macOS arm64
runner: macos-14
arch: arm64
fail-fast: false
name: Build, lint, & test wheels (${{ matrix.label }})
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- uses: pypa/cibuildwheel@v2.18.1
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_REQUIRES: pytest>=6 pytest-cov>=3
CIBW_TEST_COMMAND: pytest {package}/test
- uses: actions/setup-python@v5
with: { python-version: ">=3.7" }
- run: |
pip install check-wheel-contents
check-wheel-contents ./wheelhouse/*.whl
- uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_prefix }}-wheels-${{ matrix.runner }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
build-sdist:
name: Build & lint sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- run: pipx run build --sdist
- run: pipx run twine check --strict dist/*
- uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_prefix }}-sdist
path: dist/*.tar.gz
publish-to-testpypi:
if: github.event_name == 'push'
name: Publish to TestPyPI
needs: [build-wheels, build-sdist]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/snaphu
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: ${{ env.artifact_prefix }}-*
path: dist/
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
create-release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Create a release
needs:
- build-and-test
- min-reqs
- no-optional-deps
- build-wheels
- build-sdist
- publish-to-testpypi
permissions:
contents: write
runs-on: ubuntu-latest
env:
name_and_tag: snaphu-py-${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0, submodules: true }
- run: |
pipx run git-archive-all ${{ env.name_and_tag }}.zip
unzip -l ${{ env.name_and_tag }}.zip
- run: |
pipx run git-archive-all ${{ env.name_and_tag }}.tar.gz
tar -ztvf ${{ env.name_and_tag }}.tar.gz
- uses: softprops/action-gh-release@v2
with:
files: |
${{ env.name_and_tag }}.zip
${{ env.name_and_tag }}.tar.gz
generate_release_notes: true
publish-to-pypi:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
name: Publish to PyPI
needs:
- build-wheels
- build-sdist
- create-release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/snaphu
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: ${{ env.artifact_prefix }}-*
path: dist/
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1