Skip to content

Commit 386c737

Browse files
authored
Refactor workflow to build executable without WiX
Updated the GitHub Actions workflow to build an executable without using WiX Toolset. Changed the name and removed WiX-related steps.
1 parent 9fbd2df commit 386c737

File tree

2 files changed

+329
-101
lines changed

2 files changed

+329
-101
lines changed
Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
name: Build executable without Wix
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- development
7+
pull_request:
8+
branches: [ "main" ]
9+
workflow_dispatch:
10+
11+
env:
12+
OPENMS_VERSION: 3.5.0
13+
# Define needed TOPP tools here
14+
TOPP_TOOLS: "OpenNuXL"
15+
16+
jobs:
17+
build-openms:
18+
runs-on: windows-2022
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
repository: OpenMS/OpenMS
25+
ref: release/${{ env.OPENMS_VERSION }}
26+
path: 'OpenMS'
27+
28+
- name: Install Qt (Windows)
29+
uses: jurplel/install-qt-action@v4
30+
with:
31+
version: '6.8.3' ## Note this version is build with win64_msvc2022_64 and should always match what we use
32+
arch: 'win64_msvc2022_64'
33+
cache: 'false'
34+
archives: 'qtsvg qtimageformats qtbase'
35+
36+
# https://github.com/marketplace/actions/visual-studio-shell
37+
- name: Set up Visual Studio shell
38+
uses: egor-tensin/vs-shell@v2
39+
with:
40+
arch: x64
41+
42+
- name: Setup build tools
43+
shell: bash
44+
run: |
45+
choco install ccache ninja -y --no-progress
46+
choco install cmake --version=3.31.1 -y --no-progress --force
47+
## GH CLI "SHOULD BE" installed. Sometimes I had to manually install nonetheless. Super weird.
48+
# https://github.com/actions/runner-images/blob/main/images/win/scripts/Installers/Install-GitHub-CLI.ps1
49+
echo "C:/Program Files (x86)/GitHub CLI" >> $GITHUB_PATH
50+
51+
- name: Extract branch/PR infos
52+
shell: bash
53+
run: |
54+
cd OpenMS
55+
RUN_NAME_LOCAL=$(echo ${GITHUB_REF#refs/heads/} | tr / -)
56+
echo "RUN_NAME=${RUN_NAME_LOCAL}" >> $GITHUB_ENV
57+
echo "BASE_REF=$(gh pr view --json baseRefName -q .baseRefName || echo ${RUN_NAME_LOCAL})" >> $GITHUB_ENV
58+
id: extract_branch
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Cache contrib
63+
id: cache-contrib-win
64+
uses: actions/cache@v4
65+
with:
66+
path: ${{ github.workspace }}/OpenMS/contrib
67+
key: ${{ runner.os }}-contrib3
68+
69+
- name: Load contrib build
70+
if: steps.cache-contrib-win.outputs.cache-hit != 'true'
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
run: |
74+
cd OpenMS/contrib
75+
# Download the file using the URL fetched from GitHub
76+
gh release download -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz'
77+
# Extract the archive
78+
7z x -so contrib_build-Windows.tar.gz | 7z x -si -ttar
79+
rm contrib_build-Windows.tar.gz
80+
ls
81+
82+
- name: Add contrib to PATH
83+
shell: bash
84+
run: |
85+
# Add contrib library path for runtime DLL resolution
86+
echo "${{ github.workspace }}/OpenMS/contrib/lib" >> $GITHUB_PATH
87+
88+
- name: Setup ccache cache
89+
uses: actions/cache@v4
90+
with:
91+
path: .ccache
92+
key: ${{ runner.os }}-ccache-${{ env.RUN_NAME }}-${{ github.run_number }}
93+
# Restoring: From current branch, otherwise from base branch, otherwise from any branch.
94+
restore-keys: |
95+
${{ runner.os }}-ccache-${{ env.RUN_NAME }}
96+
${{ runner.os }}-ccache-${{ env.BASE_REF }}
97+
${{ runner.os }}-ccache-
98+
99+
- name: Add THIRDPARTY
100+
shell: bash
101+
run: |
102+
# initialize THIRDPARTY
103+
cd OpenMS
104+
git submodule update --init THIRDPARTY
105+
cd ..
106+
# add third-party binaries to PATH
107+
# use flat THIRDPARTY structure
108+
mkdir -p _thirdparty
109+
cp -R OpenMS/THIRDPARTY/Windows/x86_64/* _thirdparty/
110+
cp -R OpenMS/THIRDPARTY/All/* _thirdparty/
111+
# add third-party binaries to PATH
112+
for thirdpartytool in ${{ github.workspace }}/_thirdparty/*
113+
do
114+
echo $thirdpartytool >> $GITHUB_PATH
115+
done
116+
117+
- name: Build Windows
118+
shell: bash
119+
run: |
120+
mkdir $GITHUB_WORKSPACE/OpenMS/bld/
121+
bash OpenMS/tools/ci/capture-env.sh -v $GITHUB_WORKSPACE/OpenMS/bld/CMakeCache.txt
122+
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cibuild.cmake
123+
env:
124+
OPENMS_CONTRIB_LIBS: "${{ github.workspace }}/OpenMS/contrib"
125+
CI_PROVIDER: "GitHub-Actions"
126+
CMAKE_GENERATOR: "Ninja"
127+
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
128+
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
129+
ENABLE_STYLE_TESTING: "OFF"
130+
ENABLE_TOPP_TESTING: "ON"
131+
ENABLE_CLASS_TESTING: "ON"
132+
WITH_GUI: "OFF"
133+
WITH_PARQUET: "OFF"
134+
ADDRESS_SANITIZER: "Off"
135+
BUILD_TYPE: "Release"
136+
OPENMP: "Off"
137+
USE_STATIC_BOOST: "On"
138+
# BUILD_FLAGS: "-p:CL_MPCount=2" # For VS Generator and MSBuild
139+
BUILD_FLAGS: "-j2" # Ninja will otherwise use all cores (doesn't go well in GHA)
140+
CMAKE_CCACHE_EXE: "ccache"
141+
CCACHE_BASEDIR: ${{ github.workspace }}
142+
CCACHE_DIR: ${{ github.workspace }}/.ccache
143+
CCACHE_COMPRESS: true
144+
CCACHE_COMPRESSLEVEL: 12
145+
CCACHE_MAXSIZE: 400M
146+
147+
- name: Test Windows
148+
shell: bash
149+
run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake
150+
env:
151+
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
152+
CI_PROVIDER: "GitHub-Actions"
153+
BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}"
154+
155+
- name: Package
156+
shell: bash
157+
run: |
158+
ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cipackage.cmake
159+
env:
160+
SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS"
161+
PACKAGE_TYPE: zip
162+
SEARCH_ENGINES_DIRECTORY: "${{ github.workspace }}/_thirdparty"
163+
CI_PROVIDER: "GitHub-Actions"
164+
CPACK_PACKAGE_FILE_NAME: "openms-package"
165+
166+
- name: Upload package as artifact
167+
uses: actions/upload-artifact@v4
168+
with:
169+
name: openms-package
170+
path: |
171+
#${{ github.workspace }}/OpenMS/bld/bin/*
172+
#${{ github.workspace }}/_thirdparty/*
173+
${{ github.workspace }}/OpenMS/bld/bin/OpenNuXL.exe
174+
${{ github.workspace }}/OpenMS/bld/bin/FileConverter.exe
175+
${{ github.workspace }}/OpenMS/bld/bin/PercolatorAdapter.exe
176+
${{ github.workspace }}/OpenMS/bld/bin/*.dll
177+
${{ github.workspace }}/_thirdparty/*.exe
178+
${{ github.workspace }}/_thirdparty/ThermoRawFileParser/**
179+
${{ github.workspace }}/_thirdparty/Percolator/**
180+
181+
build-executable:
182+
runs-on: windows-2022
183+
needs: build-openms
184+
185+
env:
186+
PYTHON_VERSION: 3.10.0
187+
APP_NAME: OpenMS-NuXLApp
188+
189+
steps:
190+
- name: Checkout
191+
uses: actions/checkout@v4
192+
193+
- name: Download package as artifact
194+
uses: actions/download-artifact@v4
195+
with:
196+
name: openms-package
197+
path: openms-package
198+
199+
- name: List files in openms-package
200+
run: |
201+
ls -R openms-package
202+
203+
- name: Extract bin and share from package
204+
run: |
205+
mkdir -p openms-bin
206+
cp -r openms-package/OpenMS/bld/bin/* openms-bin/ || echo "No files to copy from openms-package/OpenMS/bld/bin"
207+
mkdir -p openms-thirdparty
208+
cp -r openms-package/_thirdparty/* openms-thirdparty/ || echo "No files to copy from openms-package/_thirdparty"
209+
210+
#cp -r share ../share
211+
#cp -r openms-package/bin ../openms-bin
212+
#cp -r openms-package/share ../share
213+
214+
- name: Download and unzip dlls
215+
run: |
216+
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
217+
unzip dlls_for_windows.zip -d dlls_windows
218+
cp -r dlls_windows/dlls_for_windows/* openms-bin/
219+
220+
- name: List files in openms-bin
221+
run: |
222+
ls -R openms-bin
223+
224+
- name: List files in openms-thirdparty
225+
run: |
226+
ls -R openms-thirdparty
227+
228+
- name: Set up Python (regular distribution)
229+
uses: actions/setup-python@v4
230+
with:
231+
python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version
232+
233+
- name: Setup python embeddable version
234+
run: |
235+
# Create a directory for the embeddable Python version
236+
mkdir python-${{ env.PYTHON_VERSION }}
237+
238+
# Download and unzip the embeddable Python version
239+
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
240+
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
241+
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
242+
# Define paths for the regular Python distribution and the embeddable distribution
243+
$PYTHON_DIR="${{ runner.tool_cache }}/Python/${{ env.PYTHON_VERSION }}/x64" # Path from actions/setup-python
244+
$EMBED_DIR="python-${{ env.PYTHON_VERSION }}"
245+
246+
mkdir -p $EMBED_DIR/Lib/site-packages/tkinter
247+
mkdir -p $EMBED_DIR/tcl
248+
# Copy necessary Tkinter files from the regular Python distribution
249+
cp -r $PYTHON_DIR/Lib/tkinter/* $EMBED_DIR/Lib/site-packages/tkinter/
250+
cp -r $PYTHON_DIR/tcl/* $EMBED_DIR/tcl/
251+
cp $PYTHON_DIR/DLLs/_tkinter.pyd $EMBED_DIR/
252+
cp $PYTHON_DIR/DLLs/tcl86t.dll $EMBED_DIR/
253+
cp $PYTHON_DIR/DLLs/tk86t.dll $EMBED_DIR/
254+
255+
- name: Install pip
256+
run: |
257+
curl -O https://bootstrap.pypa.io/get-pip.py
258+
./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
259+
rm get-pip.py
260+
261+
- name: Uncomment 'import site' in python310._pth file
262+
run: |
263+
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python310._pth
264+
265+
- name: Install Required Packages
266+
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements.txt --no-warn-script-location
267+
268+
- name: Set to offline deployment
269+
run: |
270+
$content = Get-Content -Raw settings.json | ConvertFrom-Json
271+
$content.online_deployment = $false
272+
$content | ConvertTo-Json -Depth 100 | Set-Content settings.json
273+
274+
- name: Create .bat file
275+
run: |
276+
echo " start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run app.py local" > ${{ env.APP_NAME }}.bat
277+
278+
- name: Create All-in-one executable folder
279+
run: |
280+
if (Test-Path -Path "streamlit_exe") {
281+
Remove-Item -Recurse -Force "streamlit_exe"
282+
}
283+
284+
mkdir streamlit_exe
285+
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
286+
cp -r src streamlit_exe
287+
cp -r content streamlit_exe
288+
cp -r assets streamlit_exe
289+
cp -r example-data streamlit_exe
290+
cp -r .streamlit streamlit_exe
291+
cp app.py streamlit_exe
292+
cp settings.json streamlit_exe
293+
cp ${{ env.APP_NAME }}.bat streamlit_exe
294+
cp -r openms-bin streamlit_exe
295+
cp -r openms-thirdparty streamlit_exe
296+
297+
#$files = $env:TOPP_TOOLS -split ' '
298+
#foreach ($file in $files) {
299+
# Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe"
300+
#}
301+
302+
- name: Generate Readme.txt
303+
shell: bash
304+
run: |
305+
cat <<EOF > streamlit_exe/Readme.txt
306+
Welcome to ${{ env.APP_NAME }} app!
307+
To launch the application:
308+
1. Navigate to the installation directory.
309+
2. Double-click on the file: ${{ env.APP_NAME }}.bat or ${{ env.APP_NAME }} shortcut.
310+
Additional Information:
311+
- If multiple Streamlit apps are running, you can change the port in the .streamlit/config.toml file.
312+
Example:
313+
[server]
314+
port = 8502
315+
Reach out to us:
316+
- Join our Discord server for support and community discussions: https://discord.com/invite/4TAGhqJ7s5
317+
- Contribute or stay updated with the latest OpenMS web app developments on GitHub: https://github.com/OpenMS/streamlit-template
318+
- Checkout the ${{ env.APP_NAME }} on Github: https://github.com/Arslan-Siraj/nuxl-app
319+
- Visit our website for more information: https://openms.de/
320+
321+
Thanks for using ${{ env.APP_NAME }}!
322+
EOF
323+
324+
- name: Archive build artifacts
325+
uses: actions/upload-artifact@v4
326+
with:
327+
name: OpenMS_NuXLApp_without_Wix
328+
path: |
329+
streamlit_exe

0 commit comments

Comments
 (0)