Build bottle of shivammathur/extensions/[email protected] on macos-15 #2460
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
name: Dispatch build bottle | |
run-name: Build bottle of ${{ inputs.formula }} on ${{ inputs.runner }} | |
on: | |
workflow_dispatch: | |
inputs: | |
runner: | |
description: Build runner(s) (macOS version or Linux) | |
required: true | |
formula: | |
description: Formula name | |
required: true | |
timeout: | |
description: "Build timeout (in minutes, default: 180 minutes)" | |
default: "180" | |
required: false | |
issue: | |
description: Issue number, where comment on failure would be posted | |
required: false | |
upload: | |
description: "Upload built bottles? (default: false)" | |
type: boolean | |
default: false | |
required: false | |
env: | |
HOMEBREW_DEVELOPER: 1 | |
HOMEBREW_GITHUB_ACTIONS: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_INSTALL_FROM_API: 1 | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
outputs: | |
runners: ${{steps.runner-matrix.outputs.result}} | |
steps: | |
- name: Prepare runner matrix | |
id: runner-matrix | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const intelMacOSRegex = /^\d+(?:\.\d+)?$/; | |
const linuxRegex = /^(ubuntu-|linux-self-hosted-)/; | |
return context.payload.inputs.runner.split(",") | |
.map(s => s.trim()) | |
.filter(Boolean) | |
.map(s => { | |
if (linuxRegex.test(s)) | |
return { | |
runner: s, | |
container: { | |
image: "ghcr.io/homebrew/ubuntu22.04:master", | |
options: "--user=linuxbrew -e GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED" | |
}, | |
workdir: "/github/home", | |
cleanup: false | |
}; | |
else | |
return {runner: s, cleanup: true}; | |
}); | |
bottle: | |
needs: prepare | |
strategy: | |
matrix: | |
include: ${{fromJson(needs.prepare.outputs.runners)}} | |
runs-on: ${{matrix.runner}} | |
container: ${{matrix.container}} | |
timeout-minutes: ${{fromJson(github.event.inputs.timeout)}} | |
defaults: | |
run: | |
shell: /bin/bash -e {0} | |
working-directory: ${{matrix.workdir || github.workspace}} | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
BOTTLES_DIR: ${{ matrix.workdir || github.workspace }}/bottles | |
steps: | |
- name: ${{inputs.formula}} | |
id: print_details | |
run: | | |
echo sender='${{github.event.sender.login}}' | |
echo formula='${{inputs.formula}}' | |
echo runner='${{inputs.runner}}' | |
echo timeout='${{inputs.timeout}}' | |
echo issue='${{inputs.issue}}' | |
echo upload='${{inputs.upload}}' | |
- name: Pre-test steps | |
uses: Homebrew/actions/pre-build@master | |
with: | |
bottles-directory: ${{ env.BOTTLES_DIR }} | |
cleanup: ${{ matrix.cleanup }} | |
- name: Run brew test-bot --only-formulae --keep-old --only-json-tab --skip-online-checks --skip-dependents ${{inputs.formula}} | |
working-directory: ${{ env.BOTTLES_DIR }} | |
run: | | |
brew test-bot \ | |
--only-formulae \ | |
--keep-old \ | |
--only-json-tab \ | |
--skip-online-checks \ | |
--skip-dependents \ | |
--root-url="https://ghcr.io/v2/${{ github.repository_owner }}/extensions" \ | |
'${{inputs.formula}}' | |
- name: Post-build steps | |
if: always() | |
uses: Homebrew/actions/post-build@master | |
with: | |
runner: ${{ matrix.runner }} | |
cleanup: ${{ matrix.cleanup }} | |
bottles-directory: ${{ env.BOTTLES_DIR }} | |
logs-directory: ${{ env.BOTTLES_DIR }}/logs | |
upload: | |
runs-on: ubuntu-latest | |
needs: bottle | |
if: inputs.upload | |
container: | |
image: ghcr.io/homebrew/ubuntu22.04:master | |
defaults: | |
run: | |
shell: bash | |
env: | |
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1 | |
BOTTLES_DIR: ${{ github.workspace }}/bottles | |
steps: | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
core: true | |
cask: false | |
test-bot: false | |
- name: Download bottles from GitHub Actions | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: bottles_* | |
path: ${{ env.BOTTLES_DIR }} | |
merge-multiple: true | |
- name: Configure Git user | |
id: git-user-config | |
uses: Homebrew/actions/git-user-config@master | |
with: | |
username: BrewTestBot | |
- name: Upload bottles to GitHub Packages | |
env: | |
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.repository_owner }} | |
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}} | |
working-directory: ${{ env.BOTTLES_DIR }} | |
run: | | |
brew pr-upload --verbose --keep-old --root-url="https://ghcr.io/v2/${{ github.repository_owner }}/extensions" | |
- name: Push commits | |
uses: Homebrew/actions/git-try-push@master | |
with: | |
directory: ${{steps.set-up-homebrew.outputs.repository-path}} | |
token: ${{secrets.GITHUB_TOKEN}} |