Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata warning #26

Merged
merged 10 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 148 additions & 8 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,32 @@ jobs:

env:
PYTHON_VERSION: 3.11.0
APP_NAME: FBmn-STATS-GUIde

steps:
- name: Checkout
uses: actions/checkout@v4

- 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 }}"

- name: Install pip
run: |
curl -O https://bootstrap.pypa.io/get-pip.py
Expand All @@ -39,28 +53,154 @@ jobs:

- name: Create FBmn-STATS-GUIde.bat file
run: |
echo '@echo off' > FBmn-STATS-GUIde.bat
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run Statistics_for_Metabolomics.py' >> FBmn-STATS-GUIde.bat

echo " start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run Statistics_for_Metabolomics.py local" > ${{ env.APP_NAME }}.bat

- name: Create All-in-one executable folder
run: |
mkdir streamlit_exe

mv python-${{ env.PYTHON_VERSION }} streamlit_exe
mv FBmn-STATS-GUIde.bat streamlit_exe
cp -r src streamlit_exe
cp -r pages streamlit_exe
cp -r assets streamlit_exe
cp -r example-data streamlit_exe
cp -r .streamlit streamlit_exe
cp Statistics_for_Metabolomics.py streamlit_exe
cp ${{ env.APP_NAME }}.bat streamlit_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

Thank you 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: |
mkdir SourceDir
mv streamlit_exe/* SourceDir
cp ShowSuccessMessage.vbs SourceDir
cp assets/app_license.rtf SourceDir
# Logo of app
cp assets/app_icon.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="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">
<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="15108cff-aafe-4987-82a0-883d8ac096d7">
<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="516639b5-405c-4b10-a037-7b71ca5fe512" 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\\FunctionalMetabolomicsLab\\${{ env.APP_NAME }}" Name="DesktopShortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>

<!-- Create shortcut for running app in installer folder -->
<Component Id="InstallDirShortcutComponent" Guid="664a0076-013e-4a60-9284-924ee1ec68be" 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\\FunctionalMetabolomicsLab\\${{ 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/app_icon.ico" />

<!-- Run app directly after installation -->
<!-- <CustomAction Id="RunApp" Directory="AppSubFolder" Execute="deferred" Return="asyncNoWait" Impersonate="no"
ExeCommand="cmd.exe /c &quot;[AppSubFolder]${{ env.APP_NAME }}.bat&quot;" /> -->

<!-- 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/app_license.rtf" />
</Product>
</Wix>
EOF

- name: Build .wixobj file with candle.exe
run: |
./wix/candle.exe streamlit_exe.wxs streamlit_exe_files.wxs


- name: Compress streamlit_exe folder to FBmn-STATS-GUIde.zip
- name: Link .wixobj file into .msi with light.exe
run: |
7z a FBmn-STATS-GUIde.zip ./streamlit_exe/* -r
./wix/light.exe -ext WixUIExtension -sice:ICE60 -o ${{ env.APP_NAME }}.msi streamlit_exe_files.wixobj streamlit_exe.wixobj

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: FBmn-STATS-GUIde
path: FBmn-STATS-GUIde.zip
path: |
${{ env.APP_NAME }}.msi
Binary file added assets/app_icon.ico
Binary file not shown.
Loading