Repository navigation
115 lines (100 loc) · 3.41 KB
/
Copy pathpython-app.yml
File metadata and controls
115 lines (100 loc) · 3.41 KB
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
name: Build Python Binary
permissions:
contents: write
on:
release:
types: [created]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.8.3"
- name: Install dependencies
run: uv sync
- name: Install pipx + PyInstaller
run: |
python -m pip install --upgrade pip
python -m pip install pipx
python -m pipx ensurepath
pipx install pyinstaller
- name: Get Rust target triple
shell: bash
run: |
TRIPLE=$(rustc -vV | grep host | cut -f2 -d' ')
echo "TRIPLE=$TRIPLE" >> $GITHUB_ENV
- name: Build binary with PyInstaller
shell: bash
run: |
SEP=":"
EXT=""
if [[ "${{ runner.os }}" == "Windows" ]]; then
SEP=";"
EXT=".exe"
fi
pyinstaller modules/main.py \
--name server \
--onefile \
--hidden-import=fastapi \
--hidden-import=fastapi.middleware.cors \
--hidden-import=fastapi.middleware.httpsredirect \
--hidden-import=fastapi.middleware.trustedhost \
--hidden-import=uvicorn \
--hidden-import=uvicorn.logging \
--hidden-import=uvicorn.loops.auto \
--hidden-import=uvicorn.protocols.http.auto \
--hidden-import=uvicorn.protocols.websockets.auto \
--hidden-import=uvicorn.lifespan.on \
--hidden-import=pydantic \
--hidden-import=configs.registries.optimizerreg \
--hidden-import=configs.registries.lossreg \
--hidden-import=configs.registries.metricreg \
--hidden-import=configs.registries.layerreg \
--hidden-import=configs.registries.modelreg \
--hidden-import=starlette.responses \
--hidden-import=starlette.requests \
--hidden-import=starlette.middleware \
--hidden-import=starlette.routing \
--hidden-import=starlette.status \
--hidden-import=jinja2 \
--hidden-import=typing_extensions \
--hidden-import=anyio \
--hidden-import=sniffio \
--hidden-import=packaging \
--hidden-import=importlib_metadata \
--hidden-import=isort \
--hidden-import=black \
--add-data "templates${SEP}templates" \
--add-data "modules${SEP}modules" \
--add-data "pyproject.toml${SEP}."
mv "dist/server${EXT}" "dist/server-${TRIPLE}${EXT}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: server-${{ env.TRIPLE }}
path: dist/server-${{ env.TRIPLE }}*
release-upload:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: ./artifacts/server-*