Tests #519
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: Tests | |
on: | |
schedule: | |
# run every Sunday at 10:13 am UTC (3:13 am PT) | |
- cron: '13 10 * * 0' | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
base-tests: | |
name: py${{ matrix.python }} ${{ matrix.name-modifier }} - on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# mark default | |
- python: '3.9' | |
os: ubuntu-latest | |
do-coverage: false | |
name-modifier: '' | |
# mark case for coverage reporting | |
- python: '3.10' | |
os: ubuntu-latest | |
do-coverage: true | |
name-modifier: 'with Coverage' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install 'bapsflib' dependencies | |
run: | | |
python -m pip install pip --upgrade | |
python -m pip install -r requirements/tests.txt --upgrade | |
- name: Run tests ${{ matrix.name-modifier }} | |
run: | | |
if ${{ matrix.do-coverage }}; then | |
coverage run -m unittest discover | |
else | |
python -m unittest discover | |
fi | |
shell: bash | |
- name: Report coverage | |
if: ${{ matrix.do-coverage && !failure() }} | |
uses: codecov/codecov-action@v4 | |
with: | |
files: .coverage | |
fail_ci_if_error: false | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
tests: | |
needs: base-tests | |
name: py${{ matrix.python }} - on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ['3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
exclude: | |
# these were done in base-tests | |
- python: '3.10' | |
os: ubuntu-latest | |
- python: '3.9' | |
os: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install 'bapsflib' dependencies | |
run: | | |
python -m pip install pip --upgrade | |
python -m pip install -r requirements/tests.txt --upgrade | |
- name: Run tests | |
run: | | |
python -m unittest discover | |
shell: bash | |
test-mins: | |
# test min versions of key dependencies | |
needs: tests | |
name: Min Vers | py-${{ matrix.python }} | ${{ matrix.spec-name }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- spec-name: h5py v3.0 | |
min-install: h5py==3.0 | |
python: '3.9' | |
- spec-name: h5py v3.0 numpy v1.20 | |
min-install: h5py==3.0 numpy==1.20 | |
python: '3.9' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install 'bapsflib' dependencies | |
run: | | |
python -m pip install pip --upgrade | |
python -m pip install -r requirements/tests.txt ${{ matrix.min-install }} | |
- name: Run tests | |
run: python -m unittest discover | |
import-bapsflib: | |
name: Importing bapsflib | |
needs: base-tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install 'bapsflib' dependencies | |
run: | | |
python -m pip install pip --upgrade | |
python -m pip install -r requirements/install.txt | |
- name: Import 'bapsflib' | |
run: | | |
python -c 'import bapsflib' | |
build-bapsflib: | |
name: Packaging | |
runs-on: ubuntu-latest | |
needs: | |
- test-mins | |
- import-bapsflib | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get history and tags for SCM versioning to work | |
run: | | |
git fetch --prune --unshallow | |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install requirements | |
run: | | |
pip install --progress-bar off --upgrade pip | |
pip install --progress-bar off -r requirements/install.txt | |
pip install --progress-bar off twine importlib_metadata!=8.0.0 | |
- name: Build a binary wheel | |
run: | | |
python setup.py bdist_wheel | |
- name: Build a source tarball | |
run: | | |
python setup.py sdist | |
- name: Twine check | |
run: | | |
twine check dist/* | |
- name: Install bapsflib in all variants | |
run: | | |
pip install --progress-bar off .[developer] | |
pip install --progress-bar off -e .[developer] | |
python setup.py develop |