Python Unittests #371
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: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
SETUP_XVFB: True # avoid issues if mpl tries to open a GUI window | |
TOXARGS: '-v' | |
jobs: | |
ci-tests: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]'))" | |
strategy: | |
matrix: | |
include: | |
- name: 'ubuntu-py38-oldestdeps' | |
os: ubuntu-latest | |
python: '3.8' | |
# Test the oldest supported dependencies on the oldest supported Python | |
tox_env: 'py38-test-oldestdeps' | |
- name: 'macos-py310-astroscrappy11' | |
# Keep this test until astroscrappy 1.1.0 is the oldest supported | |
# version. | |
os: macos-latest | |
python: '3.10' | |
tox_env: 'py310-test-astroscrappy11' | |
- name: 'ubuntu-py39' | |
os: ubuntu-latest | |
python: '3.9' | |
tox_env: 'py39-test-alldeps-numpy119-cov' | |
- name: 'ubuntu-py39-bottleneck' | |
os: ubuntu-latest | |
python: '3.9' | |
tox_env: 'py39-test-alldeps-numpy119-cov-bottleneck' | |
- name: 'ubuntu-py310' | |
os: ubuntu-latest | |
python: '3.10' | |
tox_env: 'py310-test-alldeps-numpy121' | |
- name: 'macos-py39' | |
os: macos-latest | |
python: '3.9' | |
tox_env: 'py39-test-alldeps' | |
- name: 'windows-py310' | |
os: windows-latest | |
python: '3.10' | |
tox_env: 'py310-test-alldeps' | |
- name: 'windows-py39' | |
os: windows-latest | |
python: '3.9' | |
tox_env: 'py39-test-alldeps' | |
- name: 'windows-py38' | |
os: windows-latest | |
python: '3.8' | |
tox_env: 'py38-test-alldeps' | |
- name: 'ubuntu-codestyle' | |
os: ubuntu-latest | |
python: '3.8' | |
tox_env: 'py38-test-alldeps' | |
- name: 'ubuntu-py310-test-alldeps-devdeps' | |
os: ubuntu-latest | |
python: '3.10' | |
tox_env: 'py310-test-alldeps-devdeps' | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install base dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox wheel | |
- name: Install graphviz dependency | |
if: "endsWith(matrix.tox_env, 'build_docs')" | |
run: sudo apt-get -y install graphviz | |
- name: Print Python, pip, setuptools, and tox versions | |
run: | | |
python -c "import sys; print(f'Python {sys.version}')" | |
python -c "import pip; print(f'pip {pip.__version__}')" | |
python -c "import setuptools; print(f'setuptools {setuptools.__version__}')" | |
python -c "import tox; print(f'tox {tox.__version__}')" | |
- name: Run tests | |
if: "! matrix.use_remote_data" | |
run: | | |
tox -e ${{ matrix.tox_env }} -- ${{ matrix.toxposargs }} | |
# run Python unit tests after testing that the project compiles in different versions | |
build: | |
strategy: | |
matrix: | |
python-version: [3.10] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Switch to Current Branch | |
run: git checkout ${{ env.BRANCH }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -e . | |
- name: Run unit tests | |
run: python -m pytest --import-mode=append tests/ | |