Skip to content

Commit

Permalink
Merge pull request #172733 from SMillerDev/feat/ci/add_scheduled_check
Browse files Browse the repository at this point in the history
feat: Add CI to check casks
  • Loading branch information
SMillerDev authored May 2, 2024
2 parents 7efa202 + a9f4736 commit 91345b9
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Scheduled online check

on:
push:
branches:
- master
paths:
- .github/workflows/scheduled.yml
schedule:
# Once every day at 1AM
- cron: "0 1 * * *"

concurrency:
group: scheduled
cancel-in-progress: true

permissions:
issues: write

jobs:
create_matrix:
if: startsWith( github.repository, 'Homebrew/' )
runs-on: ubuntu-22.04
container:
image: ghcr.io/homebrew/ubuntu22.04:master
outputs:
json: ${{ steps.matrix.outputs.json }}
env:
TEST_COUNT: 50
TAP: homebrew/cask
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: true
test-bot: false

- name: Generate matrix
id: matrix
run: |
casks="$(find "$(brew --repo "${TAP}")/Casks" -type f | shuf -n "${TEST_COUNT}" | xargs -I{} basename {} .rb)"
# shellcheck disable=SC2086
json="$(
brew info --json=v2 $casks |
jq --compact-output '[.casks[] | select(.deprecated == false and .disabled == false) | .full_token]'
)"
echo "json=${json}" >> "$GITHUB_OUTPUT"
audit_online:
if: startsWith( github.repository, 'Homebrew/' )
runs-on: ${{ matrix.os }}
container:
image: ghcr.io/homebrew/ubuntu22.04:master
needs: create_matrix
name: "Online check (${{ matrix.os }}): ${{ matrix.cask }}"
env:
HOMEBREW_GITHUB_API_TOKEN: "${{ github.token }}"
GH_TOKEN: "${{ github.token }}"
REPORTING_ISSUE: 172732
strategy:
fail-fast: false
matrix:
cask: ${{ fromJson(needs.create_matrix.outputs.json) }}
os: [ubuntu-22.04]
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: true
test-bot: false

- name: Check cask source is not archived.
id: archived
if: matrix.os != 'macos-latest'
run: brew audit --cask --online --skip-style --only github_repository_archived,gitlab_repository_archived ${{ matrix.cask }}

- name: Report online issues
if: ${{ failure() && steps.archived.conclusion == 'failure' }}
run: |
gh issue comment "$REPORTING_ISSUE" \
--repo homebrew/homebrew-cask \
--body "${{ matrix.cask }} should be archived. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Check cask for unavailable homepage.
id: homepage
if: matrix.os != 'macos-latest'
run: brew audit --cask --online --skip-style --only homepage ${{ matrix.cask }}

- name: Report homepage issues
if: ${{ failure() && steps.homepage.conclusion == 'failure' }}
run: |
gh issue comment "$REPORTING_ISSUE" \
--repo homebrew/homebrew-cask \
--body "${{ matrix.cask }} has homepage issues. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Check cask for missing sources.
id: fetch
if: matrix.os != 'macos-latest'
run: brew fetch --cask -s ${{ matrix.cask }}

- name: Report fetch issues
if: ${{ failure() && steps.fetch.conclusion == 'failure' }}
run: |
gh issue comment "$REPORTING_ISSUE" \
--repo homebrew/homebrew-cask \
--body "${{ matrix.cask }} source has problems. Check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 comments on commit 91345b9

Please sign in to comment.