Skip to content

tests

tests #55

# This workflows will upload a Python Package using Twine when a release is created
name: tests
on:
push:
branches:
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: ['ubuntu-latest', 'windows-latest', 'macos-latest']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: macos-latest

Check failure on line 26 in .github/workflows/test_and_deploy.yml

View workflow run for this annotation

GitHub Actions / tests

Invalid workflow file

The workflow is not valid. .github/workflows/test_and_deploy.yml (Line: 26, Col: 13): Matrix exclude key 'os' does not match any key within the matrix .github/workflows/test_and_deploy.yml (Line: 27, Col: 13): Matrix exclude key 'pyversion' does not match any key within the matrix
pyversion: '3.8'
- os: macos-latest
pyversion: '3.9'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install setuptools pytest pytest-cov pytest-xvfb
# this runs the platform-specific tests declared in tox.ini
- name: Test with pytest
run: |
python3 -m pytest --cov=./ --cov-report=xml
- name: Coverage
uses: codecov/codecov-action@v4
deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
strategy:
fail-fast: false
matrix:
platform: ['ubuntu-latest', 'windows-latest', 'macos-latest']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: macos-latest
pyversion: '3.8'
- os: macos-latest
pyversion: '3.9'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python setup.py sdist bdist_wheel
twine upload dist/*