fixes #64
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: Continuous Integration | |
on: [push, pull_request] | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ci-tests-${{ github.ref }}-1 | |
cancel-in-progress: true | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.8", "pypy3.9", ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Print Python Information | |
run: python -VV | |
- name: Install and configure uv | |
run: pip3 install -U pip uv | |
- name: Set up cache | |
uses: actions/cache@v4 | |
id: cached-uv-dependencies | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/uv.lock') }} | |
- name: Install dependencies | |
run: uv sync --all-extras | |
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true' | |
- name: Run ruff | |
run: uv run ruff check | |
- name: run tests | |
run: uv run pytest -vv tests/* | |
builder: | |
needs: [test] | |
runs-on: ubuntu-latest # Any OS is fine as this wheel is not OS dependent | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 # Build any 1 python version as this wheel is not version dependent | |
- name: Install and configure uv | |
run: pip3 install uv | |
- name: Set up cache | |
uses: actions/cache@v4 | |
id: cached-uv-dependencies | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/uv.lock') }} | |
- name: Install dependencies | |
run: uv sync --all-extras | |
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true' | |
- name: Build universal source Archive and wheel | |
run: uv build | |
- name: delete all files in dist that is not tar.gz or whl | |
run: find dist/ -type f ! -name "*.tar.gz" ! -name "*.whl" -delete | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publisher_release: | |
needs: [builder] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verbose: true | |
publisher_latest: | |
needs: [builder] | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Make release | |
uses: "marvinpinto/action-automatic-releases@v1.2.1" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
title: "Latest Development Version" | |
automatic_release_tag: "latest" | |
files: dist/* |