forked from medInria/medInria-public
-
Notifications
You must be signed in to change notification settings - Fork 9
134 lines (115 loc) · 5.32 KB
/
musicardio-macos.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
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: MUSICardio on macOS
on:
push:
branches: [ "4.1" ]
pull_request:
branches: [ "4.1" ]
workflow_dispatch:
inputs:
EXPIRATION_TIME:
description: 'Expiration time in month'
required: true
default: '12'
type: string
#schedule:
# - cron: '0 0 * * 1' # Each monday at 0h00, MIN HOUR DAY_IN_MONTH MONTH WEEK_DAY
env:
BUILD_TYPE: Release
QT5_DIR: "/usr/local/opt/qt@5/lib/cmake/Qt5"
MSC_SSH_PLUGINS: ${{ secrets.MSC_SSH_PLUGINS }}
MSC_TOKEN: ${{ secrets.MSC_TOKEN }}
jobs:
build:
# https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories
runs-on: macos-13
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: 4.1
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "$MSC_SSH_PLUGINS" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Install dependencies
run: |
brew install qt@5
brew install boost
brew install swig
brew install libomp
echo "OpenMP_ROOT=$(brew --prefix libomp)" >> $GITHUB_ENV
pip3 install dmgbuild
# brew info cmake
- name: Set default EXPIRATION_TIME if not provided (with non manual workflow)
run: echo "EXPIRATION_TIME=${{ inputs.EXPIRATION_TIME || '12' }}" >> $GITHUB_ENV
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DUSE_GITHUB_SSH:BOOL=TRUE \
-DmedInria_BUILD_TYPE:STRING=$BUILD_TYPE \
-Dmusic-plugins_BUILD_TYPE:STRING=$BUILD_TYPE \
-DEP_CHECKBOX_CUSTOM_DIRS:BOOL=ON \
-DEP_CHECKBOX_ON_TOP_LEVEL:BOOL=OFF \
-DEP_CHECKBOX_SIDE_BY_SIDE:BOOL=OFF \
-DQt5_DIR=$QT5_DIR \
-DOpenMP_ROOT=$OpenMP_ROOT \
-DUSE_FFmpeg=ON \
-DEXPIRATION_TIME:STRING=$EXPIRATION_TIME \
-DUSE_RealTimeWorkspace=OFF
- name: Build
run: |
CORES_TO_USE=$(($(sysctl -n hw.ncpu) - 1)) # Limit the number of used core otherwise the compilation crashes sometimes
echo "Using $CORES_TO_USE cores for the build"
cmake --build ${{github.workspace}}/build --config $BUILD_TYPE --parallel $CORES_TO_USE
- name: Package
run: |
cd ${{github.workspace}}/build
cpack -C $BUILD_TYPE
- name: Prepare DMG and update design
run: |
cd ${{github.workspace}}/build
dmg=$(ls *.dmg)
echo "The current package to adapt: $dmg"
if [ -n "$dmg" ]; then
# Attach to read-write format and retrieve mount path
path=$(hdiutil attach -owners on $dmg -shadow | grep -i 'Volumes' | cut -f 3)
echo "The current path: $path"
# Navigate to correct directory
cd "$path/MUSICardio.app/Contents/"
pathPluginsLegacy="${{github.workspace}}/build/medInria-build/bin/plugins_legacy"
# Change library paths for plugins
for f in PlugIns/*.dylib; do
install_name_tool -change $pathPluginsLegacy/libAAMeshInteractorPlugin.dylib @executable_path/../PlugIns/libAAMeshInteractorPlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libAAAMeshUtilityPlugin.dylib @executable_path/../PlugIns/libAAAMeshUtilityPlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libAAAmedPipelinePlugin.dylib @executable_path/../PlugIns/libAAAmedPipelinePlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libmscPipelinesPlugin.dylib @executable_path/../PlugIns/libmscPipelinesPlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libAAAEPMapPlugin.dylib @executable_path/../PlugIns/libAAAEPMapPlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libAAMFSSimulationPlugin.dylib @executable_path/../PlugIns/libAAMFSSimulationPlugin.dylib $f
install_name_tool -change $pathPluginsLegacy/libFEMForwardProblemPlugin.dylib @executable_path/../PlugIns/libFEMForwardProblemPlugin.dylib $f
done
# Go back to original path
cd "${{github.workspace}}/build"
# Update dmg design
echo "### Now we are going to update the dmg design"
volumeName=$(basename "$path")
dmgbuild -s ../packaging/apple/settings.json "$volumeName" MUSICardio.dmg
echo "End of the processes"
else
echo "A problem happened in MSC compilation, no dmg is built"
fi
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_name: Inria-Asclepios/msc_binaries
# A personal access token for the GitHub repository in which the release will be created and edited.
# It is recommended to create the access token with the following scopes: `repo, user, admin:repo_hook`.
repo_token: ${{ secrets.MSC_TOKEN }}
file: ${{github.workspace}}/build/MUSICardio.dmg
asset_name: MUSICardio.dmg
tag: latest
overwrite: true
body: "MUSICardio binaries"