homebrew-core/.github/workflows/dispatch-rebottle.yml

226 lines
8.1 KiB
YAML
Raw Normal View History

name: Dispatch rebottle (for all currently bottled OS versions)
2022-09-28 15:40:18 +00:00
run-name: Rebuild bottles of ${{ inputs.formula }}
on:
workflow_dispatch:
inputs:
formula:
description: Formula name
required: true
.github/workflows: use new test-bot features. This commit is a fairly giant change to how our CI works. It: - explains (in the name) the difference between `dispatch-build-bottle` and `dispatch-rebottle` - allows a custom build timeout for `dispatch-build-bottle` and `dispatch-rebottle` (defaulting to an hour) to avoid the CI queue getting backed up by default - does some general cleanup of the workflow files - uses `--skip-dependents` for `dispatch-build-bottle` and `dispatch-rebottle`; we're not testing new changes in these cases so there's no sense doing the (sometimes incredibly slow) full dependency tree checks - allows specifying whether `dispatch-rebottle` fails fast on the first matrix build or not. Given that we're almost always wanting to rebottle all macOS versions in this case: it defaults to true to save time on pointless builds - runs `brew test-bot --only-formulae-detect` once in the `tap_syntax` job and uses these results in the remaining tests. This ensures that they are consistent, precalculated and more easily visible. - move all `brew test-bot` label outputs into a single string with all the arguments to simplify adding more and DRY things up - add support for new `CI-fail-fast`, `CI-long-timeout` labels to customise GitHub Actions behaviour and have quicker failures/timeouts by default to avoid the CI queue backing up - add support for new `CI-skip-dependents`, `CI-build-dependents-from-source`, `CI-skip-recursive-dependents` labels for customising `brew test-bot` behaviour by passing the respective flags through. This will allow speeding up and slowing down builds using labels rather than hardcoded values in `brew test-bot`. - Use separate `brew test-bot --only-dependents` step to fail faster if one of the original formulae has failed and to separate the output of dependents and original formulae builds - autoformat `triage.yml` - add support for `CI-long-timeout`, `CI-build-dependents-from-source` and `CI-skip-recursive-dependents` labels into `triage.yml`
2021-07-08 13:17:21 +00:00
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
.github/workflows: use new test-bot features. This commit is a fairly giant change to how our CI works. It: - explains (in the name) the difference between `dispatch-build-bottle` and `dispatch-rebottle` - allows a custom build timeout for `dispatch-build-bottle` and `dispatch-rebottle` (defaulting to an hour) to avoid the CI queue getting backed up by default - does some general cleanup of the workflow files - uses `--skip-dependents` for `dispatch-build-bottle` and `dispatch-rebottle`; we're not testing new changes in these cases so there's no sense doing the (sometimes incredibly slow) full dependency tree checks - allows specifying whether `dispatch-rebottle` fails fast on the first matrix build or not. Given that we're almost always wanting to rebottle all macOS versions in this case: it defaults to true to save time on pointless builds - runs `brew test-bot --only-formulae-detect` once in the `tap_syntax` job and uses these results in the remaining tests. This ensures that they are consistent, precalculated and more easily visible. - move all `brew test-bot` label outputs into a single string with all the arguments to simplify adding more and DRY things up - add support for new `CI-fail-fast`, `CI-long-timeout` labels to customise GitHub Actions behaviour and have quicker failures/timeouts by default to avoid the CI queue backing up - add support for new `CI-skip-dependents`, `CI-build-dependents-from-source`, `CI-skip-recursive-dependents` labels for customising `brew test-bot` behaviour by passing the respective flags through. This will allow speeding up and slowing down builds using labels rather than hardcoded values in `brew test-bot`. - Use separate `brew test-bot --only-dependents` step to fail faster if one of the original formulae has failed and to separate the output of dependents and original formulae builds - autoformat `triage.yml` - add support for `CI-long-timeout`, `CI-build-dependents-from-source` and `CI-skip-recursive-dependents` labels into `triage.yml`
2021-07-08 13:17:21 +00:00
fail-fast:
description: "Whether to fail immediately on a single OS version failure (default: true)"
.github/workflows: use new test-bot features. This commit is a fairly giant change to how our CI works. It: - explains (in the name) the difference between `dispatch-build-bottle` and `dispatch-rebottle` - allows a custom build timeout for `dispatch-build-bottle` and `dispatch-rebottle` (defaulting to an hour) to avoid the CI queue getting backed up by default - does some general cleanup of the workflow files - uses `--skip-dependents` for `dispatch-build-bottle` and `dispatch-rebottle`; we're not testing new changes in these cases so there's no sense doing the (sometimes incredibly slow) full dependency tree checks - allows specifying whether `dispatch-rebottle` fails fast on the first matrix build or not. Given that we're almost always wanting to rebottle all macOS versions in this case: it defaults to true to save time on pointless builds - runs `brew test-bot --only-formulae-detect` once in the `tap_syntax` job and uses these results in the remaining tests. This ensures that they are consistent, precalculated and more easily visible. - move all `brew test-bot` label outputs into a single string with all the arguments to simplify adding more and DRY things up - add support for new `CI-fail-fast`, `CI-long-timeout` labels to customise GitHub Actions behaviour and have quicker failures/timeouts by default to avoid the CI queue backing up - add support for new `CI-skip-dependents`, `CI-build-dependents-from-source`, `CI-skip-recursive-dependents` labels for customising `brew test-bot` behaviour by passing the respective flags through. This will allow speeding up and slowing down builds using labels rather than hardcoded values in `brew test-bot`. - Use separate `brew test-bot --only-dependents` step to fail faster if one of the original formulae has failed and to separate the output of dependents and original formulae builds - autoformat `triage.yml` - add support for `CI-long-timeout`, `CI-build-dependents-from-source` and `CI-skip-recursive-dependents` labels into `triage.yml`
2021-07-08 13:17:21 +00:00
default: "true"
required: false
2022-08-28 19:18:01 +00:00
permissions:
contents: read
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_GITHUB_ACTIONS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
jobs:
setup:
runs-on: ubuntu-22.04
container:
image: ghcr.io/homebrew/ubuntu22.04:master
outputs:
runners: ${{steps.determine-runners.outputs.runners}}
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Determine runners
id: determine-runners
run: brew determine-rebottle-runners "${{github.event.inputs.formula}}" "${{github.event.inputs.timeout}}"
bottle:
needs: setup
strategy:
matrix:
include: ${{fromJson(needs.setup.outputs.runners)}}
.github/workflows: use new test-bot features. This commit is a fairly giant change to how our CI works. It: - explains (in the name) the difference between `dispatch-build-bottle` and `dispatch-rebottle` - allows a custom build timeout for `dispatch-build-bottle` and `dispatch-rebottle` (defaulting to an hour) to avoid the CI queue getting backed up by default - does some general cleanup of the workflow files - uses `--skip-dependents` for `dispatch-build-bottle` and `dispatch-rebottle`; we're not testing new changes in these cases so there's no sense doing the (sometimes incredibly slow) full dependency tree checks - allows specifying whether `dispatch-rebottle` fails fast on the first matrix build or not. Given that we're almost always wanting to rebottle all macOS versions in this case: it defaults to true to save time on pointless builds - runs `brew test-bot --only-formulae-detect` once in the `tap_syntax` job and uses these results in the remaining tests. This ensures that they are consistent, precalculated and more easily visible. - move all `brew test-bot` label outputs into a single string with all the arguments to simplify adding more and DRY things up - add support for new `CI-fail-fast`, `CI-long-timeout` labels to customise GitHub Actions behaviour and have quicker failures/timeouts by default to avoid the CI queue backing up - add support for new `CI-skip-dependents`, `CI-build-dependents-from-source`, `CI-skip-recursive-dependents` labels for customising `brew test-bot` behaviour by passing the respective flags through. This will allow speeding up and slowing down builds using labels rather than hardcoded values in `brew test-bot`. - Use separate `brew test-bot --only-dependents` step to fail faster if one of the original formulae has failed and to separate the output of dependents and original formulae builds - autoformat `triage.yml` - add support for `CI-long-timeout`, `CI-build-dependents-from-source` and `CI-skip-recursive-dependents` labels into `triage.yml`
2021-07-08 13:17:21 +00:00
fail-fast: ${{fromJson(github.event.inputs.fail-fast)}}
runs-on: ${{matrix.runner}}
container: ${{matrix.container}}
.github/workflows: use new test-bot features. This commit is a fairly giant change to how our CI works. It: - explains (in the name) the difference between `dispatch-build-bottle` and `dispatch-rebottle` - allows a custom build timeout for `dispatch-build-bottle` and `dispatch-rebottle` (defaulting to an hour) to avoid the CI queue getting backed up by default - does some general cleanup of the workflow files - uses `--skip-dependents` for `dispatch-build-bottle` and `dispatch-rebottle`; we're not testing new changes in these cases so there's no sense doing the (sometimes incredibly slow) full dependency tree checks - allows specifying whether `dispatch-rebottle` fails fast on the first matrix build or not. Given that we're almost always wanting to rebottle all macOS versions in this case: it defaults to true to save time on pointless builds - runs `brew test-bot --only-formulae-detect` once in the `tap_syntax` job and uses these results in the remaining tests. This ensures that they are consistent, precalculated and more easily visible. - move all `brew test-bot` label outputs into a single string with all the arguments to simplify adding more and DRY things up - add support for new `CI-fail-fast`, `CI-long-timeout` labels to customise GitHub Actions behaviour and have quicker failures/timeouts by default to avoid the CI queue backing up - add support for new `CI-skip-dependents`, `CI-build-dependents-from-source`, `CI-skip-recursive-dependents` labels for customising `brew test-bot` behaviour by passing the respective flags through. This will allow speeding up and slowing down builds using labels rather than hardcoded values in `brew test-bot`. - Use separate `brew test-bot --only-dependents` step to fail faster if one of the original formulae has failed and to separate the output of dependents and original formulae builds - autoformat `triage.yml` - add support for `CI-long-timeout`, `CI-build-dependents-from-source` and `CI-skip-recursive-dependents` labels into `triage.yml`
2021-07-08 13:17:21 +00:00
timeout-minutes: ${{fromJson(github.event.inputs.timeout)}}
defaults:
run:
working-directory: ${{matrix.workdir || github.workspace}}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- name: ${{github.event.inputs.formula}}
id: print_details
run: |
echo sender=${{github.event.sender.login}}
echo formula=${{github.event.inputs.formula}}
echo timeout=${{github.event.inputs.timeout}}
echo issue=${{github.event.inputs.issue}}
echo upload=${{github.event.inputs.upload}}
- name: Set environment variables
if: runner.os == 'macOS'
run: |
echo 'PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' >> $GITHUB_ENV
# TODO: remove the line below once set in the runner .env file
echo 'GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED=1' >> $GITHUB_ENV
- 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-online-checks --skip-dependents
env:
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir bottles
cd bottles
brew test-bot --only-formulae --only-json-tab --skip-online-checks --skip-dependents ${{github.event.inputs.formula}}
- name: Failures summary for brew test-bot --only-formulae
if: always()
uses: Homebrew/actions/failures-summary-and-bottle-result@master
with:
workdir: ${{matrix.workdir || github.workspace}}
result_path: bottles/steps_output.txt
step_name: 'Build summary on ${{ matrix.runner }}'
- name: Output brew linkage result
if: always()
uses: Homebrew/actions/failures-summary-and-bottle-result@master
with:
workdir: ${{matrix.workdir || github.workspace}}
result_path: bottles/linkage_output.txt
step_name: '`brew linkage` output on ${{ matrix.runner }}'
- name: Output brew bottle result
if: always()
uses: Homebrew/actions/failures-summary-and-bottle-result@master
with:
workdir: ${{matrix.workdir || github.workspace}}
result_path: bottles/bottle_output.txt
step_name: '`brew bottle` output on ${{ matrix.runner }}'
- name: Upload logs
if: failure()
uses: actions/upload-artifact@main
with:
name: logs
path: ${{matrix.workdir || github.workspace}}/bottles/logs
- name: Delete logs and home
if: always()
run: |
rm -rvf bottles/logs
rm -rvf bottles/home
rm -rvf bottles/failed
- name: Count bottles
id: bottles
if: always()
run: |
cd bottles
count=$(ls *.json | wc -l | xargs echo -n)
echo "$count bottles"
echo "count=$count" >> $GITHUB_OUTPUT
- name: Upload bottles to GitHub Actions
if: always() && steps.bottles.outputs.count > 0
uses: actions/upload-artifact@main
with:
name: bottles
path: ${{matrix.workdir || github.workspace}}/bottles
- name: Post cleanup
if: always()
run: |
brew test-bot --only-cleanup-after
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:
2022-08-28 19:18:01 +00:00
permissions:
issues: write # for Homebrew/actions/post-comment
2022-08-30 05:46:08 +00:00
contents: write # for Homebrew/actions/git-try-push
packages: write # for brew pr-upload
runs-on: ubuntu-22.04
needs: bottle
if: github.event.inputs.upload
env:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
steps:
- 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}}
directory: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core
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:
2021-04-08 06:39:37 +00:00
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