Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to master will not cancel.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

Expand All @@ -20,39 +18,42 @@ jobs:
runs-on: ubuntu-24.04
strategy:
matrix:
# https://devguide.python.org/versions/
# 3.9: lower bound = lowest Python non-EOL version
# 3.13: upper bound = latest Python stable version
python-version: ['3.9', '3.13']
# Define Python versions: Lowest supported (3.9) and latest stable (3.12).
# Use 3.12 instead of 3.13 for stable CI unless specifically targeting pre-release.
python-version: ['3.9', '3.12']
steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Optimization: Cache Poetry path and setup automatically using setup-python
cache: 'poetry'

- name: Install poetry
run: make poetry-download

- name: Set up cache
uses: actions/cache@v4
- name: Install Poetry
# Optimization: Use a dedicated action for faster and cleaner Poetry setup
uses: snok/install-poetry@v1
with:
path: .venv
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
version: 1.8.0 # Lock to a specific stable version of Poetry for consistency
# Do not install dependencies yet, let the next step handle it
# poetry-install: false

- name: Install dependencies
- name: Configure and Install Dependencies
# Optimization: Set virtualenvs.in-project for local .venv directory.
run: |
poetry config virtualenvs.in-project true
poetry install
# Install dependencies based on poetry.lock
poetry install --no-root

- name: Run tests
run: |
make test
- name: Run Tests
# Optimization: Use poetry run to ensure execution happens inside the virtual environment
run: poetry run make test

- name: Archive Coverage Artifacts
uses: actions/upload-artifact@v4
# also upload in case of test failure. this does not affect the overall workflow status
# Upload coverage always, even on test failure
if: always()
with:
name: coverage-html-report-${{ matrix.python-version }}
Expand Down