Skip to content

Tests

Tests #2122

Workflow file for this run

name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 4 * * *"
jobs:
pytest:
name: Unit tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude: # run only latest Python on Windows and macOS
- os: macos-latest
python-version: '3.8'
- os: macos-latest
python-version: '3.9'
- os: macos-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.11'
- os: windows-latest
python-version: '3.8'
- os: windows-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.11'
fail-fast: false
runs-on: ${{ matrix.os }}
env:
OS: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install tox
run: pip install tox
# Run all tests on schedule, but only non-slow tests on push
- name: Run unit tests
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
tox -e py
else
tox -e py -- -m "not slow"
fi
shell: bash # so it doesn't fail on Windows
- name: Upload coverage reports to Codecov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }}
run: |
OS_LOWERCASE=$(echo $RUNNER_OS | tr '[:upper:]' '[:lower:]')
curl -Os https://uploader.codecov.io/latest/${OS_LOWERCASE}/codecov
chmod +x codecov
./codecov
cli:
name: CLI smoke tests
runs-on: ubuntu-latest
env:
PYTHON_VERSION: '3.12'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install project
run: pip install .
- name: Test transforms CLI tool
run: tiotr --help
- name: Test info CLI tool
run: tiohd --help