Merge pull request #148 from learningequality/rtibbles-patch-2 #270
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: Python tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
pre_job: | |
name: Path match check | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
github_token: ${{ github.token }} | |
paths: '["**.py", ".github/workflows/pythontest.yml", "requirements-test.txt", "tox.ini"]' | |
unit_test: | |
name: Python unit tests | |
needs: pre_job | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('setup.py') }} | |
- name: Install tox | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: tox env cache | |
if: ${{ !startsWith(runner.os, 'windows') }} | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.tox/py${{ matrix.python-version }} | |
key: ${{ runner.os }}-tox-py${{ matrix.python-version }}-${{ hashFiles('setup.py') }} | |
- name: Test with tox | |
run: tox -e py${{ matrix.python-version }} |