Template update: from poetry to conda+pip #3
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 package | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
defaults: | |
run: | |
shell: bash | |
env: | |
LANG: en_US.utf-8 | |
LC_ALL: en_US.utf-8 | |
PYTHONIOENCODING: UTF-8 | |
PYTHON_VERSIONS: "" | |
jobs: | |
quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch all tags | |
run: git fetch --depth=1 --tags | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Python info | |
shell: bash -e {0} | |
run: | | |
which python | |
python --version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools build | |
python -m pip install flake8 pytest | |
python -m pip install . | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 src/autoden tests examples --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 src/autoden tests examples --count --exit-zero --max-complexity=15 --max-line-length=127 --statistics | |
tests: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
# - windows-latest | |
# - macos-latest | |
python-version: [ "3.10", "3.11", "3.12" ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools build | |
python -m pip install flake8 pytest | |
python -m pip install . | |
- name: Test with pytest | |
run: | | |
pytest tests/ | |
- name: Verify that we can build the package | |
run: | | |
python -m build |