@@ -12,18 +12,32 @@ jobs:
12
12
13
13
env :
14
14
PYTHON_VERSION : 3.11.0
15
+ APP_NAME : FBmn-STATS-GUIde
15
16
16
17
steps :
17
18
- name : Checkout
18
19
uses : actions/checkout@v4
19
20
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
+
20
27
- name : Setup python embeddable version
21
28
run : |
29
+ # Create a directory for the embeddable Python version
22
30
mkdir python-${{ env.PYTHON_VERSION }}
31
+
32
+ # Download and unzip the embeddable Python version
23
33
curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
24
34
unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
25
35
rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
26
36
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
+
27
41
- name : Install pip
28
42
run : |
29
43
curl -O https://bootstrap.pypa.io/get-pip.py
@@ -39,28 +53,154 @@ jobs:
39
53
40
54
- name : Create FBmn-STATS-GUIde.bat file
41
55
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
+
45
58
- name : Create All-in-one executable folder
46
59
run : |
47
60
mkdir streamlit_exe
61
+
48
62
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
49
- mv FBmn-STATS-GUIde.bat streamlit_exe
50
63
cp -r src streamlit_exe
51
64
cp -r pages streamlit_exe
52
65
cp -r assets streamlit_exe
53
66
cp -r example-data streamlit_exe
54
67
cp -r .streamlit streamlit_exe
55
68
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 "[AppSubFolder]${{ env.APP_NAME }}.bat"" /> -->
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
56
196
57
-
58
- - name : Compress streamlit_exe folder to FBmn-STATS-GUIde.zip
197
+ - name : Link .wixobj file into .msi with light.exe
59
198
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
61
200
62
201
- name : Upload artifact
63
202
uses : actions/upload-artifact@v4
64
203
with :
65
204
name : FBmn-STATS-GUIde
66
- path : FBmn-STATS-GUIde.zip
205
+ path : |
206
+ ${{ env.APP_NAME }}.msi
0 commit comments