Overhaul of the package #33
Workflow file for this run
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: Run unit tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] | |
name: Python ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:] + a["options"]["extras_require"]["testing"][1:]))') | |
pip install ${DEPENDENCIES} pybind11 | |
# We do proper tests if we're on the master branch, or if we're creating a new release. | |
- name: Test with tox | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
run: | | |
pip install tox | |
tox | |
# Otherwise we do some cached builds and tests for faster merging of PRs. | |
- name: Set up ccache | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags') | |
uses: hendrikmuhs/[email protected] | |
- name: Quickly build and test | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags') | |
run: | | |
CC="ccache gcc" python setup.py install | |
pytest |