-
Notifications
You must be signed in to change notification settings - Fork 1
206 lines (202 loc) · 6.71 KB
/
build_unetstudio.yml
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Build UNet Studio
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: '2023.04.17'
release_name:
description: 'Release Name'
required: true
default: '2022.04.17 "Sun" Release'
jobs:
windows_build:
runs-on: windows-2019
env:
CMAKE_PREFIX_PATH: D:/a/UNet-Studio/UNet-Studio/libtorch
Torch_DIR: D:/a/UNet-Studio/UNet-Studio/libtorch/share/cmake/Torch
steps:
- uses: actions/[email protected]
- name: Install CUDA
uses: Jimver/[email protected]
with:
cuda: '11.7.0'
- name: Install LibTorch
run: |
curl -LO "https://download.pytorch.org/libtorch/cu117/libtorch-win-shared-with-deps-2.0.0%2Bcu117.zip"
mkdir libtorch
tar -xf "libtorch-win-shared-with-deps-2.0.0%2Bcu117.zip"
- name: Install Qt
uses: jurplel/[email protected]
with:
version: 6.5.2
- name: Install Ninja and CMake
run: |
choco install ninja cmake
- name: Install Zlib
run: |
./build_packages/install_zlib.bat
del "C:/Program Files/zlib/lib/zlib.lib"
del "C:/Program Files/zlib/bin/zlib.dll"
- name: Install TIPL
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/UNet-Studio-Data.git
- name: Build UNet Studio
run: |
dir "D:/a/UNet-Studio/UNet-Studio/libtorch/share/cmake/Torch"
for /f "usebackq delims=#" %%a in (`"%programfiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -property installationPath`) do call "%%a\Common7\Tools\VsDevCmd.bat" -arch=x64
mkdir -p build
cmake -S . -B build -GNinja -DCMAKE_PREFIX_PATH=D:\a\UNet-Studio\UNet-Studio\libtorch -DTorch_DIR=D:\a\UNet-Studio\UNet-Studio\libtorch\share\cmake\Torch -DCMAKE_BUILD_TYPE=Release -DTIPL_DIR=.
cmake --build ./build --parallel --config Release
shell: cmd
- name: Packaging
run: |
move UNet-Studio-Data unet_studio_win
move install_win.bat unet_studio_win
move build\unet_studio.exe unet_studio_win
windeployqt --no-translations --no-system-d3d-compiler --compiler-runtime --no-opengl-sw unet_studio_win\unet_studio.exe
del *.zip
- name: Zip Release (Update)
uses: TheDoctor0/[email protected]
with:
filename: unet_studio_win.zip
exclusions: .git
path: unet_studio_win
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: "*.zip"
tag: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.release_name }}
prerelease: false
linux-build:
strategy:
matrix:
os: [ubuntu2204,ubuntu2404]
fail-fast: false
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/[email protected]
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: build_packages/${{ matrix.os }}/Dockerfile
push: false
outputs: unet-studio
- name: Packaging
run: |
zip -r unet_studio_${{ matrix.os }}.zip unet-studio
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: "*.zip"
tag: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.release_name }}
prerelease: false
docker_build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/[email protected]
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Current Time
run: echo "DATE_TAG=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: build_packages/docker/Dockerfile
push: true
tags: |
"dsistudio/unetstudio:sun-${{ env.DATE_TAG }}"
dsistudio/unetstudio:latest
macos-build:
strategy:
matrix:
os: [macos-12,macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
CFLAGS: -Werror
steps:
- uses: actions/[email protected]
- name: Setup Python
uses: actions/[email protected]
with:
python-version: 3.11
- name: Install PyTorch
run: |
python -m pip install --upgrade pip
pip install torch torchvision torchaudio
- name: Install CMake
run: |
brew update
brew install cmake
- name: Install Qt
uses: jurplel/[email protected]
with:
version: '6.2'
- name: Download TIPL and Atlases
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/UNet-Studio-Data.git
- name: Build UNet Studio
run: |
mkdir -p build
export TORCH_DIR="$(pip3.11 show torch | grep 'Location:' | awk '{print $2}')"
cmake -S . -B build -DCMAKE_PREFIX_PATH=$TORCH_DIR/torch -DCMAKE_BUILD_TYPE:STRING=Release -DTIPL_DIR=.
cmake --build ./build --parallel --config Release
cd ..
- name: Packaging
run: |
mv build/unet_studio.app .
macdeployqt unet_studio.app
mv UNet-Studio-Data/* unet_studio.app/Contents/MacOS/
mv unet-studio.icns unet_studio.app/Contents/Resources/
zip -r unet_studio_${{ matrix.os }}.zip unet_studio.app
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: "*.zip"
tag: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.release_name }}
prerelease: false