Skip to content

Commit 1fcba4f

Browse files
authored
Merge pull request #26 from abzer005/main
Metadata warning
2 parents 5ee79a5 + c15697d commit 1fcba4f

File tree

6 files changed

+387
-15
lines changed

6 files changed

+387
-15
lines changed

.github/workflows/build-windows-executable-app.yaml

+148-8
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@ jobs:
1212

1313
env:
1414
PYTHON_VERSION: 3.11.0
15+
APP_NAME: FBmn-STATS-GUIde
1516

1617
steps:
1718
- name: Checkout
1819
uses: actions/checkout@v4
1920

21+
- name: Set up Python (regular distribution)
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version
25+
26+
2027
- name: Setup python embeddable version
2128
run: |
29+
# Create a directory for the embeddable Python version
2230
mkdir python-${{ env.PYTHON_VERSION }}
31+
32+
# Download and unzip the embeddable Python version
2333
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
2434
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
2535
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
2636
37+
# Define paths for the regular Python distribution and the embeddable distribution
38+
$PYTHON_DIR="${{ runner.tool_cache }}/Python/${{ env.PYTHON_VERSION }}/x64" # Path from actions/setup-python
39+
$EMBED_DIR="python-${{ env.PYTHON_VERSION }}"
40+
2741
- name: Install pip
2842
run: |
2943
curl -O https://bootstrap.pypa.io/get-pip.py
@@ -39,28 +53,154 @@ jobs:
3953

4054
- name: Create FBmn-STATS-GUIde.bat file
4155
run: |
42-
echo '@echo off' > FBmn-STATS-GUIde.bat
43-
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run Statistics_for_Metabolomics.py' >> FBmn-STATS-GUIde.bat
44-
56+
echo " start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run Statistics_for_Metabolomics.py local" > ${{ env.APP_NAME }}.bat
57+
4558
- name: Create All-in-one executable folder
4659
run: |
4760
mkdir streamlit_exe
61+
4862
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
49-
mv FBmn-STATS-GUIde.bat streamlit_exe
5063
cp -r src streamlit_exe
5164
cp -r pages streamlit_exe
5265
cp -r assets streamlit_exe
5366
cp -r example-data streamlit_exe
5467
cp -r .streamlit streamlit_exe
5568
cp Statistics_for_Metabolomics.py streamlit_exe
69+
cp ${{ env.APP_NAME }}.bat streamlit_exe
70+
71+
- name: Generate Readme.txt
72+
shell: bash
73+
run: |
74+
cat <<EOF > streamlit_exe/Readme.txt
75+
Welcome to ${{ env.APP_NAME }} app!
76+
77+
To launch the application:
78+
1. Navigate to the installation directory.
79+
2. Double-click on the file: ${{ env.APP_NAME }}.bat or ${{ env.APP_NAME }} shortcut.
80+
81+
Additional Information:
82+
- If multiple Streamlit apps are running, you can change the port in the .streamlit/config.toml file.
83+
Example:
84+
[server]
85+
port = 8502
86+
87+
Thank you for using ${{ env.APP_NAME }}!
88+
EOF
89+
90+
- name: Install WiX Toolset
91+
run: |
92+
curl -LO https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311-binaries.zip
93+
unzip wix311-binaries.zip -d wix
94+
rm wix311-binaries.zip
95+
96+
- name: Build .wxs for streamlit_exe folder
97+
run: |
98+
./wix/heat.exe dir streamlit_exe -gg -sfrag -sreg -srd -template component -cg StreamlitExeFiles -dr AppSubFolder -out streamlit_exe_files.wxs
99+
100+
- name: Generate VBScript file
101+
shell: bash
102+
run: |
103+
cat <<EOF > ShowSuccessMessage.vbs
104+
MsgBox "The ${{ env.APP_NAME }} application is successfully installed.", vbInformation, "Installation Complete"
105+
EOF
106+
107+
- name: Prepare SourceDir
108+
run: |
109+
mkdir SourceDir
110+
mv streamlit_exe/* SourceDir
111+
cp ShowSuccessMessage.vbs SourceDir
112+
cp assets/app_license.rtf SourceDir
113+
# Logo of app
114+
cp assets/app_icon.ico SourceDir
115+
116+
- name: Generate WiX XML file
117+
shell: bash
118+
run: |
119+
cat <<EOF > streamlit_exe.wxs
120+
<?xml version="1.0"?>
121+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
122+
<Product Id="1ec8b822-5005-4a98-95ee-38cede795aae" Name="${{ env.APP_NAME }}" Language="1033" Version="1.0.0.0" Codepage="1252" Manufacturer="Functional Metabolomics Lab" UpgradeCode="2482e972-0c2d-416b-b72e-4d063ee23b61">
123+
<Package Id="*" InstallerVersion="300" Compressed="yes" InstallPrivileges="elevated" Platform="x64" />
124+
<Media Id="1" Cabinet="streamlit.cab" EmbedCab="yes" />
125+
126+
<!-- Folder structure -->
127+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
128+
<Directory Id="TARGETDIR" Name="SourceDir">
129+
<Directory Id="ProgramFilesFolder">
130+
<Directory Id="INSTALLFOLDER" Name="${{ env.APP_NAME }}">
131+
<Directory Id="AppSubFolder" Name="${{ env.APP_NAME }}" />
132+
<Component Id="CreateAppFolder" Guid="15108cff-aafe-4987-82a0-883d8ac096d7">
133+
<CreateFolder>
134+
<Permission User="Everyone" GenericAll="yes" />
135+
</CreateFolder>
136+
</Component>
137+
</Directory>
138+
</Directory>
139+
<Directory Id="DesktopFolder" />
140+
</Directory>
141+
142+
<!-- Add components -->
143+
<Feature Id="MainFeature" Title="Main Application" Level="1">
144+
<ComponentGroupRef Id="StreamlitExeFiles" />
145+
<ComponentRef Id="CreateAppFolder" />
146+
<ComponentRef Id="DesktopShortcutComponent" />
147+
<ComponentRef Id="InstallDirShortcutComponent" />
148+
</Feature>
149+
150+
<!-- Create shortcut for running app on desktop -->
151+
<Component Id="DesktopShortcutComponent" Guid="516639b5-405c-4b10-a037-7b71ca5fe512" Directory="DesktopFolder">
152+
<Shortcut Id="DesktopShortcut" Name="${{ env.APP_NAME }}" Description="Launch ${{ env.APP_NAME }}" Target="[AppSubFolder]${{ env.APP_NAME }}.bat" WorkingDirectory="AppSubFolder" Icon="AppIcon" />
153+
<RegistryValue Root="HKCU" Key="Software\\FunctionalMetabolomicsLab\\${{ env.APP_NAME }}" Name="DesktopShortcut" Type="integer" Value="1" KeyPath="yes" />
154+
</Component>
155+
156+
<!-- Create shortcut for running app in installer folder -->
157+
<Component Id="InstallDirShortcutComponent" Guid="664a0076-013e-4a60-9284-924ee1ec68be" Directory="AppSubFolder">
158+
<Shortcut Id="InstallDirShortcut" Name="${{ env.APP_NAME }}" Description="Launch ${{ env.APP_NAME }}" Target="[AppSubFolder]${{ env.APP_NAME }}.bat" WorkingDirectory="AppSubFolder" Icon="AppIcon" />
159+
<RegistryValue Root="HKCU" Key="Software\\FunctionalMetabolomicsLab\\${{ env.APP_NAME }}" Name="InstallFolderShortcut" Type="integer" Value="1" KeyPath="yes" />
160+
</Component>
161+
162+
<!-- Provide icon here; it should exist in the SourceDir folder -->
163+
<Icon Id="AppIcon" SourceFile="SourceDir/app_icon.ico" />
164+
165+
<!-- Run app directly after installation -->
166+
<!-- <CustomAction Id="RunApp" Directory="AppSubFolder" Execute="deferred" Return="asyncNoWait" Impersonate="no"
167+
ExeCommand="cmd.exe /c &quot;[AppSubFolder]${{ env.APP_NAME }}.bat&quot;" /> -->
168+
169+
<!-- Custom Action to Show Success Message -->
170+
<Binary Id="ShowMessageScript" SourceFile="SourceDir/ShowSuccessMessage.vbs" />
171+
<CustomAction Id="ShowSuccessMessage" BinaryKey="ShowMessageScript" VBScriptCall="" Execute="immediate" Return="check" />
172+
173+
<!-- Add all Custom Actions -->
174+
<InstallExecuteSequence>
175+
<!-- Custom action display success message -->
176+
<Custom Action="ShowSuccessMessage" After="InstallFinalize">NOT Installed</Custom>
177+
<!-- Run app directly after installation -->
178+
<!-- <Custom Action="RunApp" Before="InstallFinalize">NOT REMOVE</Custom> -->
179+
</InstallExecuteSequence>
180+
181+
<!-- Interface options -->
182+
<UI>
183+
<UIRef Id="WixUI_InstallDir" />
184+
<UIRef Id="WixUI_ErrorProgressText" />
185+
</UI>
186+
187+
<!-- Provide license; it should exist in the SourceDir folder -->
188+
<WixVariable Id="WixUILicenseRtf" Value="SourceDir/app_license.rtf" />
189+
</Product>
190+
</Wix>
191+
EOF
192+
193+
- name: Build .wixobj file with candle.exe
194+
run: |
195+
./wix/candle.exe streamlit_exe.wxs streamlit_exe_files.wxs
56196
57-
58-
- name: Compress streamlit_exe folder to FBmn-STATS-GUIde.zip
197+
- name: Link .wixobj file into .msi with light.exe
59198
run: |
60-
7z a FBmn-STATS-GUIde.zip ./streamlit_exe/* -r
199+
./wix/light.exe -ext WixUIExtension -sice:ICE60 -o ${{ env.APP_NAME }}.msi streamlit_exe_files.wixobj streamlit_exe.wixobj
61200
62201
- name: Upload artifact
63202
uses: actions/upload-artifact@v4
64203
with:
65204
name: FBmn-STATS-GUIde
66-
path: FBmn-STATS-GUIde.zip
205+
path: |
206+
${{ env.APP_NAME }}.msi

assets/app_icon.ico

98.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)