-
Notifications
You must be signed in to change notification settings - Fork 69
251 lines (242 loc) · 8.24 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
249
250
251
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@v4
- name: Update PYML_VERSION
run: |
echo ${{ github.event.inputs.version }} | tr -d '\n'> PYML_VERSION
- name: Commit change
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Set PyMeshLab version to ${{ github.event.inputs.version }}
# first, we build PyMeshLab
build_pymeshlab:
name: Build PyMeshLab
runs-on: ${{ matrix.os }}
needs: update_version
strategy:
matrix:
pyversion: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: ['ubuntu-20.04', 'macos-13', 'macos-latest', 'windows-latest']
exclude:
- os: macos-latest
pyversion: '3.9'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
ref: main
- name: Setup env variables
id: envs
shell: bash
run: |
echo "name=VCINSTALLDIR::C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC" >> $GITHUB_ENV
ARCH=$(uname -m)
echo "arch=$ARCH" >> $GITHUB_OUTPUT
if [ "${{matrix.os}}" != "macos-latest" ]; then
echo "build_options=--ccache" >> $GITHUB_OUTPUT
echo "deploy_options=" >> $GITHUB_OUTPUT
else
echo "build_options=--ccache --use_brew_qt" >> $GITHUB_OUTPUT
echo "deploy_options=--use_brew_qt -ci='${{ secrets.MACOS_CERT_ID }}'" >> $GITHUB_OUTPUT
fi
- name: Setup Windows MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Set CodeSign Certificate macOS
if: ${{ matrix.os == 'macos-latest'}}
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }}
p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }}
- name: Install Qt
if: matrix.os != 'macos-latest'
uses: jurplel/install-qt-action@v3
with:
cache: true
version: ${{ env.QT_VERSION }}
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install dependencies
shell: bash
run: |
sh scripts/${{ runner.os }}/0_setup_env.sh
- name: Install Brew Qt
if: matrix.os == 'macos-latest'
run: |
brew install qt@5
- name: Cache external libraries sources
id: cache-ext-libs
uses: actions/cache@v4
with:
path: src/meshlab/src/external/downloads/*
key: ${{ runner.os }}-external-libraries
- name: Ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ runner.os }}-${{ github.ref }}
- name: Build PyMeshLab ${{ matrix.pyversion }}
run: |
sh scripts/${{ runner.os }}/1_build.sh ${{ steps.envs.outputs.build_options }}
- name: Deploy PyMeshLab ${{ matrix.pyversion }}
run: |
sh scripts/${{ runner.os }}/2_deploy.sh ${{ steps.envs.outputs.deploy_options }}
- name: Upload PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
uses: actions/upload-artifact@v4
with:
name: PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
path: pymeshlab
build_wheel:
name: Build PyMeshLab Wheel
runs-on: ${{ matrix.os }}
needs: build_pymeshlab
strategy:
matrix:
pyversion: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: ['ubuntu-20.04', 'macos-13', 'macos-latest', 'windows-latest']
exclude:
- os: macos-latest
pyversion: '3.9'
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Setup env variables
id: envs
shell: bash
run: |
ARCH=$(uname -m)
echo "arch=$ARCH" >> $GITHUB_OUTPUT
- name: Download PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v4
with:
name: PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
path: pymeshlab/
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Build Wheel
shell: bash
run: |
pip install wheel
pip wheel . -w wheels/
- name: Upload wheel ${{ runner.os }}_${{ steps.envs.outputs.arch }} python ${{ matrix.pyversion }}
uses: actions/upload-artifact@v4
with:
name: pymeshlab_whl_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
path: wheels/pymeshlab*.whl
test_pymeshlab:
name: Test PyMeshLab
runs-on: ${{ matrix.os }}
needs: build_pymeshlab
strategy:
matrix:
pyversion: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: ['ubuntu-latest', 'macos-13', 'macos-latest', 'windows-latest']
exclude:
- os: macos-latest
pyversion: '3.9'
steps:
- name: Setup env variables
id: envs
shell: bash
run: |
ARCH=$(uname -m)
echo "arch=$ARCH" >> $GITHUB_OUTPUT
- name: Download PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v4
with:
name: PyMeshLab_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
path: pymeshlab/
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install dependencies
run: |
pip install pytest numpy
- name: Set CPU opengl
if: runner.os == 'Windows'
run: |
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows
- name: Run tests
run: |
pytest --pyargs pymeshlab -m "not glcontext"
#- name: Upload PyMeshLab results
# uses: actions/upload-artifact@v4
# with:
# name: PyMeshLabResults_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
# path: pymeshlab/tests/sample_meshes/test_output
test_wheel:
name: Test Wheel
needs: build_wheel
runs-on: ${{ matrix.os }}
strategy:
matrix:
pyversion: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: ['ubuntu-latest', 'macos-13', 'macos-latest', 'windows-latest']
exclude:
- os: macos-latest
pyversion: '3.9'
steps:
- name: Setup env variables
id: envs
shell: bash
run: |
ARCH=$(uname -m)
echo "arch=$ARCH" >> $GITHUB_OUTPUT
- name: Download pymeshlab_whl_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
uses: actions/download-artifact@v4
with:
name: pymeshlab_whl_${{ runner.os }}_${{ steps.envs.outputs.arch }}_python${{ matrix.pyversion }}
path: .
- name: Install Python ${{ matrix.pyversion }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyversion }}
- name: Install wheel and dependencies
shell: bash
run: |
pip install pytest numpy
pip install pymeshlab*.whl
- name: Set CPU opengl
if: runner.os == 'Windows'
run: |
python -c 'import pymeshlab; pymeshlab.use_cpu_opengl()' #just for windows
- name: Run tests
run: |
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: [test_pymeshlab, test_wheel]
runs-on: ubuntu-latest
steps:
#download all the artifact wheels
- name: Download Pymeshlab Wheels
uses: actions/download-artifact@v4
with:
path: wheels/
#Create release
- name: Create Release
uses: "ncipollo/release-action@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
tag: v${{ github.event.inputs.version }}
name: 'PyMeshLab v${{ github.event.inputs.version }}'
artifacts: |
wheels/pymeshlab_whl_*/pymeshlab*.whl