From 70b289a92b4b089b79a2694534a249a33c3df0e2 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Sun, 31 Dec 2023 12:32:53 +0200 Subject: [PATCH 1/2] CI: add a build to the scheduled check CI: add reporting to issue --- .github/workflows/scheduled.yml | 67 +++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 08590671cc6c..e1f8fc7907d2 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -11,6 +11,9 @@ concurrency: group: scheduled cancel-in-progress: true +permissions: + issues: write + jobs: create_matrix: if: startsWith( github.repository, 'Homebrew/' ) @@ -31,29 +34,33 @@ jobs: cask: false test-bot: false - - id: matrix + - name: Generate matrix + id: matrix run: | - formula="$(find "$(brew --repo "${TAP}")/Formula" | shuf -n "${TEST_COUNT}" | xargs -I{} basename {} .rb)" + formula="$(find "$(brew --repo "${TAP}")/Formula" -type f | shuf -n "${TEST_COUNT}" | xargs -I{} basename {} .rb)" # shellcheck disable=SC2086 json="$( brew info --json=v2 $formula | - jq --compact-output '[.formulae[] | select(.deprecated == false and .disabled == false) | .name]' + jq --compact-output '[.formulae[] | select(.deprecated == false and .disabled == false) | .name]' )" echo "json=${json}" >> "$GITHUB_OUTPUT" audit_online: if: startsWith( github.repository, 'Homebrew/' ) - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} container: image: ghcr.io/homebrew/ubuntu22.04:master needs: create_matrix - name: "Online check: ${{ matrix.formula }}" + name: "Online check (${{ matrix.os }}): ${{ matrix.formula }}" env: HOMEBREW_GITHUB_API_TOKEN: "${{ github.token }}" + GH_TOKEN: "${{ github.token }}" + REPORTING_ISSUE: 139929 strategy: fail-fast: false matrix: formula: ${{ fromJson(needs.create_matrix.outputs.json) }} + os: [ubuntu-22.04] steps: - name: Set up Homebrew id: set-up-homebrew @@ -63,8 +70,54 @@ jobs: cask: false test-bot: false - - name: Check formula for missing upstreams etc. - run: brew audit --online --skip-style --only github_repository_archived,gitlab_repository_archived,homepage ${{ matrix.formula }} + - name: Check formula source is not archived. + id: archived + if: matrix.os != 'macos-latest' + run: brew audit --online --skip-style --only github_repository_archived,gitlab_repository_archived ${{ matrix.formula }} + + - name: Report online issues + if: ${{ failure() && steps.archived.conclusion == 'failure' }} + run: | + gh issue comment "$REPORTING_ISSUE" \ + --repo homebrew/homebrew-core \ + --body "${{ matrix.formula }} should be archived. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + + - name: Check formula for unavailable homepage. + id: homepage + if: matrix.os != 'macos-latest' + run: brew audit --online --skip-style --only homepage ${{ matrix.formula }} + + - name: Report homepage issues + if: ${{ failure() && steps.homepage.conclusion == 'failure' }} + run: | + gh issue comment "$REPORTING_ISSUE" \ + --repo homebrew/homebrew-core \ + --body "${{ matrix.formula }} has homepage issues. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - name: Check formula for missing sources. + id: fetch + if: matrix.os != 'macos-latest' run: brew fetch -s ${{ matrix.formula }} + + - name: Report fetch issues + if: ${{ failure() && steps.fetch.conclusion == 'failure' }} + run: | + gh issue comment "$REPORTING_ISSUE" \ + --repo homebrew/homebrew-core \ + --body "${{ matrix.formula }} source has problems. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + + - name: Try and build formula. + id: build + env: + HOMEBREW_NO_INSTALL_FROM_API: '1' + run: brew install -s ${{ matrix.formula }} + + # TODO: Re-enable once it skips formulae that are not fir the current OS + # - name: Report build issues + # if: ${{ failure() && steps.build.conclusion == 'failure' }} + # run: | + # gh issue comment "$REPORTING_ISSUE" \ + # --repo homebrew/homebrew-core \ + # --body "${{ matrix.formula }} failed to build on ${{ matrix.os }}. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + + From 2e1e113d87654c86badef279acd2e7f0208a8e01 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Wed, 3 Jan 2024 11:24:35 +0200 Subject: [PATCH 2/2] remove build block --- .github/workflows/scheduled.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index e1f8fc7907d2..927d0c5d3301 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -105,19 +105,3 @@ jobs: gh issue comment "$REPORTING_ISSUE" \ --repo homebrew/homebrew-core \ --body "${{ matrix.formula }} source has problems. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - - name: Try and build formula. - id: build - env: - HOMEBREW_NO_INSTALL_FROM_API: '1' - run: brew install -s ${{ matrix.formula }} - - # TODO: Re-enable once it skips formulae that are not fir the current OS - # - name: Report build issues - # if: ${{ failure() && steps.build.conclusion == 'failure' }} - # run: | - # gh issue comment "$REPORTING_ISSUE" \ - # --repo homebrew/homebrew-core \ - # --body "${{ matrix.formula }} failed to build on ${{ matrix.os }}. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - -