From a697df6318e1f28f522a53d355616a1ca0f5d244 Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Wed, 6 Nov 2024 12:51:55 +0100 Subject: [PATCH 1/2] Fix compile --- DistTasks.yml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/DistTasks.yml b/DistTasks.yml index b762338..eccd14a 100644 --- a/DistTasks.yml +++ b/DistTasks.yml @@ -35,6 +35,7 @@ tasks: - task: Linux_ARMv7 - task: Linux_ARM64 - task: macOS_64bit + - task: macOS_ARM64 Windows_32bit: desc: Builds Windows 32 bit binaries @@ -168,7 +169,7 @@ tasks: vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_6" - BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" + BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} -buildvcs=false" BUILD_PLATFORM: "linux/armv6" CONTAINER_TAG: "{{.GO_VERSION}}-armel-debian12" PACKAGE_PLATFORM: "Linux_ARMv6" @@ -197,7 +198,7 @@ tasks: PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" macOS_64bit: - desc: Builds Mac OS X 64 bit binaries + desc: Builds Mac OS X x86_64 bit binaries dir: "{{.DIST_DIR}}" cmds: - | @@ -212,7 +213,7 @@ tasks: vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_amd64" - BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}}" + BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} -buildvcs=false" BUILD_PLATFORM: "darwin/amd64" # We are experiencing the following error with macOS_64bit build: # @@ -227,6 +228,28 @@ tasks: # # To compile it we need an SDK >=10.12 so we use the debian10 based container that # has the SDK 10.14 installed. - CONTAINER_TAG: "{{.GO_VERSION}}-darwin" + CONTAINER_TAG: "{{.GO_VERSION}}-darwin-debian10" PACKAGE_PLATFORM: "macOS_64bit" PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" + + macOS_ARM64: + desc: Builds Mac OS X ARM64 binaries + dir: "{{.DIST_DIR}}" + cmds: + - | + docker run -v `pwd`/..:/home/build -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" + + tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + sha256sum {{.PACKAGE_NAME}} >> {{.CHECKSUM_FILE}} + + vars: + PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64" + BUILD_COMMAND: "go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} -buildvcs=false" + BUILD_PLATFORM: "darwin/arm64" + CONTAINER_TAG: "{{.GO_VERSION}}-darwin-arm64-debian10" + PACKAGE_PLATFORM: "macOS_ARM64" + PACKAGE_NAME: "{{.PROJECT_NAME}}_{{.VERSION}}_{{.PACKAGE_PLATFORM}}.tar.gz" From d03530cc86632acc65952e836d5851e443d253bb Mon Sep 17 00:00:00 2001 From: Marco Colombo Date: Wed, 6 Nov 2024 13:04:35 +0100 Subject: [PATCH 2/2] Fixed mac notarize --- .github/workflows/release-go-task.yml | 32 +++++++++++++++++---------- gon.config.hcl | 2 +- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release-go-task.yml b/.github/workflows/release-go-task.yml index 57c1e88..05c92d3 100644 --- a/.github/workflows/release-go-task.yml +++ b/.github/workflows/release-go-task.yml @@ -99,7 +99,7 @@ jobs: run: | gon gon.config.hcl - - name: Re-package binary and update checksum + - name: Re-package amd64 binary and update checksum # This step performs the following: # 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file) # 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file @@ -118,6 +118,25 @@ jobs: -e "s/.*${{ env.PROJECT_NAME }}_${TAG}_macOS_64bit.tar.gz/${CHECKSUM} ${{ env.PROJECT_NAME }}_${TAG}_macOS_64bit.tar.gz/g;" \ ${{ env.DIST_DIR }}/*-checksums.txt + - name: Re-package ARM64 binary and update checksum + # This step performs the following: + # 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file) + # 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file + run: | + # GitHub's upload/download-artifact@v4 actions don't preserve file permissions, + # so we need to add execution permission back until the action is made to do this. + chmod +x ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_arm64/${{ env.PROJECT_NAME }} + TAG="${GITHUB_REF/refs\/tags\//}" + tar -czvf "${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_${TAG}_macOS_ARM64.tar.gz" \ + -C ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_osx_darwin_arm64/ ${{ env.PROJECT_NAME }} \ + -C ../../ LICENSE.txt + CHECKSUM="$(shasum -a 256 ${{ env.DIST_DIR }}/${{ env.PROJECT_NAME }}_${TAG}_macOS_ARM64.tar.gz | cut -d " " -f 1)" + perl \ + -pi \ + -w \ + -e "s/.*${{ env.PROJECT_NAME }}_${TAG}_macOS_ARM64.tar.gz/${CHECKSUM} ${{ env.PROJECT_NAME }}_${TAG}_macOS_ARM64.tar.gz/g;" \ + ${{ env.DIST_DIR }}/*-checksums.txt + - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -156,14 +175,3 @@ jobs: # NOTE: "Artifact is a directory" warnings are expected and don't indicate a problem # (all the files we need are in the DIST_DIR root) artifacts: ${{ env.DIST_DIR }}/* - - # TODO - # - name: Upload release files on Arduino downloads servers - # uses: docker://plugins/s3 - # env: - # PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*" - # PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }} - # PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/" - # PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/gon.config.hcl b/gon.config.hcl index f32ba1e..4a4eefd 100644 --- a/gon.config.hcl +++ b/gon.config.hcl @@ -1,6 +1,6 @@ # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/general/gon.config.hcl # See: https://github.com/Bearer/gon#configuration-file -source = ["dist/arduino-cloud-cli_osx_darwin_amd64/arduino-cloud-cli"] +source = ["dist/arduino-cloud-cli_osx_darwin_amd64/arduino-cloud-cli", "dist/arduino-cloud-cli_osx_darwin_arm64/arduino-cloud-cli"] bundle_id = "cc.arduino.arduino-cloud-cli" sign {