Format #260
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: Python application | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: AMS Tests | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.9, 3.10, 3.11, 3.12] | |
runs-on: ubuntu-latest | |
if: ${{ github.ref != 'refs/heads/misc' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: 3.11 | |
mamba-version: "*" | |
miniforge-version: "latest" | |
channels: conda-forge,defaults | |
channel-priority: true | |
activate-environment: anaconda-client-env | |
- shell: bash -el {0} | |
name: Install dependencies | |
run: | | |
mamba install -y nbmake pytest-xdist line_profiler # add'l packages for notebook tests. | |
mamba install --file requirements.txt --file requirements-extra.txt | |
python -m pip install -e . | |
- name: Lint with flake8 for pull requests | |
if: github.event_name == 'pull_request' | |
run: | | |
pip install flake8 # specify flake8 to avoid unknown error | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . | |
- shell: bash -el {0} | |
name: Test notebooks. | |
run: | | |
pytest --nbmake examples --ignore=examples/demonstration | |
- name: Build a distribution if tagged | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
run: | | |
python setup.py sdist | |
- name: Publish a Python distribution to PyPI if tagged | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |