-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild-windows-executable-app.yaml
More file actions
449 lines (389 loc) · 18 KB
/
build-windows-executable-app.yaml
File metadata and controls
449 lines (389 loc) · 18 KB
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
name: Build executable for Windows
on:
push:
branches:
- main
- development
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
OPENMS_VERSION: 3.5.0
# Define unique GUID for UpgradeCode
APP_UpgradeCode: "31703de0-3422-444a-a469-8df83635bd6d"
# Define needed TOPP tools here
TOPP_TOOLS: "OpenNuXL"
jobs:
build-openms:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: OpenMS/OpenMS
ref: release/${{ env.OPENMS_VERSION }}
path: 'OpenMS'
- name: Install Qt (Windows)
uses: jurplel/install-qt-action@v4
with:
version: '6.8.3' ## Note this version is build with win64_msvc2022_64 and should always match what we use
arch: 'win64_msvc2022_64'
cache: 'false'
archives: 'qtsvg qtimageformats qtbase'
# https://github.com/marketplace/actions/visual-studio-shell
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Setup build tools
shell: bash
run: |
choco install ccache ninja -y --no-progress
choco install cmake --version=3.31.1 -y --no-progress --force
## GH CLI "SHOULD BE" installed. Sometimes I had to manually install nonetheless. Super weird.
# https://github.com/actions/runner-images/blob/main/images/win/scripts/Installers/Install-GitHub-CLI.ps1
echo "C:/Program Files (x86)/GitHub CLI" >> $GITHUB_PATH
- name: Extract branch/PR infos
shell: bash
run: |
cd OpenMS
RUN_NAME_LOCAL=$(echo ${GITHUB_REF#refs/heads/} | tr / -)
echo "RUN_NAME=${RUN_NAME_LOCAL}" >> $GITHUB_ENV
echo "BASE_REF=$(gh pr view --json baseRefName -q .baseRefName || echo ${RUN_NAME_LOCAL})" >> $GITHUB_ENV
id: extract_branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache contrib
id: cache-contrib-win
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/OpenMS/contrib
key: ${{ runner.os }}-contrib3
- name: Load contrib build
if: steps.cache-contrib-win.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd OpenMS/contrib
# Download the file using the URL fetched from GitHub
gh release download -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz'
# Extract the archive
7z x -so contrib_build-Windows.tar.gz | 7z x -si -ttar
rm contrib_build-Windows.tar.gz
ls
- name: Add contrib to PATH
shell: bash
run: |
# Add contrib library path for runtime DLL resolution
echo "${{ github.workspace }}/OpenMS/contrib/lib" >> $GITHUB_PATH
- name: Setup ccache cache
uses: actions/cache@v4
with:
path: .ccache
key: ${{ runner.os }}-ccache-${{ env.RUN_NAME }}-${{ github.run_number }}
# Restoring: From current branch, otherwise from base branch, otherwise from any branch.
restore-keys: |
${{ runner.os }}-ccache-${{ env.RUN_NAME }}
${{ runner.os }}-ccache-${{ env.BASE_REF }}
${{ runner.os }}-ccache-
- name: Add THIRDPARTY
shell: bash
run: |
# initialize THIRDPARTY
cd OpenMS
git submodule update --init THIRDPARTY
cd ..
# add third-party binaries to PATH
# use flat THIRDPARTY structure
mkdir -p _thirdparty
cp -R OpenMS/THIRDPARTY/Windows/x86_64/* _thirdparty/
cp -R OpenMS/THIRDPARTY/All/* _thirdparty/
# add third-party binaries to PATH
for thirdpartytool in ${{ github.workspace }}/_thirdparty/*
do
echo $thirdpartytool >> $GITHUB_PATH
done
- name: Build Windows
shell: bash
run: |
mkdir $GITHUB_WORKSPACE/OpenMS/bld/
bash OpenMS/tools/ci/capture-env.sh -v $GITHUB_WORKSPACE/OpenMS/bld/CMakeCache.txt
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cibuild.cmake
env:
OPENMS_CONTRIB_LIBS: "${{ github.workspace }}/OpenMS/contrib"
CI_PROVIDER: "GitHub-Actions"
CMAKE_GENERATOR: "Ninja"
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
ENABLE_STYLE_TESTING: "OFF"
ENABLE_TOPP_TESTING: "ON"
ENABLE_CLASS_TESTING: "ON"
WITH_GUI: "OFF"
WITH_PARQUET: "OFF"
ADDRESS_SANITIZER: "Off"
BUILD_TYPE: "Release"
OPENMP: "Off"
USE_STATIC_BOOST: "On"
# BUILD_FLAGS: "-p:CL_MPCount=2" # For VS Generator and MSBuild
BUILD_FLAGS: "-j2" # Ninja will otherwise use all cores (doesn't go well in GHA)
CMAKE_CCACHE_EXE: "ccache"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 12
CCACHE_MAXSIZE: 400M
- name: Test Windows
shell: bash
run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake
env:
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
CI_PROVIDER: "GitHub-Actions"
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
- name: Package
shell: bash
run: |
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cipackage.cmake
env:
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
PACKAGE_TYPE: zip
SEARCH_ENGINES_DIRECTORY: "${{ github.workspace }}/_thirdparty"
CI_PROVIDER: "GitHub-Actions"
CPACK_PACKAGE_FILE_NAME: "openms-package"
- name: Upload package as artifact
uses: actions/upload-artifact@v4
with:
name: openms-package
path: |
#${{ github.workspace }}/OpenMS/bld/bin/*
#${{ github.workspace }}/_thirdparty/*
${{ github.workspace }}/OpenMS/bld/bin/OpenNuXL.exe
${{ github.workspace }}/OpenMS/bld/bin/PercolatorAdapter.exe
${{ github.workspace }}/OpenMS/bld/bin/*.dll
${{ github.workspace }}/_thirdparty/*.exe
${{ github.workspace }}/_thirdparty/ThermoRawFileParser/**
${{ github.workspace }}/_thirdparty/Percolator/**
build-executable:
runs-on: windows-2022
needs: build-openms
env:
PYTHON_VERSION: 3.10.0
APP_NAME: OpenMS-NuXLApp
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download package as artifact
uses: actions/download-artifact@v4
with:
name: openms-package
path: openms-package
- name: List files in openms-package
run: |
ls -R openms-package
- name: Extract bin and share from package
run: |
mkdir -p openms-bin
cp -r openms-package/OpenMS/bld/bin/* openms-bin/ || echo "No files to copy from openms-package/OpenMS/bld/bin"
mkdir -p openms-thirdparty
cp -r openms-package/_thirdparty/* openms-thirdparty/ || echo "No files to copy from openms-package/_thirdparty"
#cp -r share ../share
#cp -r openms-package/bin ../openms-bin
#cp -r openms-package/share ../share
- name: Download and unzip dlls
run: |
curl -L -o dlls_for_windows.zip https://github.com/Arslan-Siraj/nuxl_webapp_supporting_files/releases/download/v0.0.1/dlls_for_windows.zip
unzip dlls_for_windows.zip -d dlls_windows
cp -r dlls_windows/dlls_for_windows/* openms-bin/
- name: List files in openms-bin
run: |
ls -R openms-bin
- name: List files in openms-thirdparty
run: |
ls -R openms-thirdparty
- name: Set up Python (regular distribution)
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version
- name: Setup python embeddable version
run: |
# Create a directory for the embeddable Python version
mkdir python-${{ env.PYTHON_VERSION }}
# Download and unzip the embeddable Python version
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
# Define paths for the regular Python distribution and the embeddable distribution
$PYTHON_DIR="${{ runner.tool_cache }}/Python/${{ env.PYTHON_VERSION }}/x64" # Path from actions/setup-python
$EMBED_DIR="python-${{ env.PYTHON_VERSION }}"
mkdir -p $EMBED_DIR/Lib/site-packages/tkinter
mkdir -p $EMBED_DIR/tcl
# Copy necessary Tkinter files from the regular Python distribution
cp -r $PYTHON_DIR/Lib/tkinter/* $EMBED_DIR/Lib/site-packages/tkinter/
cp -r $PYTHON_DIR/tcl/* $EMBED_DIR/tcl/
cp $PYTHON_DIR/DLLs/_tkinter.pyd $EMBED_DIR/
cp $PYTHON_DIR/DLLs/tcl86t.dll $EMBED_DIR/
cp $PYTHON_DIR/DLLs/tk86t.dll $EMBED_DIR/
- name: Install pip
run: |
curl -O https://bootstrap.pypa.io/get-pip.py
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
rm get-pip.py
- name: Uncomment 'import site' in python310._pth file
run: |
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python310._pth
- name: Install Required Packages
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements.txt --no-warn-script-location
- name: Set to offline deployment
run: |
$content = Get-Content -Raw settings.json | ConvertFrom-Json
$content.online_deployment = $false
$content | ConvertTo-Json -Depth 100 | Set-Content settings.json
- name: Create .bat file
run: |
echo " start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run app.py local" > ${{ env.APP_NAME }}.bat
- name: Create All-in-one executable folder
run: |
if (Test-Path -Path "streamlit_exe") {
Remove-Item -Recurse -Force "streamlit_exe"
}
mkdir streamlit_exe
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
cp -r src streamlit_exe
cp -r content streamlit_exe
cp -r assets streamlit_exe
cp -r example-data streamlit_exe
cp -r .streamlit streamlit_exe
cp app.py streamlit_exe
cp settings.json streamlit_exe
cp ${{ env.APP_NAME }}.bat streamlit_exe
cp -r openms-bin streamlit_exe
cp -r openms-thirdparty streamlit_exe
#$files = $env:TOPP_TOOLS -split ' '
#foreach ($file in $files) {
# Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe"
#}
- name: Generate Readme.txt
shell: bash
run: |
cat <<EOF > streamlit_exe/Readme.txt
Welcome to ${{ env.APP_NAME }} app!
To launch the application:
1. Navigate to the installation directory.
2. Double-click on the file: ${{ env.APP_NAME }}.bat or ${{ env.APP_NAME }} shortcut.
Additional Information:
- If multiple Streamlit apps are running, you can change the port in the .streamlit/config.toml file.
Example:
[server]
port = 8502
Reach out to us:
- Join our Discord server for support and community discussions: https://discord.com/invite/4TAGhqJ7s5
- Contribute or stay updated with the latest OpenMS web app developments on GitHub: https://github.com/OpenMS/streamlit-template
- Checkout the ${{ env.APP_NAME }} on Github: https://github.com/Arslan-Siraj/nuxl-app
- Visit our website for more information: https://openms.de/
Thanks for using ${{ env.APP_NAME }}!
EOF
- name: Install WiX Toolset
run: |
curl -LO https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip
unzip wix311-binaries.zip -d wix
rm wix311-binaries.zip
- name: Build .wxs for streamlit_exe folder
run: |
./wix/heat.exe dir streamlit_exe -gg -sfrag -sreg -srd -template component -cg StreamlitExeFiles -dr AppSubFolder -out streamlit_exe_files.wxs
- name: Generate VBScript file
shell: bash
run: |
cat <<EOF > ShowSuccessMessage.vbs
MsgBox "The ${{ env.APP_NAME }} application is successfully installed.", vbInformation, "Installation Complete"
EOF
- name: Prepare SourceDir
run: |
if (Test-Path -Path "SourceDir") {
Remove-Item -Recurse -Force "SourceDir"
}
mkdir SourceDir
mv streamlit_exe/* SourceDir
cp ShowSuccessMessage.vbs SourceDir
cp assets/openms_license.rtf SourceDir
# Logo of app : from https://www.xiconeditor.com/
cp assets/openNuXL.ico SourceDir
- name: Generate WiX XML file
shell: bash
run: |
cat <<EOF > streamlit_exe.wxs
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="${{ env.APP_NAME }}" Language="1033" Version="1.0.0.0" Codepage="1252" Manufacturer="OpenMS Developer Team" UpgradeCode="${{ env.APP_UpgradeCode }}">
<Package Id="*" InstallerVersion="300" Compressed="yes" InstallPrivileges="elevated" Platform="x64" />
<Media Id="1" Cabinet="streamlit.cab" EmbedCab="yes" />
<!-- Folder structure -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="${{ env.APP_NAME }}">
<Directory Id="AppSubFolder" Name="${{ env.APP_NAME }}" />
<Component Id="CreateAppFolder" Guid="95dbfa06-d36a-427f-995c-e87769ac2e59">
<CreateFolder>
<Permission User="Everyone" GenericAll="yes" />
</CreateFolder>
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" />
</Directory>
<!-- Add components -->
<Feature Id="MainFeature" Title="Main Application" Level="1">
<ComponentGroupRef Id="StreamlitExeFiles" />
<ComponentRef Id="CreateAppFolder" />
<ComponentRef Id="DesktopShortcutComponent" />
<ComponentRef Id="InstallDirShortcutComponent" />
</Feature>
<!-- Create shortcut for running app on desktop -->
<Component Id="DesktopShortcutComponent" Guid="3597b243-9180-4d0b-b105-30d8b0d1a334" Directory="DesktopFolder">
<Shortcut Id="DesktopShortcut" Name="${{ env.APP_NAME }}" Description="Launch ${{ env.APP_NAME }}" Target="[AppSubFolder]${{ env.APP_NAME }}.bat" WorkingDirectory="AppSubFolder" Icon="AppIcon" />
<RegistryValue Root="HKCU" Key="Software\\OpenMS\\${{ env.APP_NAME }}" Name="DesktopShortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>
<!-- Create shortcut for running app in installer folder -->
<Component Id="InstallDirShortcutComponent" Guid="c2df9472-3b45-4558-a56d-6034cf7c8b72" Directory="AppSubFolder">
<Shortcut Id="InstallDirShortcut" Name="${{ env.APP_NAME }}" Description="Launch ${{ env.APP_NAME }}" Target="[AppSubFolder]${{ env.APP_NAME }}.bat" WorkingDirectory="AppSubFolder" Icon="AppIcon" />
<RegistryValue Root="HKCU" Key="Software\\OpenMS\\${{ env.APP_NAME }}" Name="InstallFolderShortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>
<!-- Provide icon here; it should exist in the SourceDir folder -->
<Icon Id="AppIcon" SourceFile="SourceDir/openNuXL.ico" />
<!-- Run app directly after installation -->
<!-- <CustomAction Id="RunApp" Directory="AppSubFolder" Execute="deferred" Return="asyncNoWait" Impersonate="no"
ExeCommand="cmd.exe /c "[AppSubFolder]${{ env.APP_NAME }}.bat"" /> -->
<!-- Custom Action to Show Success Message -->
<Binary Id="ShowMessageScript" SourceFile="SourceDir/ShowSuccessMessage.vbs" />
<CustomAction Id="ShowSuccessMessage" BinaryKey="ShowMessageScript" VBScriptCall="" Execute="immediate" Return="check" />
<!-- Add all Custom Actions -->
<InstallExecuteSequence>
<!-- Custom action display success message -->
<Custom Action="ShowSuccessMessage" After="InstallFinalize">NOT Installed</Custom>
<!-- Run app directly after installation -->
<!-- <Custom Action="RunApp" Before="InstallFinalize">NOT REMOVE</Custom> -->
</InstallExecuteSequence>
<!-- Interface options -->
<UI>
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
<!-- Provide license; it should exist in the SourceDir folder -->
<WixVariable Id="WixUILicenseRtf" Value="SourceDir/openms_license.rtf" />
</Product>
</Wix>
EOF
- name: Build .wixobj file with candle.exe
run: |
./wix/candle.exe streamlit_exe.wxs streamlit_exe_files.wxs
- name: Link .wixobj file into .msi with light.exe
run: |
./wix/light.exe -ext WixUIExtension -sice:ICE60 -o ${{ env.APP_NAME }}.msi streamlit_exe_files.wixobj streamlit_exe.wixobj
- name: Compress Installer
run: |
7z a OpenMS-App.zip ${{ env.APP_NAME }}.msi
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: OpenMS-App
path: |
OpenMS-App.zip