-
Notifications
You must be signed in to change notification settings - Fork 0
294 lines (282 loc) · 11.6 KB
/
unittest_pytest_coverage_doc.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# https://docs.github.com/en/actions/learn-github-actions/introduction-to-github-actions
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# todo:
# https://docs.github.com/en/actions/guides/building-and-testing-python
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
name: unittest_pytest_coverage_doc
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
pep8_check:
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: apt-get update
run: sudo apt-get update
- name: install dependencies for PEP 8 code style check (ubuntu packages)
run: sudo apt-get install pep8 pylint3 python3-recommonmark python3-pytest python3-netcdf4
- name: install dependencies (cfchecker via pip)
run: pip3 install cfchecker
- name: check PEP 8 code style
run: pep8 --show-source --show-pep8 --statistics $(find -name "*.py")
- name: run pylint
run: pylint -j 3 --include-naming-hint=y --good-names=i,j,k,fd $(find -name "*.py")
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# https://github.com/marketplace/actions/checkout
- uses: actions/setup-python@v2
# https://github.com/marketplace/actions/setup-python
- uses: pre-commit/[email protected]
# https://github.com/pre-commit/action
ubuntu-1804_test_doc:
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
# drop support for ubuntu-18.04
continue-on-error: true
runs-on: ubuntu-18.04
needs: [pep8_check, pre-commit]
steps:
- uses: actions/checkout@v2
- name: check environment
run: lsb_release -a
- name: check python version
run: env python3 -V
- name: apt-get update
run: sudo apt-get update
- name: install dependencies (ubuntu packages)
run: sudo apt-get install libudunits2-0 python3-jsonschema python3-netcdf4 python3-pip python3-setuptools python3-wheel
- name: fix for installing cfchecker
# due to https://github.com/Unidata/cftime/issues/261 we need:
run: |
sudo apt-get install gcc python3-cryptography python3-dev python3-pip python3-setuptools python3-wheel
pip3 install 'cython>0.26.1' 'numpy>1.13.3'
- name: install dependencies (cfchecker via pip)
run: pip3 install cfchecker
- name: check all modules available
run: env python3 setup.py check_modules
- name: install pydabu
run: pip3 install .
- name: run pydabu
run: |
which pydabu
pydabu
- name: run json_schema_from_schema_org
run: |
which json_schema_from_schema_org
json_schema_from_schema_org -h
- name: unittest
run: env python3 setup.py run_unittest
- name: install dependencies for pytest (ubuntu packages)
run: sudo apt-get install python3-pytest python3-pytest-cov python3-pytest-xdist
- name: pytest
run: env python3 setup.py run_pytest --parallel --coverage
- name: install dependencies for documentation (ubuntu packages)
run: sudo apt-get install python3-sphinx python3-sphinx-argparse python3-recommonmark latexmk texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra
- name: install dependencies for documentation (sphinx-jsonschema via pip)
run: pip3 install sphinx-jsonschema
- name: build doc
run: ./create_doc
ubuntu-2004_test_doc:
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
# runs-on: ubuntu-latest
runs-on: ubuntu-20.04
needs: [pep8_check, pre-commit]
steps:
- uses: actions/checkout@v2
- name: check environment
run: lsb_release -a
- name: check python version
run: env python3 -V
- name: apt-get update
run: sudo apt-get update
- name: install dependencies (ubuntu packages)
run: sudo apt-get install python3-setuptools python3-wheel python3-jsonschema python3-netcdf4 libudunits2-0
- name: install dependencies (cfchecker via pip)
run: pip3 install cfchecker
- name: check all modules available
run: env python3 setup.py check_modules
- name: install pydabu
run: pip3 install .
- name: run pydabu
run: |
which pydabu
pydabu
- name: run json_schema_from_schema_org
run: |
which json_schema_from_schema_org
json_schema_from_schema_org -h
- name: unittest
run: env python3 setup.py run_unittest
- name: install dependencies for pytest (ubuntu packages)
run: sudo apt-get install python3-pytest python3-pytest-cov python3-pytest-xdist
- name: pytest
run: env python3 setup.py run_pytest --parallel --coverage
- name: install dependencies for documentation (ubuntu packages)
run: sudo apt-get install python3-sphinx python3-sphinx-argparse python3-recommonmark latexmk texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra
- name: install dependencies for documentation (sphinx-jsonschema via pip)
run: pip3 install sphinx-jsonschema
- name: build doc
run: ./create_doc
i386_debian_latest_test:
# https://github.com/daniel-mohr/i386_debian_latest
runs-on: ubuntu-latest
needs: [pep8_check, pre-commit]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run my script in docker image
uses: daniel-mohr/i386_debian_latest@v0
with:
cmdfile: tests/docker_test_scripts/do_test_i386-debian-latest
amd64_opensuse_leap_153_test:
# https://github.com/daniel-mohr/amd64_opensuse_leap_15.3
runs-on: ubuntu-latest
needs: [pep8_check, pre-commit]
name: opensuse leap 15.3
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run my script in docker image
uses: daniel-mohr/amd64_opensuse_leap_15.3@v0
with:
cmdfile: tests/docker_test_scripts/do_test_opensuse_leap-15.3
macos_test:
# run tests on windows systems using conda-forge
strategy:
matrix:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md
os: [macos-10.15, macos-11]
runs-on: ${{ matrix.os }}
needs: [pep8_check, pre-commit]
steps:
- uses: actions/checkout@v2
#- name: search packages (via Homebrew)
# run: brew search udunits
- name: install dependencies (via Homebrew)
run: brew install udunits
- name: install dependencies via pip3
run: pip3 install wheel jsonschema netCDF4 pytest pytest-cov pytest-xdist cfchecker
#- name: install dependencies for documentation via pip3
# run: pip3 install Sphinx sphinx-argparse recommonmark sphinx-jsonschema
- name: check all modules available
run: env python3 setup.py check_modules
- name: install pydabu
run: pip3 install .
- name: run pydabu
run: |
which pydabu
pydabu
- name: run json_schema_from_schema_org
run: |
which json_schema_from_schema_org
json_schema_from_schema_org -h
- name: unittest
run: env python3 setup.py run_unittest
- name: pytest
run: env python3 setup.py run_pytest --parallel --coverage
windows_test:
# run tests on windows systems using conda-forge
strategy:
matrix:
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
os: [windows-2019]
deprecated: [false]
beta: [false]
include:
- os: windows-2016
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2016-Readme.md
# https://github.com/actions/virtual-environments/issues/4312
deprecated: true
beta: false
- os: windows-2022
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md
deprecated: false
beta: true
continue-on-error: ${{ matrix.deprecated || matrix.beta }}
runs-on: ${{ matrix.os }}
needs: [pep8_check, pre-commit]
steps:
- uses: actions/checkout@v2
- name: check python version
run: python -V
# use conda to install python, cfchecker and udunits
# https://anaconda.org/conda-forge/python
# https://anaconda.org/conda-forge/cfchecker
# https://anaconda.org/conda-forge/udunits
- name: conda init powershell
run: |
&($env:CONDA + "\Scripts\conda") init powershell
- name: install dependencies via conda
run: conda install -c conda-forge python jsonschema netcdf4 cfchecker pytest pytest-cov pytest-xdist
# sphinx sphinx-argparse recommonmark latexmk ...
- name: set conda environment for cfunits
run: conda env config vars set UDUNITS2_XML_PATH=$env:CONDA"\Library\share\udunits\udunits2.xml"
- name: check python and pip version (from conda)
run: |
Get-Command python
python -V
Get-Command pip
pip -V
- name: check all modules available
run: python setup.py check_modules
- name: install pydabu
run: pip install --verbose .
- name: run pydabu
run: |
Get-Command pydabu
pydabu
- name: run json_schema_from_schema_org
run: |
Get-Command json_schema_from_schema_org
json_schema_from_schema_org -h
- name: unittest
run: python setup.py run_unittest
- name: pytest
run: python setup.py run_pytest --parallel --coverage
deploy_pages_create_source_distribution:
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
runs-on: ubuntu-latest
needs: [ubuntu-1804_test_doc, ubuntu-2004_test_doc, i386_debian_latest_test, amd64_opensuse_leap_153_test, macos_test, windows_test]
steps:
- uses: actions/checkout@v2
- name: apt-get update
run: sudo apt-get update
- name: install dependencies (ubuntu packages)
run: sudo apt-get install python3-setuptools python3-wheel python3-jsonschema python3-netcdf4 libudunits2-0 python3-sphinx python3-sphinx-argparse python3-recommonmark latexmk texlive-latex-recommended texlive-fonts-recommended texlive-latex-extra python3-pytest python3-pytest-cov python3-pytest-xdist
- name: install dependencies (cfchecker and sphinx-jsonschema via pip)
run: pip3 install cfchecker sphinx-jsonschema
- name: check all modules available
run: env python3 setup.py check_modules
- name: install pydabu
run: pip3 install .
- name: pytest
run: env python3 setup.py run_pytest --parallel --coverage
- name: build doc
run: ./create_doc
- name: deploy pages
if: ${{ github.event_name == 'push' }}
uses: JamesIves/[email protected]
with:
branch: documentation
folder: manual_pydabu_html
- name: tag commit with latest
if: ${{ github.event.pull_request.merged }}
uses: EndBug/latest-tag@latest
- name: create source distribution
run: env python3 setup.py sdist --formats=gztar,zip
- name: create version environment variable
run: echo "pydabu_version=$(env python3 setup.py --version)" >> $GITHUB_ENV
- name: create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.pydabu_version }}"
prerelease: true
files: dist/pydabu-*