Merge pull request #2 from kurtmckee/add-tests #130
This file contains 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: "🔬 Test" | |
on: | |
pull_request: null | |
push: | |
branches: | |
- "main" | |
- "releases" | |
jobs: | |
tox: | |
name: "Tox (${{ matrix.os.name }})" | |
strategy: | |
matrix: | |
os: | |
- name: "Linux" | |
runner: "ubuntu-latest" | |
- name: "macOS" | |
runner: "macos-latest" | |
- name: "Windows" | |
runner: "windows-latest" | |
fail-fast: false | |
runs-on: "${{ matrix.os.runner }}" | |
steps: | |
- name: "Checkout the repository" | |
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1 | |
- name: "Setup Pythons" | |
uses: "actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1 | |
with: | |
python-version: | | |
pypy3.8 | |
pypy3.9 | |
pypy3.10 | |
3.8 | |
3.9 | |
3.10 | |
3.11 | |
3.12 | |
allow-prereleases: true | |
cache: "pip" | |
- name: "Detect Pythons (Linux/macOS)" | |
if: "runner.os != 'Windows'" | |
run: "bash ./src/detect_pythons/detector.sh > .python-identifiers" | |
- name: "Detect Pythons (Windows)" | |
if: "runner.os == 'Windows'" | |
run: "& ./src/detect_pythons/detector.ps1 > .python-identifiers" | |
- name: "Restore cache" | |
id: "restore-cache" | |
uses: "actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.2 | |
with: | |
path: | | |
.tox/ | |
.venv/ | |
key: "tox-os=${{ matrix.run.os.id }}-hash=${{ hashFiles('.python-identifiers', 'tox.ini') }}" | |
- 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: "Run the test suite" | |
run: "${{ env.venv-path }}/tox" |