Skip to content

Commit 8372d65

Browse files
committed
Split workflows to different .yaml files, configured unit-test to be run only when linting return with success status, added setup.cfg for flake8 configuration
1 parent 5ce29e4 commit 8372d65

3 files changed

Lines changed: 44 additions & 8 deletions

File tree

.github/workflows/linting.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Linting Linux
2+
3+
on:
4+
# push:
5+
pull_request:
6+
7+
jobs:
8+
run-tests:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest]
13+
python-version:
14+
- "3.11"
15+
16+
name: linting
17+
runs-on: ${{ matrix.os }}
18+
# runs-on: python:alpine
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version : ${{ matrix.python-version }}
28+
29+
- name: Install flake8
30+
run: |
31+
python -m pip install flake8
32+
33+
- name: Check format without making corrections
34+
run: |
35+
flake8

.github/workflows/unit-test.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Unit Test Linux
22

33
on:
4-
# push:
5-
pull_request:
4+
workflow_run:
5+
workflows: [Linting Linux]
6+
types:
7+
- completed
68

79
jobs:
810
run-tests:
@@ -15,7 +17,7 @@ jobs:
1517

1618
name: unit-test
1719
runs-on: ${{ matrix.os }}
18-
# runs-on: python:alpine
20+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1921

2022
steps:
2123
- name: Checkout code
@@ -33,12 +35,7 @@ jobs:
3335
- name: Check if installed packages confirm with requirements.txt
3436
run: |
3537
pip freeze -r requirements.txt
36-
37-
- name: Check format without making corrections
38-
run: |
39-
flake8 funcs/*.py
4038
4139
- name: Run tests
4240
run: |
4341
python -m unittest discover -v
44-

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
exclude =
4+
./venv/

0 commit comments

Comments
 (0)