Skip to content

Python tests

Python tests #648

Workflow file for this run

name: Python tests
on:
push:
branches: [latest]
pull_request:
branches: [latest]
schedule:
- cron: "0 0 7 * *" # monthly
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
py: ["3.10", 3.9, 3.8]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.py }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-v2-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: tox cache
uses: actions/cache@v4
with:
path: .tox/
key: ${{ runner.os }}-tox-v2-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-tox-v2
- name: Test with tox
run: tox
env:
PYTHONDEVMODE: 1
- name: Upload Python coverage to codecov
uses: codecov/codecov-action@v3
with:
flags: python
fail_ci_if_error: true
files: coverage.xml