Skip to content

Python tests

Python tests #5356

Workflow file for this run

# note: to invalidate caches, adjust the pip-v? number below.
name: Python tests
on:
push:
branches: [latest]
pull_request:
schedule:
- cron: "0 0 * * *" # daily
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest]
py: ["3.11", "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@v4
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@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-v4-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-v4-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Set up IPFS
if: startsWith(runner.os, 'Linux') && (matrix.py == '3.9')
uses: ibnesayeed/setup-ipfs@master
with:
ipfs_version: 0.6
run_daemon: true
- name: Start Redis
if: startsWith(runner.os, 'Linux') && (matrix.py == '3.9')
uses: supercharge/[email protected]
with:
redis-version: 6
- name: tox cache
uses: actions/cache@v3
with:
path: .tox/
key: ${{ runner.os }}-tox-v4-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-tox-v4-
- 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: .tox/coverage.xml