Skip to content

Commit

Permalink
Merge pull request Homebrew#14201 from Homebrew/setup-homebrew-test
Browse files Browse the repository at this point in the history
Adapt to setup-homebrew changes
  • Loading branch information
Bo98 authored Jan 27, 2023
2 parents 2ec4c82 + dc2f41c commit 12f3fb8
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
linting:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: docs
steps:
- name: Set up Homebrew
id: set-up-homebrew
Expand All @@ -25,19 +22,22 @@ jobs:
run: brew install vale

- name: Run vale for docs linting
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: vale .

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true
working-directory: docs
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs

- name: Check Markdown syntax
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake lint

- name: Build docs site
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake build

rubydoc:
Expand All @@ -63,5 +63,5 @@ jobs:
bundler-cache: true

- name: Process rubydoc comments
working-directory: Library/Homebrew
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew
run: bundle exec yard doc --plugin sorbet --no-output --fail-on-warning
9 changes: 6 additions & 3 deletions .github/workflows/sorbet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
git fetch origin
Expand All @@ -46,15 +47,15 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git checkout "Library/Homebrew/sorbet"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
brew typecheck --update
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git add "Library/Homebrew/sorbet"
git commit -m "sorbet: Update RBI files." \
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
echo "committed=true" >> $GITHUB_OUTPUT
Expand All @@ -70,6 +71,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
Expand All @@ -79,3 +81,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
7 changes: 5 additions & 2 deletions .github/workflows/spdx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
git fetch origin
Expand All @@ -45,14 +46,14 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git checkout "Library/Homebrew/data/spdx"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew update-license-data
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git add "Library/Homebrew/data/spdx"
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
echo "committed=true" >> $GITHUB_OUTPUT
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
Expand All @@ -67,6 +68,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
Expand All @@ -76,3 +78,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
27 changes: 15 additions & 12 deletions .github/workflows/sponsors-maintainers-man-completions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,38 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git checkout "README.md" \
"docs/Manpage.md" \
"manpages/brew.1" \
"completions"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew update-sponsors
then
git add "${GITHUB_WORKSPACE}/README.md"
git add "README.md"
git commit -m "Update sponsors." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
fi
if brew update-maintainers
then
git add "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1"
git add "README.md" \
"docs/Manpage.md" \
"manpages/brew.1"
git commit -m "Update maintainers." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
fi
if brew generate-man-completions
then
git add "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git add "README.md" \
"docs/Manpage.md" \
"manpages/brew.1" \
"completions"
git commit -m "Update manpage and completions." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
Expand All @@ -111,12 +111,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_SPONSORS_MAINTAINERS_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

- name: Push commits
if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
Expand All @@ -126,3 +128,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
6 changes: 6 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet

- name: Check for uncommitted RubyGems
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby

docker:
Expand All @@ -159,6 +160,7 @@ jobs:
uses: Homebrew/actions/setup-homebrew@master

- name: Build Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
docker build -t brew --build-arg=version=22.04 \
--label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
Expand All @@ -183,6 +185,7 @@ jobs:
docker push "homebrew/ubuntu22.04:master"
- name: Build deprecated 16.04 Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
echo "homebrew/ubuntu16.04:master is deprecated and will soon be retired. Use homebrew/ubuntu22.04:master or homebrew/ubuntu16.04 or homebrew/brew. For CI, homebrew/ubuntu22.04:master is recommended." > .docker-deprecate
docker build -t brew-deprecated --build-arg=version=16.04 \
Expand Down Expand Up @@ -262,6 +265,7 @@ jobs:

- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml

test-default-formula-linux:
Expand Down Expand Up @@ -310,6 +314,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet

- name: Check for uncommitted RubyGems
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby

- run: brew doctor
Expand Down Expand Up @@ -373,4 +378,5 @@ jobs:

- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml
7 changes: 5 additions & 2 deletions .github/workflows/vendor-gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
echo "gem_name=${gem_name}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

- name: Vendor Gems
env:
Expand All @@ -59,11 +60,12 @@ jobs:
env:
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
brew typecheck --update
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git add "Library/Homebrew/sorbet"
git commit -m "Update RBI files for ${GEM_NAME}." \
-m "Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow."
fi
Expand All @@ -72,5 +74,6 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.checkout.outputs.branch }}
force: true

0 comments on commit 12f3fb8

Please sign in to comment.