Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented May 20, 2025

Changelog

Developers developing on Apple silicon can now upgrade to a native build supporting the arm64 architecture. Installing an installation with the install script will also detect the matching build to use.

Summary

This PR builds darwin universal binaries along with specific builds for both amd64 and now arm64! 🍎 ✨

Reviewers

Check the installation scripts installs:

$ ./scripts/install.sh -v 3.2.0 lack-dev  # Confirm the current release installs
$ ./scripts/install.sh -v 3.3.0 lack-dev  # Confirm the next version is attempted
...
https://downloads.slack-edge.com/slack-cli/slack_cli_3.3.0_macOS_arm64.tar.gz
#=O#-  #    #
curl: (22) The requested URL returned error: 403

Confirm automatic upgrades update:

$ go build -ldflags="-s -w -X 'github.com/slackapi/slack-cli/internal/pkg/version.Version=v3.0.0'" -o bin/slack
$ lack version
Using lack v3.0.0
$ lack upgrade
...
Architecture: arm64
OS: darwin
Downloading slack_cli_3.1.0_macOS_arm64.zip
Downloading cli from https://downloads.slack-edge.com/slack-cli/slack_cli_3.1.0_macOS_arm64.zip

Please note "arm64" might be "amd64" for some setups. An apple computer is required too to test this 👾

Notes

  • Universal binaries are installed as macOS_64-bit for backwards compatibilities with improved support. Rosetta is no long required.
  • The previous macOS_64-bit installation is moved to macOS_amd64.
  • A new packaging for the M-series now exists as macOS_arm64!

Requirements

@zimeg zimeg added this to the Next Release milestone May 20, 2025
@zimeg zimeg self-assigned this May 20, 2025
@zimeg zimeg added enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment build M-T: Changes to compilation and CI processes labels May 20, 2025
@codecov
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.40%. Comparing base (855440a) to head (56f6d72).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/update/cli_autoupdate.go 83.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #101      +/-   ##
==========================================
+ Coverage   63.31%   63.40%   +0.09%     
==========================================
  Files         211      211              
  Lines       22282    22284       +2     
==========================================
+ Hits        14107    14130      +23     
+ Misses       7086     7067      -19     
+ Partials     1089     1087       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zimeg zimeg marked this pull request as ready for review May 20, 2025 06:47
@zimeg zimeg requested a review from a team as a code owner May 20, 2025 06:47
Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💌 For the kind reviewer reviewing, I left a few notes on what's happening in these changes!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ AFAICT we are not using this file and it is almost identical to the production .goreleaser.yml - the one difference is an included LICENSE in production.

post: |-
sh -c '
zip ./dist/slack_cli_{{.Env.BUILD_VERSION}}_macOS_64-bit.zip ./dist/slack-macos_darwin_amd64_v1/bin/slack -j
zip ./dist/slack_cli_{{ .Env.BUILD_VERSION }}_macOS_{{ .Arch }}.zip ./dist/slack-macos_{{ .Target }}/bin/slack -j
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Here we zip the architecture specific files:

  • ./dist/slack_cli_3.4.5_macOS_amd64.zip
  • ./dist/slack_cli_3.4.5_macOS_arm64.zip

Comment on lines +51 to +59
universal_binaries:
- id: slack-macos
name_template: bin/slack
replace: false
hooks:
post: |-
sh -c '
zip ./dist/slack_cli_{{.Env.BUILD_VERSION}}_macOS_64-bit.zip ./dist/slack-macos_darwin_all/bin/slack -j
'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 https://goreleaser.com/customization/universalbinaries/

The name_template is used to match packaging paths in tarballs later!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

universal_binaries support is such a great discovery! Thank you @zimeg and GoReleaser!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must give so much credit to the great folks at @goreleaser 🙏 ✨

Comment on lines +122 to +136
if version_lt "$SLACK_CLI_DEV_VERSION" "3.3.0"; then
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_64-bit.tar.gz"
else
case "$(uname -m)" in
x86_64)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_amd64.tar.gz"
;;
arm64 | aarch64)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_arm64.tar.gz"
;;
*)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_64-bit.tar.gz"
;;
esac
fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📣 We're guarding against specific installations of versions prior to next release here!

This adds some overhead to this script, but I don't think backporting releases can be done without so much effort and potential error otherwise...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this is a clean way to do it and doesn't add very much overhead. Nice work!

Copy link
Member

@mwbrooks mwbrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Amazing work! I expected this to be a challenge to be compatible with slack upgrade and your work makes it look like a breeze. 😎

🧪 Manual testing is good on my side. I've tested it on a Macbook Intel (amd64).

Install Script correctly detects amd64 on my Macbook Intel:
image

Upgrade command correctly detect amd64 on my Macbook Intel:
image

❓ Do we need to update our .circleci/config.yml to upload the new binaries to be Code Signed and uploaded to the GitHub Release and S3 Bucket?

❓ In terms of release rollout, my understanding is that we will wait until the future release (after tomorrow's release). We need the CI/CD to build and upload the new binaries before we can upload the new install scripts (although, your check for <= v3.3.0 may allow us to safely upload it sooner).

updates in the following files on occasion:

- `.circleci/config.yml`
- `.goreleaser-dev.yml`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋🏻 Bye!

Comment on lines +51 to +59
universal_binaries:
- id: slack-macos
name_template: bin/slack
replace: false
hooks:
post: |-
sh -c '
zip ./dist/slack_cli_{{.Env.BUILD_VERSION}}_macOS_64-bit.zip ./dist/slack-macos_darwin_all/bin/slack -j
'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

universal_binaries support is such a great discovery! Thank you @zimeg and GoReleaser!

Comment on lines +257 to +264
switch architecture {
case "amd64":
filename = fmt.Sprintf("slack_cli_%s_macOS_amd64.zip", version)
case "arm64":
filename = fmt.Sprintf("slack_cli_%s_macOS_arm64.zip", version)
default:
filename = fmt.Sprintf("slack_cli_%s_macOS_64-bit.zip", version)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: so nice! 👌🏻

Comment on lines +122 to +136
if version_lt "$SLACK_CLI_DEV_VERSION" "3.3.0"; then
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_64-bit.tar.gz"
else
case "$(uname -m)" in
x86_64)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_amd64.tar.gz"
;;
arm64 | aarch64)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_arm64.tar.gz"
;;
*)
slack_cli_url="https://downloads.slack-edge.com/slack-cli/slack_cli_${SLACK_CLI_DEV_VERSION}_macOS_64-bit.tar.gz"
;;
esac
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this is a clean way to do it and doesn't add very much overhead. Nice work!

@mwbrooks
Copy link
Member

@zimeg I think we should add a changelog label and maybe update the title to something more straight forward like "build: support Apple Silicon ARM64 and macOS Intel AMD64" (you probably have a better phrase)

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwbrooks Thank you for the fast review and testing! It's exciting to soon ship this 🍎 ✨

Do we need to update our .circleci/config.yml to upload the new binaries to be Code Signed and uploaded to the GitHub Release and S3 Bucket?

Thanks a ton for calling this out! I found the release on GitHub upload as expected with a perhaps deceiving wildcard:

- s3-upload:
<<: *filters-tag-triggered-workflow-job
name: upload-to-s3-for-autoupdate-zip
s3-target-path: cli
file-name: "slack_cli_*.zip"
requires:
- create-github-release-and-artifacts
context: slack-cli-release

assets

But I am not certain that this carries to the S3 uploads - I'll follow up with a the changes we might need for this soon 🔍

We need the CI/CD to build and upload the new binaries before we can upload the new install scripts (although, your check for <= v3.3.0 may allow us to safely upload it sooner).

I believe the installation script can be uploaded whenever too, but we will want to make sure binaries are uploaded before updating the upstream metadata.json with the latest version. Otherwise those darned 403 might appear.

FWIW I'm thinking we might want to attempt a release candidate before tagging an official release, but I'm also hoping the changes soon to CircleCI bring us enough confidence otherwise..

I think we should add a changelog label and maybe update the title to something more straight forward

Thanks for keeping the kind developers in mind as always - will do! 👾

Comment on lines +51 to +59
universal_binaries:
- id: slack-macos
name_template: bin/slack
replace: false
hooks:
post: |-
sh -c '
zip ./dist/slack_cli_{{.Env.BUILD_VERSION}}_macOS_64-bit.zip ./dist/slack-macos_darwin_all/bin/slack -j
'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must give so much credit to the great folks at @goreleaser 🙏 ✨

@zimeg zimeg added the changelog Use on updates to be included in the release notes label May 22, 2025
@zimeg zimeg changed the title build: install darwin universal binaries separate from arch specific builds build: package for apple intel and apple silicon machines alongside universal binaries as fallback May 22, 2025
@mwbrooks
Copy link
Member

But I am not certain that this carries to the S3 uploads - I'll follow up with a the changes we might need for this soon 🔍

That's awesome about GitHub. I saw that same wildcard and (to me) it looks like it will upload to both GitHub Releases and S3.

@zimeg
Copy link
Member Author

zimeg commented May 23, 2025

@mwbrooks Lots of awesomeness happening in these changes I felt! Thanks for thinking ahead to the next production release in this review 🤖 ✨

assets

Before merging I will list the now expected files in a release for future reference:

  • slack_cli_3.4.5-branch-6-badaabad_linux_64-bit.tar.gz
  • slack_cli_3.4.5-branch-6-badaabad_macos.zip: Universal binaries for the earliest upgrades
  • slack_cli_3.4.5-branch-6-badaabad_macOS_64-bit.tar.gz: Universal binaries for installation
  • slack_cli_3.4.5-branch-6-badaabad_macOS_64-bit.zip: Universal binaries for upgrades
  • slack_cli_3.4.5-branch-6-badaabad_macOS_amd64.tar.gz
  • slack_cli_3.4.5-branch-6-badaabad_macOS_amd64.zip
  • slack_cli_3.4.5-branch-6-badaabad_macOS_arm64.tar.gz
  • slack_cli_3.4.5-branch-6-badaabad_macOS_arm64.zip
  • slack_cli_3.4.5-branch-6-badaabad_windows_64-bit.tar.gz
  • slack_cli_dev_linux_64-bit.tar.gz
  • slack_cli_dev_macOS_64-bit.tar.gz: Universal binaries
  • slack_cli_latest_linux_64-bit.tar.gz
  • slack_cli_latest_macOS_64-bit.tar.gz: Universal binaries

A changelog note was added to the top of this PR and I'm feeling confident in these builds so let's merge this to let tests run before the next tagged version!

@zimeg zimeg merged commit 56d8c20 into main May 23, 2025
6 checks passed
@zimeg zimeg deleted the zimeg-build-darwin-arm64 branch May 23, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build M-T: Changes to compilation and CI processes changelog Use on updates to be included in the release notes enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants