-
Notifications
You must be signed in to change notification settings - Fork 5
498 lines (440 loc) · 18.2 KB
/
ci_cd.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
name: GitHub CI
on:
workflow_dispatch:
pull_request:
push:
tags:
- "*"
branches:
- main
env:
MAIN_PYTHON_VERSION: '3.11'
PRECOMPILE_PYTHON_VERSION: '3.11.9'
DOCUMENTATION_CNAME: 'installer.docs.pyansys.com'
LIBRARY_NAME: 'ansys-tools-installer'
LIBRARY_NAMESPACE: 'ansys.tools.installer'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
doc-style:
name: "Documentation style"
runs-on: ubuntu-latest
steps:
- uses: ansys/actions/doc-style@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
tests:
name: "Tests"
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISPLAY: ':99'
steps:
- name: Install Linux os dependencies
if: runner.os == 'Linux'
run: sudo apt install libegl1
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- uses: ansys/actions/tests-pytest@v8
with:
python-version: ${{ matrix.python-version }}
doc-build:
name: "Build documentation"
runs-on: ubuntu-latest
needs: [doc-style]
steps:
- name: Build project documentation
uses: ansys/actions/doc-build@v8
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
dependencies: "libegl1"
doc-deploy:
name: "Deploy development documentation"
runs-on: ubuntu-latest
needs: [doc-build]
if: github.ref == 'refs/heads/main'
steps:
- uses: ansys/actions/doc-deploy-dev@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
build-application-windows:
name: "Build Application"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install Dependencies
run: pip install -e .[freeze]
- name: Freeze application
run: pyinstaller frozen.spec
- name: Install NSIS
run: choco install nsis -y
- name: Print NSIS version
run: makensis -VERSION
- name: Run NSIS
shell: pwsh
if: always()
run: |
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
makensis setup.nsi
- name: List output
run: ls -R dist
- uses: actions/upload-artifact@v4
with:
name: Python-Installer-windows
path: dist/*Setup*.exe
build-application-linux-debian:
strategy:
matrix:
os: ["22.04", "20.04"]
fail-fast: false
name: "Build Application Linux - Ubuntu ${{ matrix.os }}"
runs-on: ubuntu-${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt install aptitude -y;
sudo aptitude install libfontconfig1-dev \
libfreetype6-dev \
libx11-dev \
libx11-xcb-dev \
libxext-dev \
libxfixes-dev \
libxi-dev \
libxrender-dev \
libxcb1-dev \
libxcb-glx0-dev \
libxcb-keysyms1-dev \
libxcb-image0-dev \
libxcb-shm0-dev \
libxcb-icccm4-dev \
libxcb-sync-dev \
libxcb-xfixes0-dev \
libxcb-shape0-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-cursor-dev \
libxcb-util-dev \
libxcb-xkb-dev \
libxcb-xinerama0-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
-y
sudo apt install ruby -y
sudo gem install fpm
- name: Ubuntu-20.04 dependencies
if: matrix.os == '20.04'
run: |
sudo add-apt-repository ppa:okirby/qt6-backports -y
sudo apt update
sudo apt install qt6-base-dev -y
wget http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi8_3.4.2-4_amd64.deb
sudo apt install ./libffi8_3.4.2-4_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/w/wayland/libwayland-client0_1.20.0-1_amd64.deb
sudo apt install ./libwayland-client0_1.20.0-1_amd64.deb
- name: Create python-3.11 artifact
run: |
mkdir -p cd ${HOME}/.cache
cd ${HOME}/.cache
wget https://www.python.org/ftp/python/${{ env.PRECOMPILE_PYTHON_VERSION }}/Python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.xz
tar -xf Python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.xz
cd Python-${{ env.PRECOMPILE_PYTHON_VERSION }}
./configure --prefix=${HOME}/python-${{ env.PRECOMPILE_PYTHON_VERSION }}
cd ${HOME}/.cache/Python-${{ env.PRECOMPILE_PYTHON_VERSION }}
make;
make install;
cd ${HOME}/python-${{ env.PRECOMPILE_PYTHON_VERSION }}
cd ..
tar -czf python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz python-${{ env.PRECOMPILE_PYTHON_VERSION }}/
mkdir -p ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }}
mv python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }}
ls -l ${RUNNER_WORKSPACE}/python-installer-qt-gui/src/ansys/tools/installer/assets/python-asset/${{ matrix.os }}
- name: Install Dependencies
run: pip install -e .[freeze]
- name: Freeze application
env:
ADD_PYTHON_BINARIES: true
run: pyinstaller frozen.spec
- name: Setup and Copy Linux files for packaging
run: |
mkdir -p package/opt
mkdir -p package/share/applications
mkdir -p package/share/icons
cp -r dist/ansys_python_manager package/opt/ansys_python_manager
cp src/ansys/tools/installer/assets/pyansys_icon.svg package/share/icons/pyansys_icon.svg
cp linux/debian/ansys_python_manager_prebuid.desktop package/share/applications
find package/opt/ansys_python_manager -type f -exec chmod 644 -- {} +
find package/opt/ansys_python_manager -type d -exec chmod 755 -- {} +
find package/share -type f -exec chmod 644 -- {} +
chmod +x package/opt/ansys_python_manager/ansys_python_manager
chmod +x package/opt/ansys_python_manager/_internal/assets/uninstaller_ubuntu.sh
version=v`cat ./src/ansys/tools/installer/VERSION`
echo "APPLICATION_VERSION=$version" >> $GITHUB_ENV
fpm -v $version --fpm-options-file linux/debian/fpm-options-debian
- name: Create zip file
run: |
cp linux/debian/installer.sh installer.sh
cp linux/debian/postInstallScript.sh postInstallScript.sh
chmod +x installer.sh postInstallScript.sh ansys_python_manager.deb
ls -l
os_version_processed=`echo ${{ matrix.os }} | sed 's/\./_/g'`
echo "OS_VERSION_PROCESSED=$os_version_processed" >> $GITHUB_ENV
zip -r Ansys-Python-Manager_linux_${os_version_processed}_${{ env.APPLICATION_VERSION }}.zip ansys_python_manager.deb installer.sh postInstallScript.sh
- uses: actions/upload-artifact@v4
with:
name: Python-Installer-ubuntu_${{ matrix.os }}
path: |
Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${{ env.APPLICATION_VERSION }}.zip
build-application-linux-non-debian:
strategy:
matrix:
os: ["quay.io/centos/centos:stream9", "fedora:latest"]
fail-fast: false
name: "Build Application Linux - ${{ matrix.os }}"
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
steps:
- uses: actions/checkout@v4
- name: Install CentOS/Fedora Dependencies
if: contains(matrix.os, 'centos') || contains(matrix.os, 'fedora')
run: |
yum update -y
yum groupinstall "Development Tools" -y
yum install python3 \
python3-pip \
wget \
binutils \
ruby-devel \
rubygems \
rpm-build \
openssl \
fontconfig-devel \
freetype-devel \
libX11-devel \
libX11-xcb \
libXext-devel \
libXfixes-devel \
libXi-devel \
libXrender-devel \
libxcb-devel \
xcb-util-keysyms \
xcb-util \
xcb-util-image \
xcb-util-wm \
xcb-util-renderutil \
libXcursor-devel \
libglvnd-glx \
libxshmfence-devel \
libXrandr-devel \
libxkbcommon-devel \
libXinerama-devel \
libxkbcommon-x11 \
xorg-x11-drivers \
mesa-libGL \
mesa-libEGL \
mesa-dri-drivers \
python3-qt5 \
gtk3-devel \
gnome-terminal \
dbus-x11 \
-y
yum install ruby -y
gem install fpm
- name: Create OS version, Github Workspace, Folder Name variables
run: |
os_version_processed=`echo ${{ matrix.os }} | sed 's/\:/_/g' | sed 's/\./_/g' | awk -F/ '{print $NF}'`
echo "OS_VERSION_PROCESSED=$os_version_processed" >> $GITHUB_ENV
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
folder_name=`echo $os_version_processed | awk -F_ '{print $1}'`
echo "FOLDER_NAME=$folder_name" >> $GITHUB_ENV
- name: Create python-3.11 artifact
run: |
mkdir -p cd ${{ env.GITHUB_WORKSPACE }}/.cache
cd ${{ env.GITHUB_WORKSPACE }}/.cache
wget https://www.python.org/ftp/python/${{ env.PRECOMPILE_PYTHON_VERSION }}/Python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.xz
tar -xf Python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.xz
cd Python-${{ env.PRECOMPILE_PYTHON_VERSION }}
./configure --prefix=${{ env.GITHUB_WORKSPACE }}/python-${{ env.PRECOMPILE_PYTHON_VERSION }}
cd ${{ env.GITHUB_WORKSPACE }}/.cache/Python-${{ env.PRECOMPILE_PYTHON_VERSION }}
make;
make install;
cd ${{ env.GITHUB_WORKSPACE }}/python-${{ env.PRECOMPILE_PYTHON_VERSION }}
cd ..
tar -czf python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz python-${{ env.PRECOMPILE_PYTHON_VERSION }}/
mkdir -p ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }}
mv python-${{ env.PRECOMPILE_PYTHON_VERSION }}.tar.gz ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }}
ls -l ${{ env.GITHUB_WORKSPACE }}/src/ansys/tools/installer/assets/python-asset/${{ env.FOLDER_NAME }}
- name: Update pip
run: |
python3 -m pip install pip -U
- name: Install pip Dependencies
run: |
python3 -m pip install --ignore-installed -e .[freeze]
- name: Freeze application
env:
ADD_PYTHON_BINARIES: false
run: python3 -m PyInstaller frozen.spec
- name: Setup and Copy CentOS/RHEL files for packaging
if: contains(matrix.os, 'centos')
run: |
yum install xorg-x11-utils -y
mkdir -p package_CentOS/opt
mkdir -p package_CentOS/usr/share/applications
mkdir -p package_CentOS/usr/share/icons/hicolor/scalable/apps
chmod +x src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh
cp -r dist/ansys_python_manager package_CentOS/opt/ansys_python_manager
cp src/ansys/tools/installer/assets/pyansys_icon.svg package_CentOS/usr/share/icons/hicolor/scalable/apps/pyansys_icon.svg
cp linux/non-debian/ansys_python_manager.desktop package_CentOS/usr/share/applications
find package_CentOS/opt/ansys_python_manager -type f -exec chmod 644 -- {} +
find package_CentOS/opt/ansys_python_manager -type d -exec chmod 755 -- {} +
find package_CentOS/usr/share -type f -exec chmod 644 -- {} +
chmod +x package_CentOS/opt/ansys_python_manager/ansys_python_manager
version=v`cat ./src/ansys/tools/installer/VERSION`
echo "APPLICATION_VERSION=$version" >> $GITHUB_ENV
fpm -v $version --fpm-options-file linux/non-debian/fpm-options-centos
cp ./linux/non-debian/installer_CentOS.sh installer_CentOS.sh
cp ./linux/non-debian/updater_CentOS.sh updater_CentOS.sh
chmod +x installer_CentOS.sh updater_CentOS.sh ansys_python_manager_CentOS.rpm
zip -r ${{ env.GITHUB_WORKSPACE }}/Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${version}.zip ansys_python_manager_CentOS.rpm installer_CentOS.sh updater_CentOS.sh
ls -l ${{ env.GITHUB_WORKSPACE }}
- name: Setup and Copy Fedora files for packaging
if: contains(matrix.os, 'fedora')
run: |
mkdir -p package_Fedora/opt
mkdir -p package_Fedora/usr/share/applications
mkdir -p package_Fedora/usr/share/icons/hicolor/scalable/apps
chmod +x src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh
cp -r dist/ansys_python_manager package_Fedora/opt/ansys_python_manager
cp src/ansys/tools/installer/assets/pyansys_icon.svg package_Fedora/usr/share/icons/hicolor/scalable/apps/pyansys_icon.svg
cp linux/non-debian/ansys_python_manager.desktop package_Fedora/usr/share/applications
find package_Fedora/opt/ansys_python_manager -type f -exec chmod 644 -- {} +
find package_Fedora/opt/ansys_python_manager -type d -exec chmod 755 -- {} +
find package_Fedora/usr/share -type f -exec chmod 644 -- {} +
chmod +x package_Fedora/opt/ansys_python_manager/ansys_python_manager
version=v`cat ./src/ansys/tools/installer/VERSION`
echo "APPLICATION_VERSION=$version" >> $GITHUB_ENV
fpm -v $version --fpm-options-file linux/non-debian/fpm-options-fedora
cp ./linux/non-debian/installer_CentOS.sh installer_Fedora.sh
cp ./linux/non-debian/updater_CentOS.sh updater_Fedora.sh
chmod +x installer_Fedora.sh updater_Fedora.sh ansys_python_manager_Fedora.rpm
zip -r ${{ env.GITHUB_WORKSPACE }}/Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${version}.zip ansys_python_manager_Fedora.rpm installer_Fedora.sh updater_Fedora.sh
ls -l ${{ env.GITHUB_WORKSPACE }}
- uses: actions/upload-artifact@v4
with:
name: Python-Installer-${{ env.OS_VERSION_PROCESSED }}
path: |
${{ env.GITHUB_WORKSPACE }}/Ansys-Python-Manager_linux_${{ env.OS_VERSION_PROCESSED }}_${{ env.APPLICATION_VERSION }}.zip
sign-application-windows:
name: Sign application
needs: [build-application-windows]
runs-on:
group: ansys-network
labels: [self-hosted, Windows, signtool]
steps:
- name: Checkout the SignTool
uses: actions/checkout@v4
with:
repository: ansys-internal/signtool-ansys-apps
token: ${{ secrets.SIGNTOOL_ACCESS_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: Python-Installer-windows
path: signtool/installer
- name: List current structure
run: ls -R
- name: Sign application
working-directory: signtool
run: |
$filename = (get-ChildItem installer -recurse | where {$_.name -like "*Setup*"}).Name
$jobname = $filename -replace ".{4}$"
dotnet signclient.dll sign `
-r ansyssigning@ansys.com `
-s '${{ secrets.SIGNTOOL_PWD }}' `
-c AppSettings.json `
-n $jobname `
-i installer/$filename
- uses: actions/upload-artifact@v4
with:
name: Python-Installer-windows-signed
path: signtool/installer/*Setup*.exe
release:
name: Release application
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs:
- sign-application-windows
- build-application-linux-debian
- build-application-linux-non-debian
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: Python-Installer-windows-signed
path: installer-signed
- uses: actions/download-artifact@v4
with:
name: Python-Installer-windows
path: installer
- uses: actions/download-artifact@v4
with:
name: Python-Installer-ubuntu_20.04
path: installer
- uses: actions/download-artifact@v4
with:
name: Python-Installer-ubuntu_22.04
path: installer
- uses: actions/download-artifact@v4
with:
name: Python-Installer-centos_stream9
path: installer
- uses: actions/download-artifact@v4
with:
name: Python-Installer-fedora_latest
path: installer
- name: Display structure of downloaded files
run: ls -R
- name: Rename unsigned exe
run: |
cd installer
for filename in *.exe; do mv "$filename" "Unsigned_${filename}"; done;
cd -
- name: Release to GitHub
uses: softprops/action-gh-release@v2
with:
files: |
installer/*.zip
installer-signed/*.exe
installer/*.exe
generate_release_notes: true
doc-deploy-release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release, doc-build]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}