name: brew doctor
on:
  pull_request:
    paths:
      - .github/workflows/doctor.yml
      - Library/Homebrew/cmd/doctor.rb
      - Library/Homebrew/diagnostic.rb
      - Library/Homebrew/extend/os/diagnostic.rb
      - Library/Homebrew/extend/os/mac/diagnostic.rb
      - Library/Homebrew/os/mac/xcode.rb
permissions:
  contents: read
env:
  HOMEBREW_DEVELOPER: 1
  HOMEBREW_NO_AUTO_UPDATE: 1
  HOMEBREW_CHANGE_ARCH_TO_ARM: 1
jobs:
  tests:
    strategy:
      matrix:
        version: ["12-arm64", "12", "11-arm64", "11", "10.15"]
      fail-fast: false
    runs-on: ${{ matrix.version }}
    env:
      PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    defaults:
      run:
        working-directory: /tmp
    steps:
      - 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

      - run: brew test-bot --only-cleanup-after
        if: always()
