Skip to content

CI

CI #22509

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
schedule:
# Every 15 minutes
- cron: "*/15 * * * *"
workflow_dispatch:
concurrency:
group: scheduled-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
generate-cask:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate homebrew/cask data, pages and API
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: true
test-bot: false
- name: Update data for homebrew/cask
run: /usr/bin/rake casks
env:
HOMEBREW_DEVELOPER: 1
- name: Archive data
run: tar czvf data-cask.tar.gz _data/cask/ api/cask/ api/cask-source/ api/cask_tap_migrations.json cask/ api/internal/v3/homebrew-cask.json
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: data-cask
path: data-cask.tar.gz
retention-days: 1
generate-core:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate homebrew/core data, pages and API
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: true
cask: false
test-bot: false
- name: Update data for homebrew/core
run: /usr/bin/rake formulae
env:
HOMEBREW_DEVELOPER: 1
- name: Archive data
run: tar czvf data-core.tar.gz _data/formula/ _data/formula_canonical.json api/formula/ api/formula_tap_migrations.json formula/ api/internal/v3/homebrew-core.json
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: data-core
path: data-core.tar.gz
retention-days: 1
generate-analytics:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate analytics data
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # v1.204.0
with:
bundler-cache: true
- name: Tap Homebrew/formula-analytics
id: tap-formula-analytics
run: |
brew tap Homebrew/formula-analytics
echo "python-version-file=$(brew --repo Homebrew/formula-analytics)/.python-version" >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version-file: ${{ steps.tap-formula-analytics.outputs.python-version-file }}
- name: Create directories
run: mkdir -p _data/analytics api/analytics
- name: Update analytics data
run: /usr/bin/rake analytics
if: github.ref_name == 'master' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]')
env:
HOMEBREW_INFLUXDB_TOKEN: ${{ secrets.HOMEBREW_INFLUXDB_READ_TOKEN }}
- name: Archive data
run: tar czvf data-analytics.tar.gz _data/analytics api/analytics
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: data-analytics
path: data-analytics.tar.gz
retention-days: 1
generate-samples:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate API samples
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # v1.204.0
with:
bundler-cache: true
- name: Update data for api samples
run: /usr/bin/rake api_samples
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: api-samples
path: _includes/api-samples/
retention-days: 1
build:
needs: [generate-cask, generate-core, generate-analytics, generate-samples]
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Set up Git repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # v1.204.0
with:
bundler-cache: true
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
- name: Move artifacts into place
run: |
tar xvf data-analytics/data-analytics.tar.gz
tar xvf data-cask/data-cask.tar.gz
tar xvf data-core/data-core.tar.gz
mv -v api-samples _includes/api-samples
- name: Build site
run: bundle exec jekyll build
- name: Validate build
run: ./script/validate-build.rb
- name: Sign API
if: github.ref_name == 'master' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.event.pull_request.user.login != 'dependabot[bot]')
env:
JWS_SIGNING_KEY_ID: homebrew-1
JWS_SIGNING_KEY: ${{ secrets.JWS_HOMEBREW_1 }}
run: ./script/sign-json.rb
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
deploy:
needs: build
if: ${{ github.ref_name == 'master' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
deploy_url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
deploy-issue:
name: Open/close deploy issues
needs:
[
generate-cask,
generate-core,
generate-analytics,
generate-samples,
build,
deploy,
]
if: ${{ always() && github.ref_name == 'master' }}
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
issues: write # for Homebrew/actions/create-or-update-issue
steps:
- name: Open, update, or close deploy issue
uses: Homebrew/actions/create-or-update-issue@master
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
title: formulae.brew.sh deployment failed!
body: The most recent [formulae.brew.sh deployment failed](${{ env.RUN_URL }}).
labels: deploy failure
update-existing: ${{ contains(needs.*.result, 'failure') }}
close-existing: ${{ needs.deploy.result == 'success' }}
close-from-author: github-actions[bot]
close-comment: The most recent [formulae.brew.sh deployment succeeded](${{ env.RUN_URL }}). Closing issue.