Skip to content

Commit d6726ef

Browse files
authored
chore: run tests on pr, also include code coverage check (#10)
1 parent 2dac115 commit d6726ef

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

.coverage

76 KB
Binary file not shown.

.github/workflows/build-and-test.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: Build and Test
22

33
on:
4-
push:
5-
branches: [ main ]
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
branches: [ main, dev ]
67

78
jobs:
8-
build-n-publish:
9-
name: Build and publish Python distribution
9+
build-and-test:
10+
name: Build and test Python distribution
1011
runs-on: ubuntu-latest
1112
strategy:
1213
fail-fast: false
@@ -21,12 +22,15 @@ jobs:
2122
- name: Install dependencies
2223
run: |
2324
python -m pip install --upgrade pip
24-
pip install flake8 timestring typing
25+
pip install flake8
26+
pip install -r requirements.txt
2527
- name: Lint with flake8
2628
run: |
2729
# stop the build if there are Python syntax errors or undefined names
2830
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2931
# exit-zero treats all errors as warnings.
3032
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3133
- name: Run tests
32-
run: python -m unittest
34+
run: |
35+
coverage run -m unittest discover
36+
coverage report --fail-under=95

.github/workflows/publish.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Publish
22

33
on:
4-
workflow_run:
5-
workflows: ["Build and Test"]
6-
types:
7-
- completed
4+
push:
5+
branches: [ main ]
86

97
jobs:
108
publish:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ timestring==1.6.4
1010
typed-ast==1.4.3
1111
typing==3.7.4.3
1212
typing-extensions==3.7.4.3
13+
coverage==6.3.2

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
MAJOR = 0
77
MINOR = 14
8-
PATCH = 0
8+
PATCH = 1
99

1010
VERSION = '{}.{}.{}'.format(MAJOR, MINOR, PATCH)
1111
DESCRIPTION = 'String validation and sanitization'

0 commit comments

Comments
 (0)