forked from cnr-isti-vclab/PyMeshLab
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (240 loc) · 8.21 KB
/
CreateAndTestRelease.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
name: CreateAndTestRelease
on:
workflow_dispatch:
inputs:
version:
description: 'New PyMeshLab Version'
required: true
default: 'YYYY.MM'
env:
QT_VERSION: 5.15.2
jobs:
update_version:
name: Update Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update PYML_VERSION
run: |
echo ${{ github.event.inputs.version }} | tr -d '\n'> PYML_VERSION
- name: Commit change
uses: stefanzweifel/[email protected]
with:
commit_message: Update PYML_VERSION to ${{ github.event.inputs.version }}
# first, we build PyMeshLab
build_pymeshlab:
name: Build PyMeshLab
runs-on: ${{ matrix.os }}
needs: update_version
strategy:
matrix:
os: [ubuntu-18.04]
pyversion: [3.6, 3.7, 3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
with:
ref: main
submodules: recursive
- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Cache Qt
id: cache-qt
uses: actions/cache@v1
with:
path: ../Qt
key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }}
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: ${{ env.QT_VERSION }}
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyversion }}
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y mesa-common-dev libglu1-mesa-dev libgmp-dev libcgal-dev libboost-all-dev
#needed by qt 5.15 on linux
sudo apt-get install libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-xinerama0-dev
- name: Install MacOS dependencies
if: runner.os == 'macOS'
run: |
brew install libomp cgal xerces-c
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
echo "name=VCINSTALLDIR::C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC" >> $GITHUB_ENV
$env:PATH = "${{ env.PATH }};C:\msys64\mingw64\bin;C:\msys64\usr\bin"
pacman.exe -S --noconfirm --noprogressbar wget unzip
- name: Environment variables
id: envs
shell: bash
run: |
cd src/meshlab
echo ::set-output name=meshlab_commit::$(git rev-parse --short HEAD)
- name: Download external libraries
if: runner.os == 'Windows'
shell: C:\shells\msys2bash.cmd {0}
run: |
bash src/meshlab/scripts/${{ runner.os }}/0_download_ext.sh
- name: Build PyMeshLab ${{ matrix.pyversion }}
shell: bash
run: |
sh scripts/${{ runner.os }}/1_build.sh
- name: Deploy PyMeshLab ${{ matrix.pyversion }}
shell: bash
run: |
sh scripts/${{ runner.os }}/2_deploy.sh -qt=${{ env.Qt5_DIR }}
- name: Build Wheel
shell: bash
run: |
pip install wheel
pip wheel . -w wheels/
- name: Upload PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }}
uses: actions/upload-artifact@v2
with:
name: PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }}
path: pymeshlab
- name: Upload wheel ${{ runner.os }} python ${{ matrix.pyversion }}
uses: actions/upload-artifact@v2
with:
name: pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }}
path: wheels/pymeshlab*.whl
# we test the zip package ...
package_test:
name: Test PyMeshLab
runs-on: ${{ matrix.os }}
needs: build_pymeshlab
strategy:
matrix:
os: [ubuntu-latest]
pyversion: [3.6, 3.7, 3.8, 3.9, "3.10"]
steps:
- name: Download PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v2
with:
name: PyMeshLab_${{ runner.os }}_python${{ matrix.pyversion }}
path: pymeshlab/
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyversion }}
- name: Run Tests ${{ matrix.pyversion }}
if: runner.os == 'macOS'
run: |
pip3 install pytest numpy
pytest --pyargs pymeshlab
- name: Run Tests ${{ matrix.pyversion }}
if: runner.os != 'macOS'
run: |
pip3 install pytest numpy
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows
pytest --pyargs pymeshlab -m "not glcontext"
# ... and the wheel
wheel_test:
name: Test Wheel
needs: build_pymeshlab
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
pyversion: [3.6, 3.7, 3.8, 3.9, "3.10"]
steps:
- name: Download pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v2
with:
name: pymeshlab_whl_${{ runner.os }}_python${{ matrix.pyversion }}
path: .
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyversion }}
- name: Install and Test Wheel
if: runner.os == 'macOS'
shell: bash
run: |
pip install pytest
pip install pymeshlab*.whl
pytest --pyargs pymeshlab
- name: Install and Test Wheel
if: runner.os != 'macOS'
shell: bash
run: |
pip install pytest
pip install pymeshlab*.whl
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows
pytest --pyargs pymeshlab -m "not glcontext"
# after building and testing PyMeshLab for the three platforms, we create a release in github
create_release:
name: Create Release
needs: [package_test, wheel_test]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Publish Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: 'PyMeshLab v${{ github.event.inputs.version }}'
draft: false
prerelease: false
# then, we will upload all the artifacts to the release
upload_release:
name: Upload Release
needs: [create_release]
runs-on: ubuntu-latest
strategy:
matrix:
os: [Linux]
pyversion: [3.6, 3.7, 3.8, 3.9, "3.10"]
steps:
#download zip package
- name: Download PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v1
with:
name: PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}
path: pymeshlab/
- name: Create PyMeshLab Archive
run: |
cd pymeshlab
zip -r ../PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}.zip *
#upload zip package
- name: Upload PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}.zip
asset_name: PyMeshLab_${{ matrix.os }}_python${{ matrix.pyversion }}.zip
asset_content_type: PyMeshLab ${{ matrix.pyversion }}
#download wheel
- name: Download pymeshlab_whl_${{ matrix.os }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v2
with:
name: pymeshlab_whl_${{ matrix.os }}_python${{ matrix.pyversion }}
path: .
- name: Get Wheel Name
id: wheel_name
shell: bash
run: |
NAME=$(ls -d pymeshlab*.whl)
echo ::set-output name=wname::$(ls -d pymeshlab*.whl)
#upload wheel
- name: Upload Wheel to Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.create_release.outputs.upload_url}}
asset_path: ${{steps.wheel_name.outputs.wname}}
asset_name: ${{steps.wheel_name.outputs.wname}}
asset_content_type: PyMeshLab ${{ matrix.pyversion }}