-
Notifications
You must be signed in to change notification settings - Fork 105
315 lines (285 loc) · 11.5 KB
/
main.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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: 'CI'
on:
push:
tags:
- 'v*.*.*'
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ${{ matrix.map.os }}
strategy:
matrix:
map: [{os: windows-2019, host: windows, suffix: exe},
{os: windows-2019, host: windows-factory, suffix: exe},
{os: ubuntu-20.04, host: linux, suffix: run},
{os: macos-11, host: mac, suffix: dmg},
{os: ubuntu-20.04, host: linux-rpi, suffix: tar.gz}]
fail-fast: false
steps:
- name: '⏳ Checkout repository'
uses: actions/checkout@v3
with:
submodules: recursive
- name: '❖ Install Windows Certificates (1/3)'
if: matrix.map.host == 'windows' || matrix.map.host == 'windows-factory'
env:
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
echo "$SM_CLIENT_CERT_FILE_B64" | base64 --decode > $CERTIFICATE_PATH
echo "SM_CLIENT_CERT_FILE=$CERTIFICATE_PATH" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
shell: bash
- name: '❖ Install Windows Certificates (2/3)'
if: matrix.map.host == 'windows' || matrix.map.host == 'windows-factory'
uses: digicert/[email protected]
- name: '❖ Install Windows Certificates (3/3)'
if: matrix.map.host == 'windows' || matrix.map.host == 'windows-factory'
env:
SM_API_KEY: ${{ secrets.SM_API_KEY }}
run: smksp_cert_sync
- name: '🍏 Install Apple Certificates'
if: matrix.map.host == 'mac'
env:
APPLICATION_CERTIFICATE_BASE64: ${{ secrets.MAC_APPLICATION_CER }}
APPLICATION_P12_PASSWORD: ${{ secrets.MAC_APPLICATION_CER_PASSWORD }}
INSTALLER_CERTIFICATE_BASE64: ${{ secrets.MAC_INSTALLER_CER }}
INSTALLER_P12_PASSWORD: ${{ secrets.MAC_INSTALLER_CER_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.MAC_KEYCHAIN_PASSWORD }}
APPLE_ID: ${{ secrets.MAC_APPLE_ID }}
TEAM_ID: ${{ secrets.MAC_TEAM_ID }}
NOTARYTOOL_PASSWORD: ${{ secrets.MAC_2FA_PASSWORD }}
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
APPLICATION_CERTIFICATE_PATH=$RUNNER_TEMP/application_certificate.p12
INSTALLER_CERTIFICATE_PATH=$RUNNER_TEMP/installer_certificate.p12
echo -n "$APPLICATION_CERTIFICATE_BASE64" | base64 --decode -o $APPLICATION_CERTIFICATE_PATH
echo -n "$INSTALLER_CERTIFICATE_BASE64" | base64 --decode -o $INSTALLER_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 $APPLICATION_CERTIFICATE_PATH -P "$APPLICATION_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $INSTALLER_CERTIFICATE_PATH -P "$INSTALLER_P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
xcrun notarytool store-credentials "AC_PASSWORD" --apple-id "$APPLE_ID" --team-id "$TEAM_ID" --password "$NOTARYTOOL_PASSWORD"
- name: '⬇ Install Qt on Windows'
if: matrix.map.host == 'windows' || matrix.map.host == 'windows-factory'
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.5.1'
host: 'windows'
target: 'desktop'
arch: 'win64_mingw'
dir: 'C:\Users\runneradmin'
modules: 'qtimageformats qtserialport qt5compat'
cache: true
tools: 'tools_cmake tools_ifw tools_ninja tools_mingw90'
- name: '⬇ Install Qt on Linux'
if: matrix.map.host == 'linux'
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.5.1'
host: 'linux'
target: 'desktop'
arch: 'gcc_64'
dir: '/home/runner'
modules: 'qtimageformats qtserialport qt5compat'
cache: true
tools: 'tools_cmake tools_ifw tools_ninja'
- name: '⬇ Install Qt on Mac'
if: matrix.map.host == 'mac'
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.5.1'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
dir: '/Users/runner'
modules: 'qtimageformats qtserialport qt5compat'
cache: true
tools: 'tools_cmake tools_ninja'
- name: '⬇ Install Qt Cross-Compile for Raspberry Pi'
if: matrix.map.host == 'linux-rpi'
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt-get install -y make
sudo apt-get install -y build-essential
sudo apt-get install -y libclang-dev
sudo apt-get install -y ninja-build
sudo apt-get install -y gcc
sudo apt-get install -y git
sudo apt-get install -y bison
sudo apt-get install -y python3
sudo apt-get install -y gperf
sudo apt-get install -y pkg-config
sudo apt-get install -y libfontconfig1-dev
sudo apt-get install -y libfreetype6-dev
sudo apt-get install -y libx11-dev
sudo apt-get install -y libx11-xcb-dev
sudo apt-get install -y libxext-dev
sudo apt-get install -y libxfixes-dev
sudo apt-get install -y libxi-dev
sudo apt-get install -y libxrender-dev
sudo apt-get install -y libxcb1-dev
sudo apt-get install -y libxcb-glx0-dev
sudo apt-get install -y libxcb-keysyms1-dev
sudo apt-get install -y libxcb-image0-dev
sudo apt-get install -y libxcb-shm0-dev
sudo apt-get install -y libxcb-icccm4-dev
sudo apt-get install -y libxcb-sync-dev
sudo apt-get install -y libxcb-xfixes0-dev
sudo apt-get install -y libxcb-shape0-dev
sudo apt-get install -y libxcb-randr0-dev
sudo apt-get install -y libxcb-render-util0-dev
sudo apt-get install -y libxcb-util-dev
sudo apt-get install -y libxcb-xinerama0-dev
sudo apt-get install -y libxcb-xkb-dev
sudo apt-get install -y libxkbcommon-dev
sudo apt-get install -y libxkbcommon-x11-dev
sudo apt-get install -y libatspi2.0-dev
sudo apt-get install -y libgl1-mesa-dev
sudo apt-get install -y libglu1-mesa-dev
sudo apt-get install -y freeglut3-dev
sudo apt-get install -y gcc-aarch64-linux-gnu
sudo apt-get install -y g++-aarch64-linux-gnu
sudo apt-get install -y libclang-11-dev
sudo cp cross-compile-ldd /usr/bin/aarch64-linux-gnu-ldd
cd ~
wget https://github.com/openmv/qt-raspi/releases/download/v6.5.1/qt-raspi.tar.gz
tar -xzvf qt-raspi.tar.gz
- name: '🏗 Build IDE on Windows'
if: matrix.map.host == 'windows'
env:
SM_HOST: ${{ secrets.SM_HOST }}
SM_API_KEY: ${{ secrets.SM_API_KEY }}
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
SM_CODE_SIGNING_CERT_SHA1_HASH: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
run: python make.py
- name: '🏗 Build IDE on Windows'
if: matrix.map.host == 'windows-factory'
env:
SM_HOST: ${{ secrets.SM_HOST }}
SM_API_KEY: ${{ secrets.SM_API_KEY }}
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
SM_CODE_SIGNING_CERT_SHA1_HASH: ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }}
run: python make.py --factory
- name: '🏗 Build IDE on Linux'
if: matrix.map.host == 'linux'
env:
MAKE_ARGS: ${{ matrix.map.make_args }}
run: |
sudo apt-get install -y chrpath
python make.py
python make.py --no-build-installer
version=$(ls build | grep -oP 'openmv-ide-linux-x86_64-\K[0-9]+\.[0-9]+\.[0-9]+(?=\.run)')
cd qt-creator/share/qtcreator
zip -r ../../../build/openmv-ide-resources-${version}.zip examples firmware html models
- name: '🏗 Build IDE on Mac'
if: matrix.map.host == 'mac'
run: python make.py
- name: '🏗 Build IDE on Linux for Raspberry Pi'
if: matrix.map.host == 'linux-rpi'
run: python make.py --rpi ~/qt-raspi
- name: '⬆ Upload artifacts'
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
path: 'build/openmv-*.${{ matrix.map.suffix }}'
if-no-files-found: error
- name: '⬆ Upload resources (1/2)'
if: github.event_name != 'pull_request' && matrix.map.host == 'linux'
uses: actions/upload-artifact@v3
with:
path: 'build/openmv-*.tar.gz'
if-no-files-found: error
- name: '⬆ Upload resources (2/2)'
if: github.event_name != 'pull_request' && matrix.map.host == 'linux'
uses: actions/upload-artifact@v3
with:
path: 'build/openmv-*.zip'
if-no-files-found: error
- name: '❖ Remove Windows Certificates'
if: matrix.map.host == 'windows' || matrix.map.host == 'windows-factory'
run: rm $SM_CLIENT_CERT_FILE
shell: bash
- name: '🍏 Remove Apple Certificates'
if: matrix.map.host == 'mac'
run: security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
stable-release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: '🤌 Download artifacts'
uses: actions/download-artifact@v3
- name: "✏️ Generate release changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
toTag: ${{ github.sha }}
configuration: '.github/workflows/changelog.json'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: '🔥 Create stable release'
uses: softprops/action-gh-release@v1
with:
draft: true
files: artifact/*
body: ${{steps.changelog.outputs.changelog}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: '🧹 Remove artifacts'
uses: geekyeggo/delete-artifact@v2
with:
name: 'openmv-*'
failOnError: false
development-release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') == false
permissions:
contents: write
steps:
- name: '🤌 Download artifacts'
uses: actions/download-artifact@v3
- name: '🧹 Delete old release'
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "✏️ Generate release changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
toTag: ${{ github.sha }}
configuration: '.github/workflows/changelog.json'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: '🔥 Create development release'
uses: softprops/action-gh-release@v1
with:
draft: false
name: Development Release
tag_name: development
body: |
**⚠️ This is a development release, and it may be unstable.**
${{steps.changelog.outputs.changelog}}
files: artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: '🧹 Remove artifacts'
uses: geekyeggo/delete-artifact@v2
with:
name: 'openmv-*'
failOnError: false