Skip to content

Build DSI Studio

Build DSI Studio #504

name: Build DSI Studio
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: '2024.06.12'
release_name:
description: 'Release Name'
required: true
default: '2024 "Hou" Release'
build_windows:
type: boolean
description: 'Build Windows'
required: false
default: 'true'
build_linux:
type: boolean
description: 'Build Linux'
required: false
default: 'true'
build_mac:
type: boolean
description: 'Build Mac'
required: false
default: 'true'
build_docker:
type: boolean
description: 'Build Docker'
required: false
default: 'true'
jobs:
linux-build:
if: ${{ github.event.inputs.build_linux == 'true' }}
strategy:
matrix:
os: [ubuntu2204,ubuntu2004,ubuntu1804,ubuntu1604,centos7]
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: Build and push
uses: docker/[email protected]
with:
context: .
file: build_packages/${{ matrix.os }}/Dockerfile
push: false
outputs: dsi-studio
- name: Packaging
run: |
zip -r dsi_studio_${{ matrix.os }}.zip dsi-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
macos-build-qt6:
if: ${{ github.event.inputs.build_mac == 'true' }}
strategy:
matrix:
os: [macos-14,macos-13,macos-12]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
CFLAGS: -Werror
steps:
- uses: actions/[email protected]
- name: brew update
run: |
brew update
brew install cmake
- name: Install Qt
uses: jurplel/[email protected]
with:
version: '6.5.2'
modules: qtcharts
- name: Download TIPL and Atlases
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/DSI-Studio-atlas.git
git clone https://github.com/frankyeh/UNet-Studio-Data.git
rm -fr DSI-Studio-atlas/.git
- name: Build DSI Studio
run: |
mkdir -p build
cmake -S . -B build -DCMAKE_BUILD_TYPE:STRING=Release -DTIPL_DIR=.
cmake --build ./build --parallel --config Release
- name: Packaging
run: |
mv build/dsi_studio.app .
macdeployqt dsi_studio.app
curl -sSLO "https://github.com/frankyeh/TinyFSL/releases/download/2022.08.03/tiny_fsl_${{ matrix.os }}.zip"
7z e tiny_fsl_${{ matrix.os }}.zip -odsi_studio.app/Contents/MacOS/plugin
rm -fr dsi_studio.app/Contents/MacOS/plugin/tiny_fsl
rm *.zip
mv other/* dsi_studio.app/Contents/MacOS/
mv DSI-Studio-atlas dsi_studio.app/Contents/MacOS/atlas
mv UNet-Studio-Data/network dsi_studio.app/Contents/MacOS/
mv dsi_studio.icns dsi_studio.app/Contents/Resources/
zip -r dsi_studio_${{ matrix.os }}_qt6.zip dsi_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
windows_build:
if: ${{ github.event.inputs.build_windows == 'true' }}
runs-on: windows-2019
steps:
- uses: actions/[email protected]
- name: Install Qt
uses: jurplel/[email protected]
with:
version: 6.5.2
modules: addons.qtcharts
- name: Step to run when failed
if: ${{ failure() }}
uses: jurplel/[email protected]
with:
version: 6.5.2
modules: addons.qtcharts
- 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: get TIPL and DSI Studio atlas
run: |
git clone https://github.com/frankyeh/TIPL.git
git clone https://github.com/frankyeh/DSI-Studio-atlas.git
git clone https://github.com/frankyeh/UNet-Studio-Data.git
- name: Build DSI Studio CPU
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_cpu
cmake -S . -B build_cpu -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=.
cmake --build ./build_cpu --parallel --config Release
shell: cmd
- name: Install Cuda
uses: Jimver/[email protected]
- name: Build DSI 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=.
cmake --build ./build --parallel --config Release
shell: cmd
- name: Packaging
run: |
mkdir dsi_studio_win
move other\color_map dsi_studio_win
move other\* dsi_studio_win
move build\dsi_studio.exe dsi_studio_win
windeployqt --no-translations --no-system-d3d-compiler --compiler-runtime --no-opengl-sw dsi_studio_win\dsi_studio.exe
move DSI-Studio-atlas dsi_studio_win\atlas
rm dsi_studio_win\atlas\.git -r -force
move UNet-Studio-Data\network dsi_studio_win\
curl -sSLO "https://github.com/frankyeh/TinyFSL/releases/download/2022.08.03/tiny_fsl_win.zip"
7z e tiny_fsl_win.zip -odsi_studio_win\plugin
rm dsi_studio_win\plugin\cublas*
rd dsi_studio_win\plugin\tiny_fsl
del *.zip
- name: Zip Release
uses: TheDoctor0/[email protected]
with:
filename: dsi_studio_win.zip
exclusions: .git
path: dsi_studio_win
- name: Packaging
run: |
rename dsi_studio_win dsi_studio_win_cpu
move build_cpu\dsi_studio.exe dsi_studio_win_cpu
windeployqt --no-translations --no-system-d3d-compiler --compiler-runtime --no-opengl-sw dsi_studio_win_cpu\dsi_studio.exe
shell: cmd
- name: Zip Release
uses: TheDoctor0/[email protected]
with:
filename: dsi_studio_win_cpu.zip
exclusions: .git
path: dsi_studio_win_cpu
- 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:
if: ${{ github.event.inputs.build_docker == 'true' }}
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: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login 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/[email protected]
with:
context: .
file: build_packages/docker/Dockerfile
push: true
tags: |
"dsistudio/dsistudio:chen-${{ env.DATE_TAG }}"
dsistudio/dsistudio:latest
test:
needs: linux-build
name: Test DSI Studio
uses: ./.github/workflows/test.yml