-
-
Notifications
You must be signed in to change notification settings - Fork 938
288 lines (253 loc) · 12.1 KB
/
build_orca.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: Build OrcaSlicer
on:
push:
branches:
- main
paths:
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- 'localization/**'
- 'resources/**'
- ".github/workflows/build_orca.yml"
pull_request:
branches:
- main
paths:
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- ".github/workflows/build_orca.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_orca:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: windows-latest
- os: macos-12
arch: x86_64
- os: macos-12
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the version and date on Ubuntu and macOS
if: matrix.os != 'windows-latest'
id: get-version-unix
run: |
ver=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
echo "ver=$ver" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash
- name: Get the version and date on Windows
if: matrix.os == 'windows-latest'
id: get-version-windows
run: |
echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
# Extract the version from the file
$versionContent = Get-Content version.inc -Raw
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
$ver = $matches[1]
}
echo "ver=$ver" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date: ${{ env.date }} version: $ver"
shell: pwsh
# Mac
- name: Install tools mac
if: matrix.os == 'macos-12'
run: |
brew install cmake git gettext zstd tree
mkdir -p ${{ github.workspace }}/deps/build_${{matrix.arch}}
mkdir -p ${{ github.workspace }}/deps/build_${{matrix.arch}}/OrcaSlicer_dep_${{matrix.arch}}
# - name: build deps
# if: matrix.os == 'macos-12'
# id: cache_deps
# uses: actions/cache@v3
# env:
# cache-name: ${{ runner.os }}-cache-orcaslicer_deps_${{matrix.arch}}
# with:
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep
# key: build-${{ env.cache-name }}
# - if: ${{ steps.cache_deps.outputs.cache-hit != 'true' }}
# name: build deps
# working-directory: ${{ github.workspace }}
# continue-on-error: true
# run: ./build_release_macos.sh -d -a ${{matrix.arch}}
- name: Download and extract deps
if: matrix.os == 'macos-12'
working-directory: ${{ github.workspace }}
run: |
curl -LJO https://github.com/SoftFever/OrcaSlicer_deps/releases/download/OrcaSlicer_deps_Oct2023/OrcaSlicer_dep_mac_${{matrix.arch}}_20231008.tar.gz
tar -zvxf ./OrcaSlicer_dep_mac_${{matrix.arch}}_20231008.tar.gz -C ${{ github.workspace }}/deps/build_${{matrix.arch}}
chown -R $(id -u):$(id -g) ${{ github.workspace }}/deps/build_${{matrix.arch}}
tree ${{ github.workspace }}/deps/build_${{matrix.arch}}
rm ./OrcaSlicer_dep_mac_${{matrix.arch}}_20231008.tar.gz
- name: Build slicer mac
if: matrix.os == 'macos-12'
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -s -n -a ${{matrix.arch}}
# Thanks to RaySajuuk, it's working now
- name: Sign app and notary
if: github.ref == 'refs/heads/main' && matrix.os == 'macos-12'
working-directory: ${{ github.workspace }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
CERTIFICATE_ID: ${{ secrets.MACOS_CERTIFICATE_ID }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build_${{matrix.arch}}/OrcaSlicer/OrcaSlicer.app
ln -s /Applications ${{ github.workspace }}/build_${{matrix.arch}}/OrcaSlicer/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{matrix.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg
xcrun notarytool store-credentials "notarytool-profile" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}"
xcrun notarytool submit "OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
xcrun stapler staple OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg
- name: Create DMG without notary
if: github.ref != 'refs/heads/main' && matrix.os == 'macos-12'
working-directory: ${{ github.workspace }}
run: |
ln -s /Applications ${{ github.workspace }}/build_${{matrix.arch}}/OrcaSlicer/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build_${{matrix.arch}}/OrcaSlicer -ov -format UDZO OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg
- name: Upload artifacts mac
if: matrix.os == 'macos-12'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_${{matrix.arch}}_V${{ env.ver }}.dmg
# Windows
- name: setup MSVC
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Install nsis
if: matrix.os == 'windows-latest'
run: |
dir "C:/Program Files (x86)/Windows Kits/10/Include"
choco install nsis
- name: download deps
if: matrix.os == 'windows-latest'
shell: powershell
run: '(new-object System.Net.WebClient).DownloadFile("https://github.com/SoftFever/OrcaSlicer_deps/releases/download/OrcaSlicer_deps_Oct2023/OrcaSlicer_dep_win64_20230810_vs2022.zip", "$env:temp\OrcaSlicer_dep_win64_20230810_vs2022.zip")'
- name: maker dir
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}
run: |
mkdir ${{ github.workspace }}/deps/build
mkdir ${{ github.workspace }}/deps/build/OrcaSlicer_dep
- name: extract deps
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}/deps/build
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" x %temp%\OrcaSlicer_dep_win64_20230810_vs2022.zip'
# - name: build deps
# if: matrix.os == 'windows-latest'
# id: cache_deps
# uses: actions/cache@v3
# env:
# cache-name: ${{ runner.os }}-cache-orcaslicer_deps
# with:
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep
# key: ${{ runner.os }}-build-${{ env.cache-name }}
# - if: ${{ steps.cache_deps.outputs.cache-hit != 'true' }}
# name: build deps
# working-directory: ${{ github.workspace }}
# continue-on-error: true
# run: .\build_release_vs2022.bat deps
# - run: Get-ChildItem ${{ github.workspace }}/deps/build/ -Exclude OrcaSlicer_dep | Remove-Item -Recurse -Force
- name: Build slicer Win
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}
run: .\build_release_vs2022.bat slicer
- name: Create installer Win
if: matrix.os == 'windows-latest'
working-directory: ${{ github.workspace }}/build
run: |
cpack -G NSIS
# - name: pack app
# if: matrix.os == 'windows-latest'
# working-directory: ${{ github.workspace }}/build
# shell: cmd
# run: '"C:/Program Files/7-Zip/7z.exe" a -tzip OrcaSlicer_dev_build.zip ${{ github.workspace }}/build/OrcaSlicer'
- name: Upload artifacts Win zip
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Windows_V${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer
- name: Upload artifacts Win installer
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Windows_V${{ env.ver }}
path: ${{ github.workspace }}/build/OrcaSlicer*.exe
# Ubuntu
- name: Install dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y autoconf build-essential cmake curl eglexternalplatform-dev \
extra-cmake-modules file git libcairo2-dev libcurl4-openssl-dev libdbus-1-dev libglew-dev libglu1-mesa-dev \
libglu1-mesa-dev libgstreamer1.0-dev libgstreamerd-3-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgtk-3-dev libgtk-3-dev libmspack-dev libosmesa6-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \
libwebkit2gtk-4.0-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget
- name: Install dependencies from BuildLinux.sh
if: matrix.os == 'ubuntu-20.04'
shell: bash
run: sudo ./BuildLinux.sh -ur
- name: Fix permissions
if: matrix.os == 'ubuntu-20.04'
shell: bash
run: sudo chown $USER -R ./
# - name: Build deps
# if: matrix.os == 'ubuntu-20.04'
# id: cache_deps
# uses: actions/cache@v3
# env:
# cache-name: ${{ runner.os }}-cache-orcaslicer_deps_x64
# with:
# path: ${{ github.workspace }}/deps/build/destdir
# key: build-${{ env.cache-name }}
# - if: ${{ steps.cache_deps.outputs.cache-hit != 'true' }}
# name: Build deps
# working-directory: ${{ github.workspace }}
# continue-on-error: true
# run: ./BuildLinux.sh -dr
- name: Download and extract deps
if: matrix.os == 'ubuntu-20.04'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/deps/build
mkdir -p ${{ github.workspace }}/deps/build/destdir
curl -LJO https://github.com/SoftFever/OrcaSlicer_deps/releases/download/OrcaSlicer_deps_Oct2023/OrcaSlicer_dep_ubuntu_20231008.zip
unzip ./OrcaSlicer_dep_ubuntu_20231008.zip -d ${{ github.workspace }}/deps/build/destdir
chown -R $(id -u):$(id -g) ${{ github.workspace }}/deps/build/destdir
ls -l ${{ github.workspace }}/deps/build/destdir
rm OrcaSlicer_dep_ubuntu_20231008.zip
- name: Build slicer
if: matrix.os == 'ubuntu-20.04'
shell: bash
run: |
./BuildLinux.sh -isr
chmod +x ./build/OrcaSlicer_ubu64.AppImage
- name: Upload artifacts Ubuntu
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: OrcaSlicer_Linux_V${{ env.ver }}
path: './build/OrcaSlicer_ubu64.AppImage'