forked from runfinch/finch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add release-homebrew workflow (runfinch#202)
Signed-off-by: Anqi Pang <anqipans@amazon.com> Issue #, if available: *Description of changes:* *Testing done:* Tested on self-hosted runners except PR to homebrew. - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Signed-off-by: Anqi Pang <anqipans@amazon.com>
- Loading branch information
Showing
2 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
# "release" runner tag is to make target hosts deterministic for easy clean up. | ||
# TODO: Remove the "release" runner tag when installer tests are stable. | ||
name: Release Homebrew | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
get-latest-tag: | ||
name: Get the latest release tag | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.latesttag.outputs.tag }} | ||
version: ${{ steps.latestversion.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: 'Get the latest tag' | ||
id: latesttag | ||
uses: "WyriHaximus/github-action-get-previous-tag@v1" | ||
- name: 'Convert tag to version' | ||
id: latestversion | ||
run: | | ||
version=${{ steps.latesttag.outputs.tag }} | ||
if [ -z $version ]; then | ||
echo ERROR: Failed to get the latest tag | ||
exit 1 | ||
fi | ||
if [[ $version == v* ]]; then | ||
version="${version:1}" | ||
fi | ||
echo "version=$version" >> ${GITHUB_OUTPUT} | ||
# TODO: fix the arm64 test installer. | ||
# Currently the first time of calling any Finch command in arm64 hosts triggered by Github action will fail by | ||
# the error "Error: Process completed with exit code 137." So the arm64 job will fail. | ||
# We temporarily use follow-up manual steps to complete and clean up it. | ||
macos-arm64-test-installer: | ||
needs: get-latest-tag | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
[ | ||
[self-hosted, macos, arm64, 11.7, release], | ||
[self-hosted, macos, arm64, 12.6, release], | ||
[self-hosted, macos, arm64, 13.0, release], | ||
] | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
env: | ||
FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }} | ||
FINCH_VESRION: ${{ needs.get-latest-tag.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.FINCH_TAG }} | ||
- name: Clean up previous files | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew uninstall --cask ./Casks/finch.rb || true | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
- name: Bump local cask version | ||
run: | | ||
brew update-reset | ||
cd $(brew --repo homebrew/cask) | ||
echo "Update the local Finch cask with version ${FINCH_VERSION}" | ||
brew bump-cask-pr --write-only -f --version=${FINCH_VERSION} finch | ||
- name: Silently install | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew install --cask ./Casks/finch.rb | ||
- name: Run e2e tests | ||
run: INSTALLED=true make test-e2e | ||
- name: Silently uninstall | ||
if: ${{ always() }} | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew uninstall --cask ./Casks/finch.rb | ||
if [ -d "/Applications/Finch" ]; then | ||
echo ERROR: Finch is not uninstalled | ||
exit 1 | ||
fi | ||
macos-amd64-test-installer: | ||
needs: get-latest-tag | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
[ | ||
[self-hosted, macos, amd64, 10.15, release], | ||
[self-hosted, macos, amd64, 11.7, release], | ||
[self-hosted, macos, amd64, 12.6, release], | ||
[self-hosted, macos, amd64, 13.0, release], | ||
] | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
env: | ||
FINCH_TAG: ${{ needs.get-latest-tag.outputs.tag }} | ||
FINCH_VESRION: ${{ needs.get-latest-tag.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.FINCH_TAG }} | ||
- name: Clean up previous files | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew uninstall --cask ./Casks/finch.rb || true | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
- name: Bump local cask version | ||
run: | | ||
brew update-reset | ||
cd $(brew --repo homebrew/cask) | ||
echo "Update the local Finch cask with version ${FINCH_VERSION}" | ||
brew bump-cask-pr --write-only -f --version=${FINCH_VERSION} finch | ||
- name: Silently install | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew install --cask ./Casks/finch.rb | ||
- name: Run e2e tests | ||
run: INSTALLED=true make test-e2e | ||
- name: Silently uninstall | ||
if: ${{ always() }} | ||
run: | | ||
cd $(brew --repo homebrew/cask) | ||
brew uninstall --cask ./Casks/finch.rb | ||
if [ -d "/Applications/Finch" ]; then | ||
echo ERROR: Finch is not uninstalled | ||
exit 1 | ||
fi | ||
pr-to-homebrew: | ||
needs: [macos-arm64-test-installer, macos-amd64-test-installer] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Homebrew | ||
id: set-up-homebrew | ||
uses: Homebrew/actions/setup-homebrew@master | ||
- name: Open a pull request to homebrwe-cask | ||
run: brew bump-cask-pr --version=${FINCH_VERSION} finch | ||
env: | ||
FINCH_VERSION: ${{ needs.get-latest-tag.outputs.version }} | ||
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.FINCH_BOT_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters