Skip to content

Commit 596bbbe

Browse files
Build the Agent for macOS arm64
1 parent 6220828 commit 596bbbe

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

.github/workflows/release.yml

+23-18
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
ext: ".exe"
4141
- os: windows-2019
4242
ext: ".exe"
43+
- os: macos-12
44+
arch: arm64
4345

4446
defaults:
4547
run:
@@ -107,32 +109,35 @@ jobs:
107109
run: task go:build-win # GOARCH=amd64 by default on the runners
108110
if: matrix.os == 'windows-2019' && matrix.arch == 'amd64'
109111

110-
- name: Build the Agent for macos
112+
- name: Build the Agent for macos amd64
111113
env:
112114
CGO_ENABLED: 1
113115
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
114116
CGO_CFLAGS: -mmacosx-version-min=10.15
115117
CGO_LDFLAGS: -mmacosx-version-min=10.15
118+
GOOS: "darwin"
119+
GOARCH: "amd64"
116120
run: task go:build
117-
if: matrix.os == 'macos-12'
121+
if: matrix.os == 'macos-12' && matrix.arch == 'amd64'
122+
123+
- name: Build the Agent for macos arm64
124+
env:
125+
CGO_ENABLED: 1
126+
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
127+
CGO_CFLAGS: -mmacosx-version-min=10.15
128+
CGO_LDFLAGS: -mmacosx-version-min=10.15
129+
run: task go:build-macos-arm
130+
if: matrix.os == 'macos-12' && matrix.arch == 'arm64'
118131

119132
# this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
120133
- name: Create autoupdate files
121134
run: go-selfupdate ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION}
122135
if: matrix.arch != '386' && steps.prerelease.outputs.IS_PRE != 'true'
123136

124-
# for now we do not distribute m1 build, this is a workaround for now
125-
- name: Copy autoupdate file for darwin-arm64 (m1 arch)
126-
working-directory: public/
127-
run: |
128-
cp darwin-amd64.json darwin-arm64.json
129-
cp ${TAG_VERSION}/darwin-amd64.gz ${TAG_VERSION}/darwin-arm64.gz
130-
if: matrix.os == 'macos-12' && steps.prerelease.outputs.IS_PRE != 'true'
131-
132137
- name: Create autoupdate files for win32
133138
run: go-selfupdate -platform windows-${{ matrix.arch }} ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION}
134139
if: matrix.arch == '386' && matrix.os == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true'
135-
140+
136141
- name: configure aws credentials
137142
uses: aws-actions/configure-aws-credentials@v4
138143
with:
@@ -176,7 +181,7 @@ jobs:
176181
- name: Download artifact
177182
uses: actions/download-artifact@v4
178183
with:
179-
name: ${{ env.PROJECT_NAME }}-macos-12-amd64 # if we want to support darwin-arm64 in the future for real this has to change.
184+
name: ${{ env.PROJECT_NAME }}-macos-12-${{ matrix.arch }}
180185
path: ${{ env.EXE_PATH }}
181186

182187
- name: Remove placeholder file
@@ -311,7 +316,7 @@ jobs:
311316
run: |
312317
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
313318
unzip gon_macos.zip -d /usr/local/bin
314-
319+
315320
- name: Write gon config to file
316321
run: |
317322
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
@@ -323,7 +328,7 @@ jobs:
323328
}
324329
325330
EOF
326-
331+
327332
- name: Notarize app bundle
328333
run: |
329334
gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
@@ -449,17 +454,17 @@ jobs:
449454
# We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
450455
# Keep in mind that this path could change when upgrading to a new runner version
451456
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
452-
457+
453458
strategy:
454459
matrix:
455460
arch: [amd64, 386]
456-
461+
457462
steps:
458463
- name: Download artifact
459464
uses: actions/download-artifact@v4
460465
with:
461466
name: ArduinoCreateAgent-windows-${{ matrix.arch }}
462-
467+
463468
- name: Save Win signing certificate to file
464469
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER}}
465470

@@ -468,7 +473,7 @@ jobs:
468473
CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
469474
CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
470475
# https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
471-
run: |
476+
run: |
472477
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino Create Agent" -f ${{ env.INSTALLER_CERT_WINDOWS_CER}} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "ArduinoCreateAgent-${GITHUB_REF##*/}-windows-${{ matrix.arch }}-installer.exe"
473478
474479
- name: Upload artifacts

Taskfile.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ tasks:
3232
cmds:
3333
- go build -v {{.ADDITIONAL_FLAGS}} -o {{.PROJECT_NAME}} {{.LDFLAGS}} {{.WIN_FLAGS}}'
3434

35+
go:build-macos-arm:
36+
desc: Build the project for win, to build 32bit `export GOARCH=386` and for 64 bit `export GOARCH=amd64` before `task build-win`
37+
env:
38+
GOOS: "darwin"
39+
GOARCH: "arm64"
40+
cmds:
41+
- task: go:build
42+
vars:
43+
PROJECT_NAME: arduino-create-agent_arm64
44+
3545
go:build-cli:
3646
desc: Build the project without tray icon support
3747
cmds:
@@ -84,7 +94,7 @@ tasks:
8494
cmds:
8595
- poetry run pytest tests
8696

87-
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
97+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
8898
poetry:install-deps:
8999
desc: Install dependencies managed by Poetry
90100
cmds:
@@ -138,7 +148,6 @@ tasks:
138148
- task: go:vet
139149
- task: go:lint
140150

141-
142151
vars:
143152
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/release-go-task/Taskfile.yml
144153
PROJECT_NAME: arduino-create-agent

0 commit comments

Comments
 (0)