Skip to content

Commit

Permalink
Run the test suite in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtmckee committed Oct 29, 2023
1 parent d016918 commit 3f2141a
Showing 1 changed file with 45 additions and 11 deletions.
56 changes: 45 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: "🔬 Test"

on:
pull_request: null
push:
branches:
- "main"
- "releases"

jobs:
test:
name: "Test on ${{ matrix.os.name }}"
tox:
name: "Tox (${{ matrix.os.name }})"

strategy:
matrix:
Expand All @@ -22,16 +24,48 @@ jobs:

runs-on: "${{ matrix.os.runner }}"
steps:
- name: "Use it!"
id: "detector"
uses: "kurtmckee/detect-pythons@main"
- name: "Checkout the repository"
uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1

- name: "Print it!"
shell: "bash"
run: |
echo '${{ steps.detector.outputs.python-identifiers }}'
- name: "Setup Pythons"
uses: "actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1
with:
python-version: |
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 -c ./src/detect_pythons/detector.sh > .python-identifiers"

- name: "Detect Pythons (Windows)"
if: "runner.os == 'Windows'"
run: "& ./src/detect_pythons/detector.ps1 > .python-identifiers"

- name: "Display it!"
- 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: |
cat .python-identifiers
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"

0 comments on commit 3f2141a

Please sign in to comment.