-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (113 loc) · 4.33 KB
/
Copy pathpython-app-ubuntu.yml
File metadata and controls
131 lines (113 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Adapted from: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Lint and Test on Ubuntu
run-name: ${{ github.actor }} is testing out DDT on Ubuntu (latest)
on: #[push]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
test-ubuntu:
defaults:
run:
shell: bash
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
# set PATH=%PATH%;C:/Users/runneradmin/.local/bin/poetry
poetry --version
poetry install --no-interaction --no-root
- name: Install library
run: poetry install --no-interaction
- run: |
source $VENV
pytest --version
- name: Lint with pylint
continue-on-error: true
run: |
set +e
# stop the build if there are Python syntax errors or undefined names
poetry run pylint src/unit_test_generator.py
PYLINT_RESULT=$?
if [ $PYLINT_RESULT -ne 0 ]; then
echo "::notice::Pylint recommends changes." && exit $PYLINT_RESULT
fi
- name: Typecheck with mypy
continue-on-error: true
run: |
set +e
cd src
poetry run mypy --version
poetry run mypy unit_test_generator.py
MYPY_RESULT=$?
if [ $MYPY_RESULT -ne 0 ]; then
echo "::notice::mypy found errors." && exit $MYPY_RESULT
fi
- name: pytest procedural_division
# continue-on-error: true
run: |
cd tests/procedural_division
poetry run python divide_ints.py
#poetry run pytest -s -v . #--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest fizzbuzz
# continue-on-error: true
run: |
cd tests/fizzbuzz
poetry run python fizzbuzz.py
poetry run pytest -s -v . #--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest all_types
# continue-on-error: true
run: |
cd tests/all_types
poetry run python all_types.py
#poetry run pytest -s -v . #--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest oo_car
# continue-on-error: true
run: |
cd tests/oo_car
poetry run python car.py
poetry run coverage run -m pytest -s -v . #--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest pass_by_assignment
# continue-on-error: true
run: |
cd tests/pass_by_assignment
poetry run python pass_by_assignment.py
#poetry run pytest -s -v . #--doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
- name: pytest helper functions
# continue-on-error: true
run: |
cd src
poetry run coverage run -m pytest --log-level=DEBUG -s -v .
- name: pytest coverage badge
run: |
ls -lah
ls -lah tests/fizzbuzz
ls -lah tests/oo_car
ls -lah tests/all_types
ls -lah tests/procedural_division
ls -lah tests/pass_by_assignment
poetry add coverage-badge
poetry run coverage combine tests/fizzbuzz/.coverage tests/oo_car/.coverage tests/all_types/.coverage tests/pass_by_assignment/.coverage tests/procedural_division/.coverage src/.coverage
ls -lah
#poetry run coverage run -m pytest .
poetry run coverage report -m --omit="*/test_*"
poetry run coverage-badge -o coverage.svg