forked from OpenMS/streamlit-template
-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (108 loc) · 5.94 KB
/
test-win-exe-w-embed-py.yaml
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
name: Test streamlit executable for Windows with embeddable python
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-win-executable-with-embeddable-python:
runs-on: windows-latest
env:
PYTHON_VERSION: 3.11.9
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download python embeddable version
run: |
mkdir python-${{ env.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
- 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 python311._pth file
run: |
sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
- name: Print content of python311._pth file
run: |
cat python-${{ env.PYTHON_VERSION }}/python311._pth
- name: Install Required Packages
run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install -r requirements.txt --no-warn-script-location
- name: Create run_app.bat file
run: |
echo '@echo off' > run_app.bat
echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run app.py local' >> run_app.bat
- name: Create All-in-one executable folder
run: |
mkdir streamlit_exe
mv python-${{ env.PYTHON_VERSION }} streamlit_exe
cp -r src streamlit_exe
cp -r content streamlit_exe
cp -r docs 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 default-parameters.json streamlit_exe
- 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 INSTALLFOLDER -out streamlit_exe_files.wxs
- name: Prepare SourceDir
run: |
mkdir SourceDir
mv streamlit_exe/* SourceDir
mv run_app.bat SourceDir
cp dummy_license.rtf SourceDir
- name: Generate WiX XML file
run: |
echo '<?xml version="1.0"?>' > streamlit_exe.wxs
echo '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">' >> streamlit_exe.wxs
echo ' <Product Id="*" Name="OpenMS-StreamlitTemplateApp" Language="1033" Version="1.0.0.0" Manufacturer="OpenMS" UpgradeCode="8d28e8c7-45dc-446c-b889-99a6aea2f1a5">' >> streamlit_exe.wxs
echo ' <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine"/>' >> streamlit_exe.wxs
echo ' <Media Id="1" Cabinet="streamlit.cab" EmbedCab="yes" />' >> streamlit_exe.wxs
echo ' <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />' >> streamlit_exe.wxs
echo ' <Property Id="INSTALLFOLDER" Secure="yes" />' >> streamlit_exe.wxs
echo ' <Directory Id="TARGETDIR" Name="SourceDir">' >> streamlit_exe.wxs
echo ' <Directory Id="ProgramFilesFolder">' >> streamlit_exe.wxs
echo ' <Directory Id="INSTALLFOLDER" Name="StreamlitApp" />' >> streamlit_exe.wxs
echo ' </Directory>' >> streamlit_exe.wxs
echo ' </Directory>' >> streamlit_exe.wxs
echo ' <Feature Id="MainFeature" Title="Main Application" Level="1">' >> streamlit_exe.wxs
echo ' <ComponentGroupRef Id="StreamlitExeFiles" />' >> streamlit_exe.wxs
echo ' <ComponentRef Id="BatFileComponent" />' >> streamlit_exe.wxs
echo ' </Feature>' >> streamlit_exe.wxs
echo ' <Component Id="BatFileComponent" Guid="7aa6c3dc-f78e-40ce-b6a1-e11240af3c84" Directory="INSTALLFOLDER">' >> streamlit_exe.wxs
echo ' <File Id="BatFile" Source="SourceDir/run_app.bat" KeyPath="yes" />' >> streamlit_exe.wxs
echo ' </Component>' >> streamlit_exe.wxs
echo ' <CustomAction Id="RunBatchFile" Directory="INSTALLFOLDER" Execute="deferred" Return="asyncNoWait"' >> streamlit_exe.wxs
echo ' ExeCommand="cmd.exe /c "[INSTALLFOLDER]run_app.bat"" />' >> streamlit_exe.wxs
echo ' <InstallExecuteSequence>' >> streamlit_exe.wxs
echo ' <Custom Action="RunBatchFile" Before="InstallFinalize">NOT REMOVE</Custom>' >> streamlit_exe.wxs
echo ' </InstallExecuteSequence>' >> streamlit_exe.wxs
echo ' <UI>' >> streamlit_exe.wxs
echo ' <UIRef Id="WixUI_InstallDir" />' >> streamlit_exe.wxs
echo ' <UIRef Id="WixUI_ErrorProgressText" />' >> streamlit_exe.wxs
echo ' </UI>' >> streamlit_exe.wxs
echo ' <WixVariable Id="WixUILicenseRtf" Value="SourceDir/dummy_license.rtf" />' >> streamlit_exe.wxs
echo ' </Product>' >> streamlit_exe.wxs
echo '</Wix>' >> streamlit_exe.wxs
- name: Build msi
run: |
./wix/candle.exe streamlit_exe.wxs streamlit_exe_files.wxs
./wix/light.exe -ext WixUIExtension -sice:ICE60 -o OpenMS-StreamlitTemplateApp.msi streamlit_exe_files.wixobj streamlit_exe.wixobj
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: OpenMS-StreamlitTemplateApp
path: |
OpenMS-StreamlitTemplateApp.msi