| 1 |
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
| 3 |
|
| 4 |
name: Python package |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [master] |
| 9 |
pull_request: |
| 10 |
branches: [master] |
| 11 |
|
| 12 |
jobs: |
| 13 |
build: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
if: "!contains(github.event.head_commit.message, 'noci')" |
| 16 |
strategy: |
| 17 |
matrix: |
| 18 |
python-version: [3.9] |
| 19 |
|
| 20 |
steps: |
| 21 |
- uses: actions/checkout@v2 |
| 22 |
- name: Set up Python ${{ matrix.python-version }} |
| 23 |
uses: actions/setup-python@v2 |
| 24 |
with: |
| 25 |
python-version: ${{ matrix.python-version }} |
| 26 |
- name: Install dependencies |
| 27 |
run: | |
| 28 |
python -m pip install --upgrade pip |
| 29 |
pip install black flake8 pytest coverage |
| 30 |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 31 |
pip install -e . |
| 32 |
- name: Lint with flake8 |
| 33 |
run: | |
| 34 |
# until we get rid of Python 3.6, this will fail |
| 35 |
# stop the build if there are Python syntax errors or undefined names |
| 36 |
flake8 apbs --count --select=E9,F63,F7,F82 --show-source --statistics |
| 37 |
# exit-zero treats all errors as warnings. |
| 38 |
flake8 apbs --count --exit-zero --statistics |
| 39 |
#echo "Skipping flake8" |
| 40 |
- name: Test with pytest and coverage |
| 41 |
run: | |
| 42 |
coverage run --source=apbs -m pytest test |
| 43 |
coverage report -m | tee coverage.txt |
| 44 |
coverage html |
| 45 |
- name: Upload coverage results |
| 46 |
run: bash <(curl -s https://codecov.io/bash) |
| 47 |
- name: Store coverage text results |
| 48 |
uses: actions/upload-artifact@v2 |
| 49 |
with: |
| 50 |
name: coverage-text |
| 51 |
path: coverage.txt |
| 52 |
- name: Store coverage HTML results |
| 53 |
uses: actions/upload-artifact@v2 |
| 54 |
with: |
| 55 |
name: coverage-html |
| 56 |
path: htmlcov/* |