Skip to content

Commit 6ddd0e1

Browse files
authored
Split jobs into GH workflows (#59)
* 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.
1 parent b782d4e commit 6ddd0e1

File tree

7 files changed

+92
-75
lines changed

7 files changed

+92
-75
lines changed

.github/workflows/black.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Black code style
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
black-code-style:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: "3.10"
20+
21+
- name: Install
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install black==21.10b0
25+
26+
- name: Run Black
27+
run: |
28+
black --check --diff .

.github/workflows/ci.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/conda.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Conda
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
pull_request:
88

99
jobs:
@@ -33,5 +33,5 @@ jobs:
3333
- name: Run pytest
3434
shell: bash -l {0}
3535
run: |
36-
conda install pytest
37-
pytest tests
36+
conda install pytest
37+
pytest tests

.github/workflows/flake8.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Flake8
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
linting-flake8:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: "3.10"
19+
- name: Lint with Flake8
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install flake8
23+
flake8 --count --statistics --show-source --jobs=$(nproc) .

.github/workflows/pipenv.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: pipenv
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
pull_request:
88

99
jobs:
10-
1110
pipenv-dev:
1211
runs-on: ubuntu-20.04
1312

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: pytest
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
# The coverage needs more work, but the tests are running.
11+
pytest-coverage:
12+
runs-on: ubuntu-20.04
13+
14+
strategy:
15+
matrix:
16+
python-version:
17+
- "3.7"
18+
- "3.8"
19+
- "3.9"
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install the package
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install .
31+
- name: Test with pytest
32+
run: |
33+
pip install pytest
34+
pip install pytest-cov
35+
pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
![CI](https://github.com/ncsu-landscape-dynamics/Pandemic_Model/workflows/CI/badge.svg)
1+
[![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)
2+
[![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)
23
[![Code style:
34
black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
45

0 commit comments

Comments
 (0)