Skip to content

Merge back to main

Merge back to main #59

Workflow file for this run

name: "🔬 Test"
on:
pull_request:
push:
branches:
- "main"
- "releases"
jobs:
test:
name: "${{ matrix.os.name }}"
runs-on: "${{ matrix.os.id }}"
strategy:
matrix:
os:
- id: "ubuntu-latest"
name: "Ubuntu"
- id: "macos-latest"
name: "macOS"
- id: "windows-latest"
name: "Windows"
cpythons:
# This list-in-list syntax creates a single-element list,
# and that single element is a full list of Python versions.
# It means each runner will receive a list of all Python versions.
- - "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: "Checkout branch"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1
- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1
with:
python-version: "${{ join(matrix.cpythons, '\n') }}"
allow-prereleases: true
- name: "Detect Pythons"
uses: "kurtmckee/detect-pythons@cd2193638306e04e41ac36f0f9290f18680138ac" # v1.0.0
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.2
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "test-os=${{ runner.os }}-hash=${{ hashFiles('.python-identifiers', 'tox.ini', 'requirements/*.txt') }}"
- name: "Identify venv path"
shell: "bash"
run: "echo 'venv-path=.venv/${{ runner.os == 'Windows' && 'Scripts' || 'bin' }}' >> $GITHUB_ENV"
- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
${{ env.venv-path }}/python -m pip install --upgrade pip setuptools wheel
${{ env.venv-path }}/pip install tox
- name: "Test"
run: |
${{ env.venv-path }}/tox run --colored yes -e py${{ join(matrix.cpythons, ',py') }},coverage-report-ci,mypy
- name: "Docs"
if: "matrix.os.name == 'Ubuntu'"
run: |
${{ env.venv-path }}/tox run --colored yes -e docs