Skip to content

Commit

Permalink
Add macos-arm64 to the test builds
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoPologruto committed Jun 17, 2024
1 parent b77232f commit f5f10a1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/publish-go-tester-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
repository_dispatch:

env:
PROJECT_NAME: arduino-create-agent
GO_VERSION: "1.21"

jobs:
Expand Down Expand Up @@ -119,18 +120,38 @@ jobs:
run: task go:build-win # GOARCH=amd64 by default on the runners
if: runner.os == 'Windows' && matrix.arch == '-amd64'

- name: Build the Agent for macos
- name: Build the Agent for macos amd 64
env:
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
CGO_CFLAGS: -mmacosx-version-min=10.15
CGO_LDFLAGS: -mmacosx-version-min=10.15
run: task go:build
run: |
task go:build
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME}}_amd64
if: runner.os == 'macOS'

- name: Build the Agent for macos amd 64
env:
MACOSX_DEPLOYMENT_TARGET: 10.15 # minimum supported version for mac
CGO_CFLAGS: -mmacosx-version-min=10.15
CGO_LDFLAGS: -mmacosx-version-min=10.15
GOARCH: arm64
CGO_ENABLED: 1
run: |
task go:build
mv ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME}}_arm64
if: runner.os == 'macOS'

- name: Create universal macos executable
run: |
lipo -create -output ${{ env.PROJECT_NAME }} ${{ env.PROJECT_NAME}}_amd64 ${{ env.PROJECT_NAME}}_arm64
rm ${{ env.PROJECT_NAME}}_amd64 ${{ env.PROJECT_NAME}}_arm64
if: runner.os == 'macOS'

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
name: ${{ env.PROJECT_NAME}}-${{ matrix.os }}${{ matrix.arch }}
path: |
arduino-create-agent*
${{ env.PROJECT_NAME}}*
if-no-files-found: error
3 changes: 1 addition & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ tasks:
cmds:
- poetry run pytest tests

# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
poetry:install-deps:
desc: Install dependencies managed by Poetry
cmds:
Expand Down Expand Up @@ -138,7 +138,6 @@ tasks:
- task: go:vet
- task: go:lint


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

0 comments on commit f5f10a1

Please sign in to comment.