Skip to content

Add Python 3.12 to test matrix #27

Add Python 3.12 to test matrix

Add Python 3.12 to test matrix #27

Workflow file for this run

name: Build package, run test matrix, and publish on PyPi
env:
BUILD_PYTHON_VERSION: "3.10"
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ env.BUILD_PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.BUILD_PYTHON_VERSION }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build packages
run: |
python -m build
shasum dist/*
- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
test:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install mypy
- name: Install built packages
run: |
pip install -U dist/*.whl
- name: Test with pytest
run: pytest
- name: Test with mypy
run: mypy --install-types --non-interactive src/trick17 tests
pypi-publish:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/trick17
permissions:
id-token: write
steps:
- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1