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/tests: handle system Linuxbrew. #7379

Merged
merged 2 commits into from Apr 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 33 additions & 19 deletions .github/workflows/tests.yml
Expand Up @@ -19,42 +19,44 @@ jobs:

- name: Set up Homebrew PATH
run: |
if [ "$RUNNER_OS" = "macOS" ]; then
echo "::add-path::/usr/local/bin:/usr/bin:/bin"
if [ "$RUNNER_OS" = "Linux" ]; then
echo "::add-path::/home/linuxbrew/.linuxbrew/bin"
else
echo "::add-path::/home/linuxbrew/.linuxbrew/bin:/usr/bin:/bin"
echo "::add-path::/usr/local/bin"
fi

- name: Set up Homebrew
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
HOMEBREW_REPOSITORY=/home/linuxbrew/.linuxbrew/Homebrew
sudo mkdir -p /home/linuxbrew/.linuxbrew
cd ..
sudo mv "brew" "$HOMEBREW_REPOSITORY"
sudo ln -s "$HOMEBREW_REPOSITORY" "brew"

sudo mkdir -p "$HOMEBREW_REPOSITORY/Library/Taps"
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
sudo rm -rf "$HOMEBREW_REPOSITORY"
sudo ln -sf "$PWD" "$HOMEBREW_REPOSITORY"

cd /home/linuxbrew/.linuxbrew
sudo mkdir -p bin etc include lib opt sbin share var/homebrew/linked Cellar
sudo ln -s ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/
sudo ln -sf ../Homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/
sudo chown -R "$USER" /home/linuxbrew

# Install taps needed for 'brew tests'
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap homebrew/bundle
brew update-reset Homebrew/Library/Taps/homebrew/homebrew-core
else
HOMEBREW_REPOSITORY="$(brew --repo)"

mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
sudo rm -rf "$HOMEBREW_REPOSITORY"
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"
brew update-reset Library/Taps/homebrew/homebrew-core
sudo ln -sf "$PWD" "$HOMEBREW_REPOSITORY"

# Install taps needed for 'brew tests'
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap homebrew/cask
brew tap homebrew/bundle
brew tap homebrew/services
brew update-reset Library/Taps/homebrew/homebrew-core
fi

- name: Set up Ruby
if: matrix.os == 'ubuntu-latest'
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'

- name: Run brew config
run: brew config

Expand All @@ -81,6 +83,17 @@ jobs:
sudo chmod -R g-w,o-w /home/linuxbrew /home/runner /opt
fi

- name: Install taps
run: |
# Install taps needed for 'brew tests' and 'brew man'
export HOMEBREW_NO_AUTO_UPDATE=1
sudo chown -R "$USER" Library/Taps
brew tap homebrew/bundle
brew tap homebrew/services
if [ "$RUNNER_OS" = "macOS" ]; then
brew tap homebrew/cask
fi

- name: Run brew style
run: brew style --display-cop-names

Expand Down Expand Up @@ -150,7 +163,8 @@ jobs:
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
docker tag homebrew_sut brew
# TODO: reenable when we figure out issue
# docker tag homebrew_sut brew
Copy link
Member Author

Choose a reason for hiding this comment

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

@sjackman @dawidd6 Afraid I had to do this to get master green again: any ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Error response from daemon: No such image: homebrew_sut:latest

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't homebrew_sut be just sut?

Copy link
Member

Choose a reason for hiding this comment

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

The first part homebrew is the name of the current working directory, translated to lower case.

else
brew test-bot
fi
Expand Down