Skip to content

Commit a7837c9

Browse files
author
Gonzalo Diaz
committed

File tree

5 files changed

+93
-5
lines changed

5 files changed

+93
-5
lines changed

.github/workflows/python.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Python
2+
3+
on:
4+
push:
5+
branches: [ "main", "feature/*" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
LOG_LEVEL: WARN
11+
12+
jobs:
13+
14+
build:
15+
name: "Run CI"
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [
20+
"windows-latest",
21+
"ubuntu-latest",
22+
"macOS-latest"
23+
]
24+
python: ["3.10"]
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Setup Python
30+
uses: actions/setup-python@master
31+
with:
32+
python-version: ${{ matrix.python }}
33+
34+
- name: Install
35+
run: pip3 install --upgrade -r requirements.txt
36+
37+
- name: Test
38+
run: |
39+
python3 -m coverage run -m unittest discover -s src -p '*_test.py' --verbose
40+
41+
- name: Coverage
42+
run: |
43+
python3 -m coverage report
44+
45+
- name: Upload coverage reports to Codecov with GitHub Action
46+
uses: codecov/codecov-action@v3

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,27 @@ list:
99
dependencies:
1010
pip3 install -r requirements.txt
1111

12-
# upgrade:
13-
# pip3 install --upgrade -r requirements.txt
12+
update:
13+
pip3 freeze > requirements.txt
14+
15+
upgrade:
16+
pip3 install --upgrade -r requirements.txt
1417

1518
test: dependencies
1619
python3 -m unittest discover -s src -p '*_test.py'
1720

21+
coverage: test
22+
python3 -m coverage run -m unittest discover -s src -p '*_test.py' --verbose
23+
python3 -m coverage report
24+
25+
coverage/html: coverage
26+
python3 -m coverage html
27+
1828
clean:
1929
pip3 freeze > unins ; pip3 uninstall -y -r unins ; rm unins
30+
rm -fr .pytest_cache
31+
rm -fr htmlcov
32+
rm -fr src/__pycache__
33+
rm .coverage
2034

2135
all: test coverage

compose.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
projecteuler-py:
3+
image: projecteuler-py:latest
4+
build:
5+
context: .
6+
target: testing
7+
environment:
8+
_DEBUG: ${_DEBUG}
9+
volumes:
10+
- ./coverage:/app/coverage
11+
profiles: ["testing"]
12+
13+
projecteuler-py-dev:
14+
image: projecteuler-py:dev
15+
build:
16+
context: .
17+
target: development
18+
environment:
19+
_DEBUG: ${_DEBUG}
20+
volumes:
21+
- ./:/app
22+
profiles: ["development"]

requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
attrs==22.1.0
2+
coverage==6.4.4
3+
iniconfig==1.1.1
4+
packaging==21.3
5+
pluggy==1.0.0
6+
py==1.11.0
7+
pyparsing==3.0.9
8+
pytest==7.1.2
9+
tomli==2.0.1

src/main_test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ def test_split(self):
1515
# check that s.split fails when the separator is not a string
1616
with self.assertRaises(TypeError):
1717
s.split(2)
18-
19-
if __name__ == '__main__':
20-
unittest.main()

0 commit comments

Comments
 (0)