-
Notifications
You must be signed in to change notification settings - Fork 122
159 lines (152 loc) · 5 KB
/
build-server.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Build Server
on:
workflow_dispatch:
jobs:
models:
name: Download Model Files
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Model Files
id: models
run: |
VERSION=$(awk -F ' = "' '/version =/ {print $2}' src-python/pyproject.toml | tr -d '"')
echo "version=$VERSION" >> $GITHUB_OUTPUT
mkdir -p src-python/models && cd src-python/models
BASE_URL="https://github.com/idootop/TinyFace/releases/download/models-1.0.0"
curl -# -O -L "${BASE_URL}/arcface_w600k_r50.onnx"
curl -# -O -L "${BASE_URL}/gfpgan_1.4.onnx"
curl -# -O -L "${BASE_URL}/inswapper_128_fp16.onnx"
curl -# -O -L "${BASE_URL}/scrfd_2.5g.onnx"
cd ${{ github.workspace }}
- name: Upload models
uses: actions/upload-artifact@v4
with:
name: models
path: src-python/models
if-no-files-found: error
outputs:
version: ${{ steps.models.outputs.version }}
build-for-macos:
name: macOS
needs: models
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
build: macos
os: macos-13-arm64
arch: aarch64
# - target: x86_64-apple-darwin
# build: macos
# os: macos-13
# arch: x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Download Models
uses: actions/download-artifact@v4
with:
name: models
path: src-python/models
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.10.11
cache: "pip"
cache-dependency-path: "**/requirements.txt"
- name: Install Python Dependencies
run: |
cd src-python
pip install -r requirements.txt
pip install -e .
cd ${{ github.workspace }}
- name: Build Server
run: |
python -m nuitka --standalone --assume-yes-for-downloads \
--include-data-files="src-python/models/*.onnx=models/" \
--output-dir=out src-python/server.py
cd out/server.dist && zip -r ../server_${{ matrix.build }}_${{ matrix.arch }}.zip .
cd ${{ github.workspace }}
- name: Upload Server
uses: actions/upload-artifact@v4
with:
name: server_${{ matrix.build }}_${{ matrix.arch }}
path: out/*.zip
# build-for-windows:
# name: Windows
# needs: models
# permissions:
# contents: write
# strategy:
# fail-fast: false
# matrix:
# include:
# - target: x86_64-pc-windows-msvc
# build: windows
# os: windows-2019
# arch: x86_64
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v4
# - name: Download Models
# uses: actions/download-artifact@v4
# with:
# name: models
# path: src-python/models
# - name: Setup Python
# uses: actions/setup-python@v5
# with:
# python-version: 3.10.11
# cache: "pip"
# cache-dependency-path: "**/requirements.txt"
# - name: Install Python Dependencies
# run: |
# cd src-python
# pip install -r requirements.txt
# pip install -e .
# cd ${{ github.workspace }}
# - name: Build Server
# shell: pwsh
# run: |
# python -m nuitka --standalone --assume-yes-for-downloads `
# --mingw64 --windows-console-mode=disable `
# --include-data-files="src-python/models/*.onnx=models/" `
# --output-dir=out src-python/server.py
# cd out/server.dist
# Compress-Archive -Path * -DestinationPath "../server_${{ matrix.build }}_${{ matrix.arch }}.zip"
# cd ${{ github.workspace }}
# - name: Upload Server
# uses: actions/upload-artifact@v4
# with:
# name: server_${{ matrix.build }}_${{ matrix.arch }}
# path: out/*.zip
# release:
# name: Release
# needs: [models, build-for-macos, build-for-windows]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Downoad Artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: server_*
# path: dist
# merge-multiple: true
# - name: Release Server v${{ needs.models.outputs.version }}
# uses: ncipollo/release-action@v1
# with:
# allowUpdates: true
# token: ${{ secrets.GITHUB_TOKEN }}
# name: Server v${{ needs.models.outputs.version }}
# tag: server-v${{ needs.models.outputs.version }}
# body: MagicMirror Server v${{ needs.models.outputs.version }}
# draft: true
# prerelease: false
# removeArtifacts: true
# artifacts: dist/*.zip