workflows: set working directory to repo location

This commit is contained in:
Bo Anderson 2022-12-04 05:02:52 +00:00
parent 2ec4c82fe2
commit dc2f41cb8d
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
6 changed files with 42 additions and 24 deletions

View File

@ -13,9 +13,6 @@ jobs:
linting: linting:
if: github.repository == 'Homebrew/brew' if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
defaults:
run:
working-directory: docs
steps: steps:
- name: Set up Homebrew - name: Set up Homebrew
id: set-up-homebrew id: set-up-homebrew
@ -25,6 +22,7 @@ jobs:
run: brew install vale run: brew install vale
- name: Run vale for docs linting - name: Run vale for docs linting
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: vale . run: vale .
- name: Install Ruby - name: Install Ruby
@ -32,12 +30,14 @@ jobs:
with: with:
ruby-version: "2.7" ruby-version: "2.7"
bundler-cache: true bundler-cache: true
working-directory: docs working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
- name: Check Markdown syntax - name: Check Markdown syntax
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake lint run: bundle exec rake lint
- name: Build docs site - name: Build docs site
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake build run: bundle exec rake build
rubydoc: rubydoc:
@ -63,5 +63,5 @@ jobs:
bundler-cache: true bundler-cache: true
- name: Process rubydoc comments - 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 run: bundle exec yard doc --plugin sorbet --no-output --fail-on-warning

View File

@ -37,6 +37,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: | run: |
git fetch origin git fetch origin
@ -46,15 +47,15 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}" if git ls-remote --exit-code --heads origin "${BRANCH}"
then then
git checkout "${BRANCH}" git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" git checkout "Library/Homebrew/sorbet"
else else
git checkout --no-track -B "${BRANCH}" origin/master git checkout --no-track -B "${BRANCH}" origin/master
fi fi
brew typecheck --update brew typecheck --update
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
then then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" git add "Library/Homebrew/sorbet"
git commit -m "sorbet: Update RBI files." \ git commit -m "sorbet: Update RBI files." \
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow." -m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
echo "committed=true" >> $GITHUB_OUTPUT echo "committed=true" >> $GITHUB_OUTPUT
@ -70,6 +71,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master uses: Homebrew/actions/git-try-push@master
with: with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }} branch: ${{ steps.update.outputs.branch }}
force: true force: true
origin_branch: "master" origin_branch: "master"
@ -79,3 +81,4 @@ jobs:
run: hub pull-request --no-edit run: hub pull-request --no-edit
env: env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -36,6 +36,7 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: | run: |
git fetch origin git fetch origin
@ -45,14 +46,14 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}" if git ls-remote --exit-code --heads origin "${BRANCH}"
then then
git checkout "${BRANCH}" git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx" git checkout "Library/Homebrew/data/spdx"
else else
git checkout --no-track -B "${BRANCH}" origin/master git checkout --no-track -B "${BRANCH}" origin/master
fi fi
if brew update-license-data if brew update-license-data
then 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)." 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 echo "committed=true" >> $GITHUB_OUTPUT
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
@ -67,6 +68,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master uses: Homebrew/actions/git-try-push@master
with: with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }} branch: ${{ steps.update.outputs.branch }}
force: true force: true
origin_branch: "master" origin_branch: "master"
@ -76,3 +78,4 @@ jobs:
run: hub pull-request --no-edit run: hub pull-request --no-edit
env: env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -61,17 +61,17 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}" if git ls-remote --exit-code --heads origin "${BRANCH}"
then then
git checkout "${BRANCH}" git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/README.md" \ git checkout "README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \ "docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \ "manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions" "completions"
else else
git checkout --no-track -B "${BRANCH}" origin/master git checkout --no-track -B "${BRANCH}" origin/master
fi fi
if brew update-sponsors if brew update-sponsors
then then
git add "${GITHUB_WORKSPACE}/README.md" git add "README.md"
git commit -m "Update sponsors." \ 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." -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 COMMITTED=true
@ -79,9 +79,9 @@ jobs:
if brew update-maintainers if brew update-maintainers
then then
git add "${GITHUB_WORKSPACE}/README.md" \ git add "README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \ "docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" "manpages/brew.1"
git commit -m "Update maintainers." \ 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." -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 COMMITTED=true
@ -89,10 +89,10 @@ jobs:
if brew generate-man-completions if brew generate-man-completions
then then
git add "${GITHUB_WORKSPACE}/README.md" \ git add "README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \ "docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \ "manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions" "completions"
git commit -m "Update manpage and 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." -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 COMMITTED=true
@ -111,12 +111,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_SPONSORS_MAINTAINERS_TOKEN }} HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_SPONSORS_MAINTAINERS_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }} HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
- name: Push commits - name: Push commits
if: steps.update.outputs.committed == 'true' if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master uses: Homebrew/actions/git-try-push@master
with: with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }} branch: ${{ steps.update.outputs.branch }}
force: true force: true
origin_branch: "master" origin_branch: "master"
@ -126,3 +128,4 @@ jobs:
run: hub pull-request --no-edit run: hub pull-request --no-edit
env: env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }} GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -148,6 +148,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet run: brew install-bundler-gems --groups=sorbet
- name: Check for uncommitted RubyGems - 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: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
docker: docker:
@ -159,6 +160,7 @@ jobs:
uses: Homebrew/actions/setup-homebrew@master uses: Homebrew/actions/setup-homebrew@master
- name: Build Docker image - name: Build Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: | run: |
docker build -t brew --build-arg=version=22.04 \ docker build -t brew --build-arg=version=22.04 \
--label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \ --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
@ -183,6 +185,7 @@ jobs:
docker push "homebrew/ubuntu22.04:master" docker push "homebrew/ubuntu22.04:master"
- name: Build deprecated 16.04 Docker image - name: Build deprecated 16.04 Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: | 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 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 \ docker build -t brew-deprecated --build-arg=version=16.04 \
@ -262,6 +265,7 @@ jobs:
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with: with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml files: Library/Homebrew/test/coverage/coverage.xml
test-default-formula-linux: test-default-formula-linux:
@ -310,6 +314,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet run: brew install-bundler-gems --groups=sorbet
- name: Check for uncommitted RubyGems - 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: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
- run: brew doctor - run: brew doctor
@ -373,4 +378,5 @@ jobs:
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with: with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml files: Library/Homebrew/test/coverage/coverage.xml

View File

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