Skip to content

Commit

Permalink
Split jobs into GH workflows (#59)
Browse files Browse the repository at this point in the history
* Split unrelated jobs into separate workflow files (Flake8, Black, pytest).
* Link Flake8 and conda in readme.
* Workflows and badges need full URL to link to actions instead of the source code (there is an implicit blob/main for relative URLs).
* Run prettier on all workflow files.

Fixes #21.
  • Loading branch information
wenzeslaus authored Jan 24, 2022
1 parent b782d4e commit 6ddd0e1
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 75 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Black code style

on:
push:
branches:
- main
pull_request:

jobs:
black-code-style:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install
run: |
python -m pip install --upgrade pip
pip install black==21.10b0
- name: Run Black
run: |
black --check --diff .
69 changes: 0 additions & 69 deletions .github/workflows/ci.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Conda
on:
push:
branches:
- main
- main
pull_request:

jobs:
Expand Down Expand Up @@ -33,5 +33,5 @@ jobs:
- name: Run pytest
shell: bash -l {0}
run: |
conda install pytest
pytest tests
conda install pytest
pytest tests
23 changes: 23 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Flake8

on:
push:
branches:
- main
pull_request:

jobs:
linting-flake8:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.10"
- name: Lint with Flake8
run: |
python -m pip install --upgrade pip
pip install flake8
flake8 --count --statistics --show-source --jobs=$(nproc) .
3 changes: 1 addition & 2 deletions .github/workflows/pipenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: pipenv
on:
push:
branches:
- main
- main
pull_request:

jobs:

pipenv-dev:
runs-on: ubuntu-20.04

Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: pytest

on:
push:
branches:
- main
pull_request:

jobs:
# The coverage needs more work, but the tests are running.
pytest-coverage:
runs-on: ubuntu-20.04

strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install the package
run: |
python -m pip install --upgrade pip
pip install .
- name: Test with pytest
run: |
pip install pytest
pip install pytest-cov
pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![CI](https://github.com/ncsu-landscape-dynamics/Pandemic_Model/workflows/CI/badge.svg)
[![Flake8](https://github.com/ncsu-landscape-dynamics/PoPS-Global/actions/workflows/flake8.yml/badge.svg)](https://github.com/ncsu-landscape-dynamics/PoPS-Global/actions/workflows/flake8.yml)
[![Conda Install](https://github.com/ncsu-landscape-dynamics/PoPS-Global/actions/workflows/conda.yml/badge.svg)](https://github.com/ncsu-landscape-dynamics/PoPS-Global/actions/workflows/conda.yml)
[![Code style:
black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Expand Down

0 comments on commit 6ddd0e1

Please sign in to comment.