7
7
- zmoog/notarize
8
8
9
9
jobs :
10
-
10
+ # The build job is responsible for: configuring the environment, testing and compiling process
11
11
build :
12
12
strategy :
13
13
matrix :
27
27
with :
28
28
go-version : " 1.15"
29
29
30
+ # dependencies used for compiling the GUI
30
31
- name : Install Dependencies (Linux)
31
32
run : sudo apt update && sudo apt install -y --no-install-recommends build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev
32
33
if : matrix.operating-system == 'ubuntu-latest'
@@ -56,23 +57,28 @@ jobs:
56
57
run : task build
57
58
if : matrix.operating-system != 'windows-latest'
58
59
60
+ # build the agent without GUI support (no tray icon)
59
61
- name : Build the Agent-cli
60
62
run : task build-cli
61
63
if : matrix.operating-system == 'ubuntu-latest'
62
64
65
+ # the manifest is required by windows GUI apps, otherwise the binary will crash with: "Unable to create main window: TTM_ADDTOOL failed" (for reference https://github.com/lxn/walk/issues/28)
66
+ # rsrc will produce *.syso files that should get automatically recognized by go build command and linked into an executable.
63
67
- name : Embed manifest in win binary
64
68
run : |
65
69
go get github.com/akavel/rsrc
66
70
rsrc -arch 386 -manifest manifest.xml
67
71
if : matrix.operating-system == 'windows-latest'
68
72
73
+ # building the agent for win requires a different task because of an extra flag
69
74
- name : Build the Agent for win32
70
75
env :
71
- GOARCH : 386 # 32bit architecture
76
+ GOARCH : 386 # 32bit architecture (for support)
72
77
GO386 : 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15)
73
78
run : task build-win32
74
79
if : matrix.operating-system == 'windows-latest'
75
80
81
+ # config.ini is required by the executable when it's run
76
82
- name : Upload artifacts
77
83
uses : actions/upload-artifact@v2
78
84
with :
@@ -82,22 +88,19 @@ jobs:
82
88
config.ini
83
89
if-no-files-found : error
84
90
85
-
91
+ # The code-sign-mac-executable job will download the macOS artifact from the previous job, sign e notarize the binary and re-upload it.
86
92
code-sign-mac-executable :
87
93
needs : build
88
94
runs-on : macOS-latest
89
- env :
90
- INSTALLER_CERT_MAC_PASSWORD : ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
91
- INSTALLER_CERT_MAC_P12 : " /tmp/ArduinoCerts2020.p12"
92
95
93
96
steps :
94
97
- name : Checkout
95
98
uses : actions/checkout@v2
96
99
with :
97
- repository : ' bcmi-labs/arduino-create-agent-installer'
98
- token : ${{ secrets.PAT_TEMP }} # use token organization instead
100
+ repository : ' bcmi-labs/arduino-create-agent-installer' # the repo which contains gon.config.hcl
101
+ token : ${{ secrets.PAT_TEMP }} # TODO use token organization instead
99
102
100
- - name : Download artifacts
103
+ - name : Download artifact
101
104
uses : actions/download-artifact@v2
102
105
with :
103
106
name : arduino-create-agent-macOS-latest
@@ -117,39 +120,44 @@ jobs:
117
120
brew install mitchellh/gon/gon
118
121
119
122
- name : Code sign and notarize app
123
+ env :
124
+ AC_USERNAME : ${{ secrets.AC_USERNAME }}
125
+ AC_PASSWORD : ${{ secrets.AC_PASSWORD }}
120
126
run : |
121
127
gon -log-level=debug -log-json gon.config.hcl
122
128
# gon will notarize ezecutable in "arduino-create-agent-macOS-latest/arduino-create-agent
123
129
# The CI will ignore the zip output, using the signed binary only.
124
- env :
125
- AC_USERNAME : ${{ secrets.AC_USERNAME }}
126
- AC_PASSWORD : ${{ secrets.AC_PASSWORD }}
127
130
128
- - name : Upload artifacts
131
+ # This step will overwrite the non signed mac artifact (arduino-create-agent-macOS-latest)
132
+ - name : Upload artifact
129
133
uses : actions/upload-artifact@v2
130
134
with :
131
135
name : arduino-create-agent-macOS-latest
132
136
path : arduino-create-agent-macOS-latest
133
137
if-no-files-found : error
134
138
139
+ # This job is responsible for generating the installers (using installbuilder)
135
140
package :
136
141
needs : code-sign-mac-executable
137
142
runs-on : ubuntu-latest
138
143
139
144
env :
145
+ # vars used by installbuilder
140
146
INSTALLER_VARS : " project.outputDirectory=$PWD project.version=${GITHUB_REF##*/} workspace=$PWD realname=Arduino_Create_Bridge"
147
+ # vars passed to installbuilder to install https certs automatically
141
148
CERT_INSTALL : " ask_certificates_install=CI" # win(edge),mac(safari)
142
149
NO_CERT_INSTALL : " ask_certificates_install=CS" # linux
143
150
CHOICE_CERT_INSTALL : " ask_certificates_install=CC" # win,mac:(ff,chrome)
144
- CREATE_OSX_BUNDLED_MG : 0 # do not create the DMG, gon will take care of that
151
+ CREATE_OSX_BUNDLED_MG : 0 # tell installbuilder to not create the DMG, gon will take care of that later
152
+ # installbuilder will read this vars automatically (defined in installer.xml):
145
153
INSTALLER_CERT_WINDOWS_PASSWORD : ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
146
154
INSTALLER_CERT_WINDOWS_PFX : " /tmp/ArduinoCerts2020.pfx"
147
155
INSTALLER_CERT_MAC_PASSWORD : ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
148
156
INSTALLER_CERT_MAC_P12 : " /tmp/ArduinoCerts2020.p12"
149
157
150
158
strategy :
151
159
fail-fast : false # if one os is failing continue nonetheless
152
- matrix :
160
+ matrix : # used to generate installers for different OS and not for runs-on
153
161
operating-system : [ubuntu-latest, windows-latest, macOS-latest]
154
162
155
163
include :
@@ -176,15 +184,16 @@ jobs:
176
184
- name : Checkout
177
185
uses : actions/checkout@v2
178
186
with :
179
- repository : ' bcmi-labs/arduino-create-agent-installer'
180
- token : ${{ secrets.PAT_TEMP }} # use token organization instead
187
+ repository : ' bcmi-labs/arduino-create-agent-installer' # the repo which contains install.xml
188
+ token : ${{ secrets.PAT_TEMP }} # TODO use token organization instead
181
189
182
- - name : Download artifacts
190
+ - name : Download artifact
183
191
uses : actions/download-artifact@v2
184
192
with :
185
193
name : arduino-create-agent-${{ matrix.operating-system }}
186
- path : ${{ matrix.executable-path }}
194
+ path : ${{ matrix.executable-path }} # path expected by installbuilder
187
195
196
+ # zip artifacts do not mantain executable permission
188
197
- name : Make executable
189
198
run : chmod -v +x ${{ matrix.executable-path }}arduino-create-agent*
190
199
if : matrix.operating-system == 'ubuntu-latest' || matrix.operating-system == 'macOS-latest'
@@ -236,25 +245,24 @@ jobs:
236
245
path : ArduinoCreateAgent*
237
246
if-no-files-found : error
238
247
248
+ # This job will sign and notarize mac installers
239
249
code-sign-mac-installers :
240
250
needs : package
241
251
runs-on : macOS-latest
242
- env :
243
- INSTALLER_CERT_MAC_PASSWORD : ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
244
- INSTALLER_CERT_MAC_P12 : " /tmp/ArduinoCerts2020.p12"
245
252
246
253
strategy :
247
254
matrix :
248
255
browser : [safari, firefox, chrome]
249
256
250
257
steps :
251
258
252
- - name : Download artifacts
259
+ - name : Download artifact
253
260
uses : actions/download-artifact@v2
254
261
with :
255
262
name : ArduinoCreateAgent-osx
256
263
path : ArduinoCreateAgent-osx
257
264
265
+ # zip artifacts do not mantain executable permission
258
266
- name : Make executable
259
267
run : chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app/Contents/MacOS/*
260
268
@@ -272,7 +280,7 @@ jobs:
272
280
brew install mitchellh/gon/gon
273
281
274
282
- name : Write gon config to file
275
- # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
283
+ # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
276
284
run : |
277
285
cat > gon.config_installer.hcl <<EOF
278
286
source = ["ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"]
@@ -289,13 +297,14 @@ jobs:
289
297
EOF
290
298
291
299
- name : Code sign and notarize app
292
- run : |
293
- echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"
294
- gon -log-level=debug -log-json gon.config_installer.hcl
295
300
env :
296
301
AC_USERNAME : ${{ secrets.AC_USERNAME }}
297
302
AC_PASSWORD : ${{ secrets.AC_PASSWORD }}
303
+ run : |
304
+ echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"
305
+ gon -log-level=debug -log-json gon.config_installer.hcl
298
306
307
+ # tar dmg file to keep executable permission
299
308
- name : Tar files to keep permissions
300
309
run : tar -cvf ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.tar ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.dmg
301
310
0 commit comments