1
+ on :
2
+ push :
3
+ pull_request :
4
+ branches :
5
+ - master
6
+
7
+ jobs :
8
+ generate-wrapper :
9
+ runs-on : " ubuntu-22.04"
10
+ defaults :
11
+ run :
12
+ working-directory : ./python-wrapper
13
+ steps :
14
+ - uses : actions/checkout@v4
15
+ - name : Install dependencies
16
+ uses : awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad
17
+ with :
18
+ packages : gcc g++ swig
19
+ version : 1.0
20
+ - name : generate wrapper
21
+ run : ./generate_swig_wrapper.sh
22
+ shell : bash
23
+ - uses : actions/upload-artifact@v4
24
+ with :
25
+ name : python-sources
26
+ path : python-wrapper/sensirion_gas_index_algorithm/**
27
+ if-no-files-found : error
28
+ - uses : actions/upload-artifact@v4
29
+ with :
30
+ name : swig-sources
31
+ path : python-wrapper/swig/**
32
+ if-no-files-found : error
33
+ check_readme_rst_syntax :
34
+ runs-on : " ubuntu-22.04"
35
+ defaults :
36
+ run :
37
+ working-directory : ./python-wrapper
38
+ steps :
39
+ - uses : actions/checkout@v4
40
+ - uses : actions/setup-python@v5
41
+ with :
42
+ python-version : 3.8
43
+ - name : install rst linter
44
+ run : pip install restructuredtext-lint pygments
45
+ - name : run
46
+ run : rst-lint *.rst
47
+ build :
48
+ continue-on-error : true
49
+ strategy :
50
+ matrix :
51
+ py-version : ["3.8", "3.9"]
52
+ os : [ubuntu-22.04, windows-2019, macOS-15]
53
+ fail-fast : false
54
+ runs-on : ${{ matrix.os }}
55
+ needs : generate-wrapper
56
+ defaults :
57
+ run :
58
+ working-directory : ./python-wrapper
59
+ steps :
60
+ - uses : actions/checkout@v4
61
+ - uses : actions/download-artifact@v4
62
+ with :
63
+ name : python-sources
64
+ path : python-wrapper/sensirion_gas_index_algorithm
65
+ - uses : actions/download-artifact@v4
66
+ with :
67
+ name : swig-sources
68
+ path : python-wrapper/swig
69
+ - uses : actions/setup-python@v5
70
+ with :
71
+ python-version : ${{ matrix.py-version }}
72
+ - name : install package
73
+ run : |
74
+ pip3 install -e .[test]
75
+ pip3 install wheel
76
+ - name : static test
77
+ run : flake8
78
+ - name : unit test
79
+ run : pytest
80
+ - name : create wheel
81
+ run : python3 setup.py bdist_wheel
82
+ - uses : actions/upload-artifact@v4
83
+ with :
84
+ name : py_${{ matrix.py-version }}_${{ matrix.os}}_build
85
+ path : python-wrapper/dist/**
86
+ if-no-files-found : error
87
+ py3p8_linux_sdist :
88
+ runs-on : " ubuntu-22.04"
89
+ needs : generate-wrapper
90
+ defaults :
91
+ run :
92
+ working-directory : ./python-wrapper
93
+ steps :
94
+ - uses : actions/checkout@v4
95
+ - uses : actions/download-artifact@v4
96
+ with :
97
+ name : python-sources
98
+ path : python-wrapper/sensirion_gas_index_algorithm
99
+ - uses : actions/download-artifact@v4
100
+ with :
101
+ name : swig-sources
102
+ path : python-wrapper/swig
103
+ - uses : actions/setup-python@v5
104
+ with :
105
+ python-version : 3.8
106
+ - name : create dist package
107
+ run : python3 setup.py sdist
108
+ - uses : actions/upload-artifact@v4
109
+ with :
110
+ name : py_source_dist
111
+ path : python-wrapper/dist/**
112
+ if-no-files-found : error
113
+ build_pages :
114
+ runs-on : " ubuntu-22.04"
115
+ needs : generate-wrapper
116
+ defaults :
117
+ run :
118
+ working-directory : ./python-wrapper
119
+ steps :
120
+ - uses : actions/checkout@v4
121
+ - uses : actions/download-artifact@v4
122
+ with :
123
+ name : python-sources
124
+ path : python-wrapper/sensirion_gas_index_algorithm
125
+ - uses : actions/download-artifact@v4
126
+ with :
127
+ name : swig-sources
128
+ path : python-wrapper/swig
129
+ - uses : actions/setup-python@v5
130
+ with :
131
+ python-version : 3.8
132
+ cache : " pip"
133
+ - name : Install the project dependencies
134
+ run : |
135
+ python setup.py install
136
+ python -m pip install -r docs/requirements.txt
137
+ - name : Build documentation
138
+ run : cd ./docs && make html
139
+ - name : Upload html
140
+ uses : actions/upload-pages-artifact@v3
141
+ with :
142
+ path : python-wrapper/docs/_build/html
143
+ deploy_pages :
144
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
145
+ runs-on : " ubuntu-22.04"
146
+ needs : build_pages
147
+ permissions :
148
+ pages : write # to deploy to Pages
149
+ id-token : write # to verify the deployment originates from an appropriate source
150
+ # Deploy to the github-pages environment
151
+ environment :
152
+ name : github-pages
153
+ url : ${{ steps.deployment.outputs.page_url }}
154
+ steps :
155
+ - name : Deploy to GitHub Pages
156
+ id : deployment
157
+ uses : actions/deploy-pages@v2
158
+ with :
159
+ token : ${{ secrets.GITHUB_TOKEN }}
160
+ deploy_pypi :
161
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
162
+ runs-on : " ubuntu-22.04"
163
+ permissions :
164
+ id-token : write
165
+ needs : ["py3p8_linux_sdist", "build"]
166
+ steps :
167
+ - name : download python source dist artifacts
168
+ uses : actions/download-artifact@v4
169
+ with :
170
+ path : python-wrapper/dist
171
+ name : py_source_dist
172
+ - name : download win python build artifacts
173
+ uses : actions/download-artifact@v4
174
+ with :
175
+ path : python-wrapper/dist
176
+ merge-multiple : true
177
+ pattern : py_*windows*_build
178
+ - name : download mac build artifacts
179
+ uses : actions/download-artifact@v4
180
+ with :
181
+ path : python-wrapper/dist
182
+ merge-multiple : true
183
+ pattern : py_*macOS*_build
184
+ # pypi does not accept the linux wheels with _x86_64, thus not uploading any linux wheels
185
+ - name : Publish package distributions to PyPI
186
+ uses : pypa/gh-action-pypi-publish@release/v1
187
+ with :
188
+ password : ${{ secrets.PYPI_API_TOKEN }}
189
+ github-release :
190
+ name : Create GitHub Release and add signature for python packages
191
+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
192
+ needs :
193
+ - build
194
+ - py3p8_linux_sdist
195
+ runs-on : ubuntu-22.04
196
+ defaults :
197
+ run :
198
+ working-directory : ./python-wrapper
199
+ permissions :
200
+ contents : write
201
+ id-token : write
202
+ steps :
203
+ - uses : actions/checkout@v4
204
+ - name : download python source dist artifacts
205
+ uses : actions/download-artifact@v4
206
+ with :
207
+ path : python-wrapper/dist
208
+ merge-multiple : true
209
+ name : py_source_dist
210
+ - name : download python build artifacts
211
+ uses : actions/download-artifact@v4
212
+ with :
213
+ path : python-wrapper/dist
214
+ merge-multiple : true
215
+ pattern : py_*_build
216
+ - name : Create GitHub Release
217
+ env :
218
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
219
+ run : |
220
+ if [[ "$(gh release view '${{ github.ref_name }}' 2>&1)" == "release not found" ]]; then
221
+ gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
222
+ fi
223
+ - name : Upload artifacts to GitHub Release
224
+ env :
225
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
226
+ # Upload release artifacts before the signing, such that artifacts are still uploaded if signing fails
227
+ run : |
228
+ gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
229
+ - name : Sign the dists with Sigstore
230
+ uses : sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46
231
+ with :
232
+ inputs : >-
233
+ ./python-wrapper/dist/*.tar.gz
234
+ ./python-wrapper/dist/*.whl
235
+ - name : Upload signatures to GitHub Release
236
+ env :
237
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
238
+ # upload sigstore-produced signatures and certificates from dist
239
+ run : |
240
+ gh release upload '${{ github.ref_name }}' dist/*.sigstore.json --repo '${{ github.repository }}'
0 commit comments