189 lines
6.5 KiB
YAML
189 lines
6.5 KiB
YAML
name: Dispatch rebottle (for all macOS versions)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
formula:
|
|
description: Formula name
|
|
required: true
|
|
timeout:
|
|
description: "Build timeout (in minutes, default: 60 minutes)"
|
|
default: "60"
|
|
required: true
|
|
issue:
|
|
description: Issue number, where comment on failure would be posted
|
|
required: false
|
|
upload:
|
|
description: "Whether to upload built bottles or not (default: false)"
|
|
required: false
|
|
fail-fast:
|
|
description: "Whether to fail immediately on a single macOS version failure (default: true)"
|
|
default: "true"
|
|
required: false
|
|
|
|
env:
|
|
HOMEBREW_DEVELOPER: 1
|
|
HOMEBREW_GITHUB_ACTIONS: 1
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
|
|
HOMEBREW_RELOCATE_RPATHS: 1
|
|
|
|
jobs:
|
|
bottle:
|
|
strategy:
|
|
matrix:
|
|
version: ["12-arm64", "12", "11-arm64", "11", "10.15"]
|
|
fail-fast: ${{fromJson(github.event.inputs.fail-fast)}}
|
|
runs-on: ${{ matrix.version }}
|
|
timeout-minutes: ${{fromJson(github.event.inputs.timeout)}}
|
|
env:
|
|
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
GITHUB_ACTIONS_HOMEBREW_MACOS_SELF_HOSTED: 1
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
|
|
steps:
|
|
- name: ${{github.event.inputs.formula}}
|
|
id: print_details
|
|
run: |
|
|
echo sender=${{github.event.sender.login}}
|
|
echo formula=${{github.event.inputs.formula}}
|
|
echo issue=${{github.event.inputs.issue}}
|
|
echo upload=${{github.event.inputs.upload}}
|
|
|
|
- name: Set up Homebrew
|
|
id: set-up-homebrew
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
|
|
- run: brew test-bot --only-cleanup-before
|
|
|
|
- run: brew test-bot --only-setup
|
|
|
|
- name: Run brew test-bot --only-formulae --only-json-tab --skip-dependents
|
|
env:
|
|
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
run: |
|
|
mkdir bottles
|
|
cd bottles
|
|
brew test-bot --only-json-tab --only-formulae --skip-dependents ${{github.event.inputs.formula}}
|
|
|
|
- name: Failures summary for brew test-bot --only-formulae
|
|
if: always()
|
|
run: |
|
|
touch bottles/steps_output.txt
|
|
cat bottles/steps_output.txt
|
|
rm bottles/steps_output.txt
|
|
|
|
- name: Output brew bottle result
|
|
if: always()
|
|
run: |
|
|
cat bottles/bottle_output.txt
|
|
rm bottles/bottle_output.txt
|
|
|
|
- name: Upload logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: logs
|
|
path: bottles/logs
|
|
|
|
- name: Delete logs and home
|
|
if: always()
|
|
run: |
|
|
rm -rvf bottles/logs
|
|
rm -rvf bottles/home
|
|
|
|
- name: Count bottles
|
|
id: bottles
|
|
if: always()
|
|
run: |
|
|
cd bottles
|
|
count=$(ls *.json | wc -l | xargs echo -n)
|
|
echo "$count bottles"
|
|
echo "::set-output name=count::$count"
|
|
|
|
- name: Upload bottles to GitHub Actions
|
|
if: always() && steps.bottles.outputs.count > 0
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: bottles
|
|
path: bottles
|
|
|
|
- run: brew test-bot --only-cleanup-after
|
|
if: always()
|
|
|
|
- name: Post Cleanup
|
|
if: always()
|
|
run: rm -rvf bottles
|
|
|
|
- name: Post comment on failure
|
|
if: ${{!success() && github.event.inputs.issue > 0}}
|
|
uses: Homebrew/actions/post-comment@master
|
|
with:
|
|
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
|
|
issue: ${{github.event.inputs.issue}}
|
|
body: ":x: @${{github.actor}} bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
|
|
bot_body: ":x: Bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
|
|
bot: BrewTestBot
|
|
upload:
|
|
runs-on: ubuntu-latest
|
|
needs: bottle
|
|
if: github.event.inputs.upload
|
|
env:
|
|
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
|
|
steps:
|
|
- name: ${{github.event.inputs.formula}}
|
|
id: print_details
|
|
run: |
|
|
echo sender=${{github.event.sender.login}}
|
|
echo formula=${{github.event.inputs.formula}}
|
|
echo version=${{github.event.inputs.macos}}
|
|
echo issue=${{github.event.inputs.issue}}
|
|
echo upload=${{github.event.inputs.upload}}
|
|
|
|
- name: Set up Homebrew
|
|
id: set-up-homebrew
|
|
uses: Homebrew/actions/setup-homebrew@master
|
|
|
|
- name: Download bottles from GitHub Actions
|
|
uses: actions/download-artifact@main
|
|
with:
|
|
name: bottles
|
|
path: ~/bottles/
|
|
|
|
- name: Setup git
|
|
uses: Homebrew/actions/git-user-config@master
|
|
|
|
- name: Set up commit signing
|
|
uses: Homebrew/actions/setup-commit-signing@master
|
|
with:
|
|
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
|
|
|
|
- name: Upload bottles to GitHub Packages
|
|
env:
|
|
HOMEBREW_GITHUB_PACKAGES_USER: brewtestbot
|
|
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_CORE_GITHUB_PACKAGES_TOKEN}}
|
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
|
BREWTESTBOT_NAME_EMAIL: "BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>"
|
|
run: |
|
|
cd ~/bottles
|
|
brew pr-upload --verbose --committer="$BREWTESTBOT_NAME_EMAIL" --root-url="https://ghcr.io/v2/homebrew/core" --debug
|
|
|
|
- name: Push commits
|
|
uses: Homebrew/actions/git-try-push@master
|
|
with:
|
|
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
|
|
env:
|
|
GIT_COMMITTER_NAME: BrewTestBot
|
|
GIT_COMMITTER_EMAIL: 1589480+BrewTestBot@users.noreply.github.com
|
|
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
|
|
|
|
- name: Post comment on failure
|
|
if: ${{!success() && github.event.inputs.issue > 0}}
|
|
uses: Homebrew/actions/post-comment@master
|
|
with:
|
|
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
|
|
issue: ${{github.event.inputs.issue}}
|
|
body: ":x: @${{github.actor}} bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
|
|
bot_body: ":x: Bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
|
|
bot: BrewTestBot
|