Skip to content

Document development environment and testing #19

Document development environment and testing

Document development environment and testing #19

Workflow file for this run

on:
# Run on any push to master.
push:
branches:
- master
# Run on published releases.
release:
types:
- published
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- id: cache
uses: actions/cache@v4
# Keep uv cache and Python virtual environment.
with:
key: ${{ hashFiles('pyproject.toml', 'uv.lock') }}-${{ matrix.python-version }}
path: |
~/.local/share/uv
.venv
- run: |
# Run tests.
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python pin ${{ matrix.python-version }}
uv run pytest -v -k 'not test_ubank_client'
publish:
needs: test
# Only publish if releasing.
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
# Allows JWT to be requested from GitHub's OIDC provider for publishing to PyPI.
id-token: write
steps:
- uses: actions/checkout@v4
- id: cache
uses: actions/cache@v4
# Keep uv cache and Python virtual environment.
with:
key: ${{ hashFiles('pyproject.toml', 'uv.lock') }}
path: |
~/.local/share/uv
.venv
- run: |
# Build and publish to PyPI.
curl -LsSf https://astral.sh/uv/install.sh | sh
uv build
uv publish