-
-
Notifications
You must be signed in to change notification settings - Fork 2
171 lines (146 loc) · 5.83 KB
/
build_cmake.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
name: CMake build
on: push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAC_CODESIGN_EMAIL: ${{ secrets.MAC_CODESIGN_EMAIL }}
MAC_CODESIGN_IDENTITY: ${{ secrets.MAC_CODESIGN_IDENTITY }}
MAC_CODESIGN_KEYCHAIN: "/Users/runner/travis.keychain"
MAC_CODESIGN_KEYCHAIN_PASSWORD: "travis"
MAC_CODESIGN_PASSWORD: ${{ secrets.MAC_CODESIGN_PASSWORD }}
MAC_CODESIGN_TEAM: ${{ secrets.MAC_CODESIGN_TEAM }}
MAC_CODESIGN_FILE_B64: ${{ secrets.MAC_CODESIGN_FILE_B64 }}
MAC_NOTARIZE_PASSWORD: ${{ secrets.MAC_NOTARIZE_PASSWORD }}
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
os: windows-latest,
triple: "windows-clang-x86_64",
path: "/c/ossia-sdk/llvm/bin",
common_flags: "-GNinja \
-DCMAKE_C_COMPILER=c:/ossia-sdk/llvm/bin/clang.exe \
-DCMAKE_CXX_COMPILER=c:/ossia-sdk/llvm/bin/clang++.exe \
-DCMAKE_EXE_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" \
-DCMAKE_SHARED_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" \
-DCMAKE_MODULE_LINKER_FLAGS=\"-fuse-ld=c:/ossia-sdk/llvm/bin/ld.lld.exe --target=x86_64-windows-gnu\" ",
debug_flags: "-DCMAKE_BUILD_TYPE=Debug",
release_flags: "-DCMAKE_BUILD_TYPE=Release",
build_flags: "",
dependencies: "choco install -y ninja",
sdk: "/c/ossia-sdk"
}
- {
name: "macOS",
os: macos-13,
triple: "macos-clang-x86_64",
common_flags: "",
debug_flags: "-DCMAKE_BUILD_TYPE=Debug",
release_flags: "-DCMAKE_BUILD_TYPE=Release",
build_flags: "",
sdk: "/opt/ossia-sdk-x86_64"
}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
if: runner.os == 'macOS'
with:
xcode-version: latest-stable
- name: Install dependencies
shell: bash
run: |
${{ matrix.config.dependencies }}
- name: Download SDK
shell: bash
if: runner.os == 'Windows'
run: |
curl -L https://raw.githubusercontent.com/ossia/score/master/tools/fetch-sdk.sh > fetch-sdk.sh
chmod +x ./fetch-sdk.sh
./fetch-sdk.sh
- name: Setup Codesigning
shell: bash
if: runner.os == 'macOS'
run: |
set +x
security create-keychain -p "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN"
security default-keychain -s "$MAC_CODESIGN_KEYCHAIN"
security unlock-keychain -p "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN"
echo $MAC_CODESIGN_FILE_B64 | base64 --decode > "$HOME/cert.p12"
security import "$HOME/cert.p12" -k "$MAC_CODESIGN_KEYCHAIN" -P "$MAC_CODESIGN_PASSWORD" -T /usr/bin/codesign > /dev/null 2>&1
security set-key-partition-list -S apple-tool:,apple: -s -k "$MAC_CODESIGN_KEYCHAIN_PASSWORD" "$MAC_CODESIGN_KEYCHAIN" > /dev/null 2>&1
rm -rf "$HOME/cert.p12"
- name: Build debug
shell: bash
run: |
export BUILD_DIR=build-debug
if [[ "${{ matrix.config.path }}" != "" ]]; then
export PATH=${{ matrix.config.path }}:$PATH
fi
cmake -S $PWD/max -B $BUILD_DIR \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DCMAKE_CXX_STANDARD=20 \
${{ matrix.config.common_flags }} \
${{ matrix.config.debug_flags }}
cmake --build $BUILD_DIR -- ${{ matrix.config.build_flags }}
- name: Build release
shell: bash
run: |
export BUILD_DIR=build-release
export INSTALL_DIR="$PWD/install"
mkdir -p "$INSTALL_DIR"
if [[ "${{ matrix.config.path }}" != "" ]]; then
export PATH=${{ matrix.config.path }}:$PATH
fi
cmake -S $PWD/max -B $BUILD_DIR \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DMAX_PACKAGE_FOLDER="$PWD/Heartbeat" \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DCMAKE_CXX_STANDARD=20 \
${{ matrix.config.common_flags }} \
${{ matrix.config.release_flags }}
cmake --build $BUILD_DIR -- ${{ matrix.config.build_flags }}
cmake -E tar cf "$PWD/Heartbeat-${{ matrix.config.triple }}.zip" --format=zip -- "$PWD/Heartbeat"
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.triple }}
path: Heartbeat-${{ matrix.config.triple }}.zip
release:
name: Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Combine
shell: bash
run: |
mkdir -p output
find . -name '*.zip' -exec mv {} output/ \;
cd output
for file in *.zip; do
unzip -o $file
done
ls
rm *.zip
zip -r Heartbeat-max.zip Heartbeat
rm -rf Heartbeat
- name: Upload
uses: xresloader/upload-to-github-release@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "output/*"
branches: "main"
verbose: true
prerelease: true
tag_name: "continuous"
default_release_name: "Continuous build"