Skip to content

Build UNet Studio

Build UNet Studio #63

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
steps:
- uses: actions/checkout@v2.5.0
- name: Install Cuda
uses: Jimver/cuda-toolkit@v0.2.5
- 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" -C libtorch --strip-components 1
- name: Install Zlib
run: |
powershell -Command "(Invoke-WebRequest -Uri https://raw.githubusercontent.com/horta/zlib.install/master/install.bat -OutFile install_zlib.bat)";
powershell -Command "(gc install_zlib.bat) -replace '1.2.12', '1.2.13' | Out-File -encoding ASCII install_zlib.bat"
./install_zlib.bat
del install_zlib.bat
del "C:/Program Files/zlib/lib/zlib.lib"
del "C:/Program Files/zlib/bin/zlib.dll"
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: 6.2.0
- name: Install Ninja and CMake
run: |
choco install ninja cmake
- name: Install TIPL
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/UNet-Studio-Network.git
- name: Build UNet Studio
run: |
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 "-DZLIB_LIBRARY=C:/Program Files/zlib/lib/zlibstatic.lib" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_C_COMPILER:STRING=cl" "-DCMAKE_CXX_COMPILER:STRING=cl" -DTIPL_DIR=. -DCMAKE_PREFIX_PATH="%{Qt:QT_INSTALL_PREFIX};./libtorch;./cudnn"
cmake --build ./build --parallel --config Release
shell: cmd
- name: Packaging
run: |
move UNet-Studio-Network 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/zip-release@0.6.0
with:
filename: unet_studio_win.zip
exclusions: .git
path: unet_studio_win
- name: Create Release
uses: ncipollo/release-action@v1.8.9
with:
allowUpdates: true
artifacts: "*.zip"
tag: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.release_name }}
prerelease: false
macos-build:
strategy:
matrix:
os: [macos-12]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
CFLAGS: -Werror
steps:
- uses: actions/checkout@v2.5.0
- name: Install Qt
run: |
brew update
brew install qt6
brew install cmake
brew install libtorch
brew install caffe
- name: Download TIPL and Atlases
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/UNet-Studio-Network.git
- name: Build UNet Studio
run: |
mkdir -p build
cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release -DTIPL_DIR=.
cmake --build ./build --parallel --config Release
cd ..
- name: Packaging
run: |
mv UNet-Studio-Network/* build/unet_studio.app/Contents/MacOS/
mv build/unet_studio.app .
/usr/local/opt/qt@5/bin/macdeployqt unet_studio.app
zip -r unet_studio_${{ matrix.os }}.zip unet_studio.app
- name: Create Release
uses: ncipollo/release-action@v1.8.9
with:
allowUpdates: true
artifacts: "*.zip"
tag: ${{ github.event.inputs.tag }}
name: ${{ github.event.inputs.release_name }}
prerelease: false