Skip to content

Python package

Python package #23

# 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.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
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@v1.2.1
with:
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@v2
with:
name: pytest-${{ matrix.python-version }}
path: pytest.xml