Skip to content

Commit

Permalink
Import brew formula-analytics and generate-analytics-api commands
Browse files Browse the repository at this point in the history
Import these from the homebrew/formula-analytics tap and deprecate
that tap.

This required a little messing around with filenames and paths to get
it finding Python and writing to the user's home directory.
  • Loading branch information
MikeMcQuaid committed Feb 7, 2025
1 parent 5ae29d3 commit 6f99704
Show file tree
Hide file tree
Showing 18 changed files with 816 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ updates:
interval: daily
allow:
- dependency-type: all

- package-ecosystem: pip
directory: /Library/Homebrew/formula-analytics/
schedule:
interval: daily
allow:
- dependency-type: all
48 changes: 43 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ jobs:
run: |
brew tap homebrew/bundle
brew tap homebrew/command-not-found
brew tap homebrew/formula-analytics
brew tap homebrew/portable-ruby
brew tap homebrew/services
Expand All @@ -129,7 +128,6 @@ jobs:
homebrew/test-bot
brew style homebrew/command-not-found \
homebrew/formula-analytics \
homebrew/portable-ruby
- name: Run brew style on homebrew/cask
Expand Down Expand Up @@ -182,9 +180,6 @@ jobs:
run: |
brew audit --skip-style --except=version --tap=homebrew/cask
- name: Generate formula API
run: brew generate-formula-api --dry-run

- name: Generate cask API
run: brew generate-cask-api --dry-run

Expand Down Expand Up @@ -398,3 +393,46 @@ jobs:
- run: brew install gnu-tar

- run: brew test-bot --only-formulae --only-json-tab --test-default-formula

test-analytics:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
needs: syntax
if: github.repository_owner == 'Homebrew' && github.event_name != 'push'
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Setup Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version-file: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew/formula-analytics/.python-version

- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-

- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems

- run: brew formula-analytics --setup

- run: brew formula-analytics --install --json --days-ago=2
if: github.event.pull_request.head.repo.fork == false && (github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]')
env:
HOMEBREW_INFLUXDB_TOKEN: ${{ secrets.HOMEBREW_INFLUXDB_READ_TOKEN }}

- run: brew generate-analytics-api
if: github.event.pull_request.head.repo.fork == false && (github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]')
env:
HOMEBREW_INFLUXDB_TOKEN: ${{ secrets.HOMEBREW_INFLUXDB_READ_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
**/vendor/bundle/ruby/*/gems/prism-*/
**/vendor/bundle/ruby/*/gems/psych-*/
**/vendor/bundle/ruby/*/gems/pry-*/
**/vendor/bundle/ruby/*/gems/pycall-*/
**/vendor/bundle/ruby/*/gems/racc-*/
**/vendor/bundle/ruby/*/gems/rainbow-*/
**/vendor/bundle/ruby/*/gems/rbi-*/
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ end
group :vscode, optional: true do
gem "ruby-lsp", require: false
end
group :formula_analytics, optional: true do
gem "pycall", require: false
end

# shared gems (used by multiple groups)
group :audit, :bump_unversioned_casks, :livecheck, optional: true do
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (6.0.1)
pycall (1.5.2)
racc (1.8.1)
rainbow (3.1.1)
rbi (0.2.4)
Expand Down Expand Up @@ -168,6 +169,7 @@ DEPENDENCIES
patchelf
plist
pry
pycall
redcarpet
rexml
rspec
Expand Down
Loading

0 comments on commit 6f99704

Please sign in to comment.