Skip to content

Commit e6dc18d

Browse files
authored
CI polishing, add win64, update macOS min version (#578)
* uniform `test.yml` to `release.yml` * added again #561 for testing purposes * add win64 build in and refactor taskfile * change min supported macOS version to 10.11 (also go 1.14) * hard-code gon config in a step for uniformity and ease * refactor and optimize Taskfile (✨) change also workflows accordingly * add another win CI matrix to build win 32-64 * add win 32/64 to all the jobs in the release workflow & optimizations 🧙🏻
1 parent 774959c commit e6dc18d

File tree

3 files changed

+114
-76
lines changed

3 files changed

+114
-76
lines changed

Diff for: .github/workflows/release.yml

+55-27
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
operating-system: [ubuntu-18.04, windows-2019, macos-10.15]
13+
include:
14+
- operating-system: ubuntu-18.04
15+
- operating-system: windows-2019
16+
arch: -386
17+
- operating-system: windows-2019
18+
arch: -amd64
19+
- operating-system: macos-10.15
1420

1521
runs-on: ${{ matrix.operating-system }}
22+
env:
23+
TAG_VERSION: ${GITHUB_REF##*/} # will be available to all steps and will be used by task build
1624

1725
steps:
1826
- name: Disable EOL conversions
@@ -24,7 +32,7 @@ jobs:
2432
- name: Install Go
2533
uses: actions/setup-go@v2
2634
with:
27-
go-version: "1.15"
35+
go-version: "1.14"
2836

2937
# dependencies used for compiling the GUI
3038
- name: Install Dependencies (Linux)
@@ -53,7 +61,7 @@ jobs:
5361
run: task test-unit
5462

5563
- name: Build the Agent for linux
56-
run: task build
64+
run: task build
5765
if: matrix.operating-system == 'ubuntu-18.04'
5866

5967
# build the agent without GUI support (no tray icon)
@@ -62,32 +70,36 @@ jobs:
6270
if: matrix.operating-system == 'ubuntu-18.04'
6371

6472
# 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)
65-
# rsrc will produce *.syso files that should get automatically recognized by go build command and linked into an executable.
66-
- name: Embed manifest in win binary
67-
run: |
68-
go get github.com/akavel/rsrc
69-
rsrc -arch 386 -manifest manifest.xml
73+
# rsrc will produce a *.syso file that should get automatically recognized by go build command and linked into an executable.
74+
- name: Download tool to embed manifest in win binary
75+
run: go get github.com/akavel/rsrc
7076
if: matrix.operating-system == 'windows-2019'
7177

7278
# building the agent for win requires a different task because of an extra flag
7379
- name: Build the Agent for win32
7480
env:
7581
GOARCH: 386 # 32bit architecture (for support)
7682
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)
77-
run: task build-win32
78-
if: matrix.operating-system == 'windows-2019'
83+
run: task build-win
84+
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386'
85+
86+
- name: Build the Agent for win64
87+
run: task build-win # GOARCH=amd64 by default on the runners
88+
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-amd64'
7989

8090
- name: Build the Agent for macos
8191
env:
82-
MACOSX_DEPLOYMENT_TARGET: 10.9 # minimum supported version for mac
92+
MACOSX_DEPLOYMENT_TARGET: 10.11 # minimum supported version for mac
93+
CGO_CFLAGS: -mmacosx-version-min=10.11
94+
CGO_LDFLAGS: -mmacosx-version-min=10.11
8395
run: task build
8496
if: matrix.operating-system == 'macos-10.15'
8597

8698
# config.ini is required by the executable when it's run
8799
- name: Upload artifacts
88100
uses: actions/upload-artifact@v2
89101
with:
90-
name: arduino-create-agent-${{ matrix.operating-system }}
102+
name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }}
91103
path: |
92104
arduino-create-agent*
93105
config.ini
@@ -101,12 +113,6 @@ jobs:
101113
RUNS_ON: macos-10.15 # used to parametrize filenames
102114

103115
steps:
104-
- name: Checkout
105-
uses: actions/checkout@v2
106-
with:
107-
repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains gon.config.hcl
108-
token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }}
109-
110116
- name: Download artifact
111117
uses: actions/download-artifact@v2
112118
with:
@@ -130,14 +136,29 @@ jobs:
130136
wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip
131137
unzip gon_macos.zip -d /usr/local/bin
132138
139+
- name: Write gon config to file
140+
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
141+
run: |
142+
cat > gon.config.hcl <<EOF
143+
source = ["arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent"]
144+
bundle_id = "cc.arduino.arduino-agent"
145+
sign {
146+
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
147+
}
148+
# Ask Gon for zip output to force notarization process to take place.
149+
# The CI will ignore the zip output, using the signed binary only.
150+
zip {
151+
output_path = "arduino-create-agent.zip"
152+
}
153+
EOF
154+
133155
- name: Code sign and notarize app
134156
env:
135157
AC_USERNAME: ${{ secrets.AC_USERNAME }}
136158
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
137159
run: |
160+
echo "gon will notarize executable in arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent"
138161
gon -log-level=debug -log-json gon.config.hcl
139-
# gon will notarize executable in "arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent
140-
# The CI will ignore the zip output, using the signed binary only.
141162
timeout-minutes: 30
142163

143164
# This step will overwrite the non signed mac artifact (arduino-create-agent-${{ env.RUNS_ON }})
@@ -171,13 +192,20 @@ jobs:
171192
strategy:
172193
fail-fast: false # if one os is failing continue nonetheless
173194
matrix: # used to generate installers for different OS and not for runs-on
174-
operating-system: [ubuntu-18.04, windows-2019, macos-10.15]
175195

176196
include:
177197
- operating-system: ubuntu-18.04
178198
install-builder-name: linux-x64
179199
executable-path: artifacts/linux-amd64/
180200
- operating-system: windows-2019
201+
arch: -386
202+
browser: edge
203+
install-builder-name: windows
204+
executable-path: artifacts/windows/
205+
extension: .exe
206+
installer-extension: .exe
207+
- operating-system: windows-2019
208+
arch: -amd64
181209
browser: edge
182210
install-builder-name: windows
183211
executable-path: artifacts/windows/
@@ -213,7 +241,7 @@ jobs:
213241
- name: Download artifact
214242
uses: actions/download-artifact@v2
215243
with:
216-
name: arduino-create-agent-${{ matrix.operating-system }}
244+
name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }}
217245
path: ${{ matrix.executable-path }} # path expected by installbuilder
218246

219247
# zip artifacts do not mantain executable permission
@@ -244,10 +272,10 @@ jobs:
244272
- name: Launch Bitrock installbuilder-20 with CERT_INSTALL && CHOICE_CERT_INSTALL
245273
run: |
246274
${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.install-builder-name }} --verbose --license /tmp/license.xml --setvars ${INSTALLER_VARS} ${{ env.CERT_INSTALL }}
247-
mv -v ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CI${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-${{matrix.browser}}${{matrix.installer-extension}}
275+
mv -v ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CI${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-${{matrix.browser}}${{matrix.installer-extension}}
248276
${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.install-builder-name }} --verbose --license /tmp/license.xml --setvars ${INSTALLER_VARS} ${{ env.CHOICE_CERT_INSTALL }}
249-
cp -vr ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-chrome${{matrix.installer-extension}}
250-
mv -v ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-firefox${{matrix.installer-extension}}
277+
cp -vr ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome${{matrix.installer-extension}}
278+
mv -v ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox${{matrix.installer-extension}}
251279
rm -r ArduinoCreateAgent-${VERSION%.*}-${{ matrix.install-builder-name }}-installer-C*
252280
if: matrix.operating-system == 'windows-2019' || matrix.operating-system == 'macos-10.15'
253281

@@ -264,7 +292,7 @@ jobs:
264292
- name: Upload artifacts
265293
uses: actions/upload-artifact@v2
266294
with:
267-
name: ArduinoCreateAgent-${{ matrix.install-builder-name }}
295+
name: ArduinoCreateAgent-${{ matrix.install-builder-name }}${{ matrix.arch }}
268296
path: ArduinoCreateAgent*
269297
if-no-files-found: error
270298

@@ -378,7 +406,7 @@ jobs:
378406
mv -v ArduinoCreateAgent-linux-x64/* release/
379407
cat ArduinoCreateAgent-osx/*.tar | tar -xvf - -i -C release/
380408
rm -v release/._ArduinoCreateAgent*.dmg
381-
mv -v ArduinoCreateAgent-windows/* release/
409+
mv -v ArduinoCreateAgent-windows*/* release/
382410
383411
- name: Create Github Release
384412
uses: actions/create-release@v1

Diff for: .github/workflows/test.yml

+37-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ jobs:
77
test-matrix:
88
strategy:
99
matrix:
10-
operating-system: [ubuntu-18.04, windows-2019, macos-10.15]
10+
include:
11+
- operating-system: ubuntu-18.04
12+
- operating-system: windows-2019
13+
arch: -386
14+
- operating-system: windows-2019
15+
arch: -amd64
16+
- operating-system: macos-10.15
1117

1218
runs-on: ${{ matrix.operating-system }}
1319

@@ -21,7 +27,7 @@ jobs:
2127
- name: Install Go
2228
uses: actions/setup-go@v2
2329
with:
24-
go-version: "1.15"
30+
go-version: "1.14"
2531

2632
# dependencies used for compiling the GUI
2733
- name: Install Dependencies (Linux)
@@ -49,27 +55,47 @@ jobs:
4955
- name: Run unit tests
5056
run: task test-unit
5157

52-
- name: Build the Agent
58+
- name: Build the Agent for linux
5359
run: task build
54-
if: matrix.operating-system != 'windows-2019'
60+
if: matrix.operating-system == 'ubuntu-18.04'
5561

5662
# build the agent without GUI support (no tray icon)
5763
- name: Build the Agent-cli
5864
run: task build-cli
5965
if: matrix.operating-system == 'ubuntu-18.04'
6066

6167
# 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)
62-
# rsrc will produce *.syso files that should get automatically recognized by go build command and linked into an executable.
63-
- name: Embed manifest in win binary
64-
run: |
65-
go get github.com/akavel/rsrc
66-
rsrc -arch 386 -manifest manifest.xml
68+
# rsrc will produce a *.syso file that should get automatically recognized by go build command and linked into an executable.
69+
- name: Download tool to embed manifest in win binary
70+
run: go get github.com/akavel/rsrc
6771
if: matrix.operating-system == 'windows-2019'
6872

6973
# building the agent for win requires a different task because of an extra flag
7074
- name: Build the Agent for win32
7175
env:
7276
GOARCH: 386 # 32bit architecture (for support)
7377
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)
74-
run: task build-win32
75-
if: matrix.operating-system == 'windows-2019'
78+
run: task build-win
79+
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386'
80+
81+
- name: Build the Agent for win64
82+
run: task build-win # GOARCH=amd64 by default on the runners
83+
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-amd64'
84+
85+
- name: Build the Agent for macos
86+
env:
87+
MACOSX_DEPLOYMENT_TARGET: 10.11 # minimum supported version for mac
88+
CGO_CFLAGS: -mmacosx-version-min=10.11
89+
CGO_LDFLAGS: -mmacosx-version-min=10.11
90+
run: task build
91+
if: matrix.operating-system == 'macos-10.15'
92+
93+
# config.ini is required by the executable when it's run
94+
- name: Upload artifacts
95+
uses: actions/upload-artifact@v2
96+
with:
97+
name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }}
98+
path: |
99+
arduino-create-agent*
100+
config.ini
101+
if-no-files-found: error

Diff for: Taskfile.yml

+22-38
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
version: "2"
1+
version: '3'
22

33
tasks:
44

55
build:
6-
desc: Build the project
6+
desc: Build the project, to use a specific version use `task build TAG_VERSION=x.x.x`
77
cmds:
8-
- go build -v -i {{.LDFLAGS}}
8+
- go build -v -i {{default "" .ADDITIONAL_FLAGS}} -o {{default "arduino-create-agent" .APP_NAME}} -ldflags '-X main.version={{default .TAG_TEST .TAG_VERSION}} -X main.git_revision={{.COMMIT}} {{default "" .WIN_FLAGS}}'
9+
vars:
10+
COMMIT:
11+
sh: git log -n 1 --format=%h
912

1013
build-cli:
1114
desc: Build the project without tray support
1215
cmds:
13-
- go build -v -i -tags cli -o {{.APP_NAME}}_cli {{.LDFLAGS}}
16+
- task: build
17+
vars:
18+
APP_NAME: arduino-create-agent_cli
19+
ADDITIONAL_FLAGS: -tags cli
1420

15-
build-win32:
16-
desc: Build the project for win 32 bit
21+
build-win:
22+
desc: Build the project for win, to build 32bit `export GOARCH=386` and for 64 bit `export GOARCH=amd64` before `task build-win`
1723
cmds:
18-
- go build -v -i {{.WIN_LDFLAGS}}
19-
20-
test:
21-
desc: Run the full testsuite, `legacy` will be skipped
22-
cmds:
23-
- task: test-unit
24+
- rsrc -arch {{.GOARCH}} -manifest manifest.xml # GOARCH shoud be either amd64 or 386
25+
- task: build
26+
vars:
27+
APP_NAME: arduino-create-agent.exe
28+
WIN_FLAGS: -H=windowsgui
29+
- rm *.syso # rm file to avoid compilation problems on other platforms
2430

2531
test-unit:
2632
desc: Run unit tests only
@@ -43,38 +49,16 @@ tasks:
4349
# - task: python:check
4450
# - task: docs:check
4551
# - task: config:check
46-
52+
4753
vars:
54+
TAG_TEST: "0.0.0-dev"
55+
GOARCH:
56+
sh: go env GOARCH
4857
# all modules of this project except for "gen/..." module
4958
DEFAULT_TARGETS:
5059
sh: echo `go list ./... | grep -v 'arduino-create-agent/gen/' | tr '\n' ' '`
51-
# build vars
52-
APP_NAME: arduino-create-agent
53-
WIN_FLAGS: -H=windowsgui
54-
COMMIT:
55-
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`}
56-
TAG:
57-
sh: echo `git describe --tags --abbrev=0`
58-
LDFLAGS: >
59-
-ldflags '-X main.version={{.TAG}}
60-
-X main.git_revision={{.COMMIT}}'
61-
WIN_LDFLAGS: >
62-
-ldflags '-X main.version={{.TAG}}
63-
-X main.git_revision={{.COMMIT}}
64-
{{.WIN_FLAGS}}'
65-
# test vars
6660
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
67-
TEST_VERSIONSTRING: "0.0.0-alpha"
68-
TEST_COMMIT: "deadbeef"
69-
TEST_LDFLAGS: >
70-
-ldflags '-X main.version={{.TEST_VERSIONSTRING}}
71-
-X main.git_revision={{.TEST_COMMIT}}'
7261
# check-lint vars
7362
GOLINTBIN:
7463
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint
7564
GOLINTFLAGS: "-min_confidence 0.8 -set_exit_status"
76-
# # docs versioning
77-
# DOCS_VERSION: dev
78-
# DOCS_ALIAS: ""
79-
# DOCS_REMOTE: "origin"
80-

0 commit comments

Comments
 (0)