Python package #419
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- release/** | |
pull_request: | |
branches: | |
- main | |
- master | |
- release/** | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup conda | |
uses: s-weigand/setup-conda@v1 | |
with: | |
update-conda: true | |
python-version: ${{ matrix.python-version }} | |
conda-channels: anaconda, conda-forge | |
- name: Install dependencies | |
run: | | |
conda install pip setuptools | |
conda install --file requirements.txt | |
conda install --file test_requirements.txt | |
pre-commit install | |
- name: Install gwpopulation | |
run: | | |
pip install . | |
- name: List installed | |
run: | | |
conda list | |
- name: Run pre-commit checks | |
run: | | |
pre-commit run --all-files --verbose --show-diff-on-failure | |
jupyter nbconvert --clear-output --inplace examples/*.ipynb | |
git reset --hard | |
- name: Test with pytest | |
run: | | |
pytest --cov gwpopulation -ra --color yes --cov-report=xml --junitxml=pytest.xml | |
- name: Publish coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.xml | |
flags: python${{ matrix.python-version }} | |
- name: Coverage report | |
run: python -m coverage report --show-missing | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-${{ matrix.python-version }} | |
path: pytest.xml |