4
4
branches : [ "main" ]
5
5
pull_request :
6
6
branches : [ "main" ]
7
+ workflow_dispatch :
7
8
8
9
jobs :
9
10
build-executable :
@@ -14,71 +15,52 @@ jobs:
14
15
15
16
steps :
16
17
- name : Checkout
17
- uses : actions/checkout@v3
18
+ uses : actions/checkout@v4
18
19
19
- - name : Set up Python
20
- uses : actions/setup-python@v4
21
- with :
22
- python-version : ${{ env.PYTHON_VERSION }}
23
-
24
- - name : Setup virtual environment
25
- shell : cmd
20
+ - name : Setup python embeddable version
26
21
run : |
27
- python -m venv myenv
28
-
29
- call myenv\Scripts\activate.bat
22
+ mkdir python-${{ env.PYTHON_VERSION }}
23
+ curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
24
+ unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }}
25
+ rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip
30
26
31
- pip install -r requirements.txt
32
-
33
- pip install pyinstaller
34
-
35
- - name : Write function to cli.py
36
- shell : bash
27
+ - name : Install pip
37
28
run : |
38
- dir D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages
39
- head -n -2 D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages/streamlit/web/cli.py > temp_cli.py
40
-
41
- cat << EOF >> temp_cli.py
42
- def _main_run_clExplicit(file, command_line, args=[], flag_options=[]):
43
- main._is_running_with_streamlit = True
44
- bootstrap.run(file, command_line, args, flag_options)
29
+ curl -O https://bootstrap.pypa.io/get-pip.py
30
+ ./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location
31
+ rm get-pip.py
45
32
46
-
47
- if __name__ == "__main__":
48
- main()
49
- EOF
50
-
51
- mv temp_cli.py D:/a/streamlit-metabolomics-statistics/streamlit-metabolomics-statistics/myenv/Lib/site-packages/streamlit/web/cli.py
52
-
53
- - name : Compile app with pyinstaller
54
- shell : cmd
33
+ - name : Uncomment 'import site' in python311._pth file
55
34
run : |
56
- call myenv\Scripts\activate.bat
57
- pyinstaller --onefile --additional-hooks-dir ./hooks run.py --clean
35
+ sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python311._pth
58
36
37
+ - name : Install Required Packages
38
+ run : .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements-windows.txt --no-warn-script-location
59
39
60
- - name : Copy everything to dist directory
40
+ - name : Create FBmn-STATS-GUIde.bat file
61
41
run : |
62
- cp -r .streamlit dist/.streamlit
63
- cp -r pages dist/pages
64
- cp -r src dist/src
65
- cp -r assets dist/assets
66
- cp -r example-data dist/example-data
67
- cp Statistics_for_Metabolomics.py dist/
68
-
69
- - name : Modify .spec file
70
- shell : bash
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
+
45
+ - name : Create All-in-one executable folder
71
46
run : |
72
- cp run_app_temp.spec run_app.spec
73
-
74
- - name : Make executable
75
- shell : cmd
47
+ mkdir streamlit_exe
48
+ mv python-${{ env.PYTHON_VERSION }} streamlit_exe
49
+ mv FBmn-STATS-GUIde.bat streamlit_exe
50
+ cp -r src streamlit_exe
51
+ cp -r pages streamlit_exe
52
+ cp -r assets streamlit_exe
53
+ cp -r example-data streamlit_exe
54
+ cp -r .streamlit streamlit_exe
55
+ cp Statistics_for_Metabolomics.py streamlit_exe
56
+
57
+
58
+ - name : Compress streamlit_exe folder to FBmn-STATS-GUIde.zip
76
59
run : |
77
- call myenv\Scripts\activate.bat
78
- pyinstaller run_app.spec --clean
60
+ 7z a FBmn-STATS-GUIde.zip ./streamlit_exe/* -r
79
61
80
62
- name : Upload artifact
81
- uses : actions/upload-artifact@v3
63
+ uses : actions/upload-artifact@v4
82
64
with :
83
- name : FBMN-Stats-App
84
- path : dist
65
+ name : FBmn-STATS-GUIde
66
+ path : FBmn-STATS-GUIde.zip
0 commit comments