-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (108 loc) · 3.8 KB
/
ci.yml
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
132
133
134
name: Buildout and QA
on:
push:
# branches: any branch for now
# - cicd
# - master
workflow_dispatch:
jobs:
buildout:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Preapre python environment
uses: ./.github/actions/setup_python_environment
- name: Cache buildout
id: cache-buildout
uses: ./.github/actions/cache_buildout
- name: Install system libraries # needed for compiling eggs
run: |
sudo apt-get install -y build-essential xsltproc libncurses5-dev zip libffi-dev libjpeg-dev libtk-img-dev libopenjp2-7-dev liblcms2-dev libfreetype6-dev libwebp-dev libtiff-dev zlib1g-dev libreadline-dev libsqlite3-dev libssl-dev libxslt1-dev libbz2-dev libldap2-dev libsasl2-dev libpcre3-dev wv poppler-utils
shell: bash
if: ${{ steps.cache-buildout.outputs.cache-hit != 'true' }}
- name: Run buildout
run: |
source venv/bin/activate
which pip
pip freeze
buildout -N -c buildout.cfg
if: ${{ steps.cache-buildout.outputs.cache-hit != 'true' }}
test:
needs: buildout
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Preapare python environment
uses: ./.github/actions/setup_python_environment
- name: Restore cache buildout
id: cache-buildout-restore
uses: ./.github/actions/cache_buildout
- name: Run tests
run: |
source venv/bin/activate
tox -e py311-test
if: ${{ steps.cache-buildout-restore.outputs.cache-hit == 'true' }}
lint:
needs: buildout
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Preapare python environment
uses: ./.github/actions/setup_python_environment
- name: Restore cache buildout
id: cache-buildout-restore
uses: ./.github/actions/cache_buildout
with:
action: restore
- name: Run linter
id: lint
run: |
source venv/bin/activate
warn="false"
tox -e py311-lint || \
echo "::warning title=Linter Warning::Your code has not passed the linter stage. Please check out the lint-report artifact"
if: ${{ steps.cache-buildout-restore.outputs.cache-hit == 'true' }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linter-report
path: reports/flake8
if: always()
coverage:
needs: test
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Preapare python environment
uses: ./.github/actions/setup_python_environment
- name: Restore cache buildout
id: cache-buildout-restore
uses: ./.github/actions/cache_buildout
with:
action: restore
- name: Run coverage report
id: report
run: |
source venv/bin/activate
bin/createcoverage
bin/coverage html
warn="false"
bin/coverage report --fail-under=75 || warn="true"
if [[ $warn == "true" ]]; then
bin/coverage report --fail-under=30
echo "::warning title=Coverage Warning::Your code has less than 75% coverage"
fi
if: ${{ steps.cache-buildout-restore.outputs.cache-hit == 'true' }}
- name: Create error annotation
run: echo "::error title=Coverage Error::Your code has less that 30% coverage"
if: failure()
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: htmlcov
if: always()