Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: add self-hosted runners #50468

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/build-bottles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build bottles.

on:
pull_request:
paths:
- 'Formula/*'

jobs:
build-bottles:
strategy:
matrix:
version: [10.15, 10.14, 10.13]
runs-on: ${{ matrix.version }}
env:
HOMEBREW_GIT_NAME: BrewTestBot
HOMEBREW_GIT_EMAIL: 'homebrew-test-bot@lists.sfconservancy.org'
PATH: '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- name: Setup tap
Copy link
Member

Choose a reason for hiding this comment

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

Could this use actions/checkout@master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This copies the Jenkins configuration. I believe test bot looks at the current brew repository, not its current directory.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand this, can you elaborate a bit?

run: |
git -C $(brew --repo) remote set-url origin https://github.com/Homebrew/brew
cd $(brew --repo ${{ github.repository }})
git config remote.origin.url https://github.com/Homebrew/homebrew-core/
git fetch origin refs/pull/${{ github.event.pull_request.number }}/merge
git checkout -f FETCH_HEAD
- name: Cleanup
run: |
BREW_LIST=$(brew list 2>/dev/null)
if [ -n "$BREW_LIST" ]; then
echo ">> brew uninstall"
brew uninstall --force --ignore-dependencies $BREW_LIST
Copy link
Member

Choose a reason for hiding this comment

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

brew test-bot should handle this already. If it doesn't: I suggest it's added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn’t. I need to figure out what environment variables test bot is looking at on Jenkins to determine its cleanup behavior.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, thanks 👍

fi
rm -rf bottles
rm -rf *
Copy link
Member

Choose a reason for hiding this comment

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

What's it cleaning up here? Does GitHub Actions not provide a clean space to each runner?

Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest this cleanup logic go into brew test-bot, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does GitHub Actions not provide a clean space to each runner?

For GitHub hosted runners, yes, but this is basically like Jenkins where we need to do all of that.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good!

find . /usr/local/Homebrew -name .git/gc.log -delete
brew update-reset /usr/local/Homebrew
brew update
- name: Build bottles
run: |
mkdir bottles
cd bottles
brew test-bot --ci-pr
Copy link
Member

Choose a reason for hiding this comment

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

--ci-pr should be autodetected from the environment variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This copies the Jenkins configuration.

Copy link
Member

Choose a reason for hiding this comment

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

Think it could be removed there too!

- name: Upload bottles
if: always()
uses: actions/upload-artifact@v1
with:
name: bottles
path: bottles
- name: Cleanup
if: always()
run: |
BREW_LIST=$(brew list 2>/dev/null)
if [ -n "$BREW_LIST" ]; then
echo ">> brew uninstall"
brew uninstall --force --ignore-dependencies $BREW_LIST
Copy link
Member

Choose a reason for hiding this comment

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

brew test-bot should definitely handle this already.

fi
rm -rf bottles
rm -rf *