Skip to content

Commit

Permalink
Build universal binary instead of architecture dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
amalchuk committed Jan 13, 2025
1 parent 94376ca commit afdf283
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
25 changes: 12 additions & 13 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ task:
- export PATH=$(pwd)/.build/arm64-apple-macosx/debug:$PATH
# Run integration tests
- cd integration-tests
- HOMEBREW_NO_AUTO_UPDATE=1 brew install virtualenv
- virtualenv venv
- python3 -m venv --symlinks venv
- source venv/bin/activate
- pip install -r requirements.txt
- pytest --verbose --junit-xml=pytest-junit.xml
Expand Down Expand Up @@ -48,18 +47,18 @@ task:

task:
only_if: $CIRRUS_TAG == ''
env:
matrix:
BUILD_ARCH: arm64
BUILD_ARCH: x86_64
name: Build ($BUILD_ARCH)
name: Build (universal)
alias: build
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sonoma
build_script: swift build --arch $BUILD_ARCH --product tart
sign_script: codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/$BUILD_ARCH-apple-macosx/debug/tart
build_script:
- swift build --arch arm64 --product tart
- swift build --arch x86_64 --product tart
- mkdir -p .build/universal
- lipo -create -output .build/universal/tart .build/arm64-apple-macosx/debug/tart .build/x86_64-apple-macosx/debug/tart
sign_script: codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/universal/tart
binary_artifacts:
path: .build/$BUILD_ARCH-apple-macosx/debug/tart
path: .build/universal/tart

task:
only_if: $CIRRUS_TAG == '' && ($CIRRUS_USER_PERMISSION == 'write' || $CIRRUS_USER_PERMISSION == 'admin')
Expand Down Expand Up @@ -121,7 +120,7 @@ task:
- security import certificate.p12 -k build.keychain -P password101 -T /usr/bin/codesign -T /usr/bin/pkgbuild
- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password101 build.keychain
- xcrun notarytool store-credentials "notarytool" --apple-id "[email protected]" --team-id "9M2P8L4D89" --password $AC_PASSWORD
install_script:
install_script:
- brew install go goreleaser/tap/goreleaser-pro getsentry/tools/sentry-cli
- brew install mitchellh/gon/gon
info_script:
Expand All @@ -130,7 +129,7 @@ task:
- swift -version
release_script: goreleaser
upload_sentry_debug_files_script:
- cd .build/arm64-apple-macosx/release/
- cd .build/universal/
# Generate and upload symbols
- dsymutil tart
- sentry-cli debug-files upload tart.dSYM/
Expand All @@ -153,7 +152,7 @@ task:
registry_config: ENCRYPTED[!cf1a0f25325aa75bad3ce6ebc890bc53eb0044c02efa70d8cefb83ba9766275a994b4831706c52630a0692b2fa9cfb9e!]
env:
DEPLOY_TOKEN: ENCRYPTED[!45ed45666558902ed1c2400add734ec063103bec31841847e8c8764802fca229bfa6d85c690e16ad159e047574b48793!]
deploy_script:
deploy_script:
- git config --global user.name "Cirrus CI"
- git config --global user.name "[email protected]"
- git remote set-url origin https://[email protected]/cirruslabs/tart/
Expand Down
13 changes: 8 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ project_name: tart
before:
hooks:
- .ci/set-version.sh
- swift build --arch x86_64 -c release --product tart
- swift build --arch arm64 -c release --product tart
# FIXME: Use a single build command after fix https://github.com/nicklockwood/SwiftFormat/issues/1645
# - swift build --arch arm64 --arch x86_64 --configuration release --product tart
- swift build --arch arm64 --configuration release --product tart
- swift build --arch x86_64 --configuration release --product tart
- mkdir -p .build/universal
- lipo -create -output .build/universal/tart .build/arm64-apple-macosx/release/tart .build/x86_64-apple-macosx/release/tart
- gon gon.hcl

builds:
Expand All @@ -15,13 +19,12 @@ builds:
- darwin
goarch:
- arm64
- amd64
binary: tart.app/Contents/MacOS/tart
prebuilt:
path: '.build/{{- if eq .Arch "arm64" }}arm64{{- else }}x86_64{{ end }}-apple-macosx/release/tart'
path: .build/universal/tart

archives:
- name_template: "{{ .ProjectName }}-{{ .Arch }}"
- name_template: "{{ .ProjectName }}-{{ .Version }}"
files:
- src: Resources/embedded.provisionprofile
dst: tart.app/Contents
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/nicklockwood/SwiftFormat",
"state" : {
"revision" : "ab6844edb79a7b88dc6320e6cee0a0db7674dac3",
"version" : "0.54.5"
"revision" : "4e92b81311f528cfdca8015d629c650d0aff94ce",
"version" : "0.55.4"
}
},
{
Expand Down
5 changes: 1 addition & 4 deletions gon.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
source = [
".build/x86_64-apple-macosx/release/tart",
".build/arm64-apple-macosx/release/tart"
]
source = [".build/universal/tart"]
bundle_id = "com.github.cirruslabs.tart"

apple_id {
Expand Down

0 comments on commit afdf283

Please sign in to comment.