Skip to content

Commit fbba070

Browse files
authored
Merge pull request #1229 from Homebrew/sync-shared-config
2 parents b9ef108 + 834a517 commit fbba070

20 files changed

+328
-74
lines changed

.github/dependabot.yml

+20-49
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,24 @@
11
# This file is synced from the `.github` repository, do not modify it directly.
2+
---
23
version: 2
3-
44
updates:
5-
- package-ecosystem: github-actions
6-
directory: /
7-
schedule:
8-
interval: daily
9-
allow:
10-
- dependency-type: all
11-
# The actions in triage-issues.yml are updated in the Homebrew/.github repo
12-
ignore:
13-
- dependency-name: actions/stale
14-
- dependency-name: dessant/lock-threads
15-
groups:
16-
artifacts:
17-
patterns:
18-
- actions/*-artifact
19-
20-
- package-ecosystem: bundler
21-
directory: /
22-
schedule:
23-
interval: daily
24-
allow:
25-
- dependency-type: all
26-
27-
- package-ecosystem: npm
28-
directory: /
29-
schedule:
30-
interval: daily
31-
allow:
32-
- dependency-type: all
33-
34-
- package-ecosystem: docker
35-
directory: /
36-
schedule:
37-
interval: daily
38-
allow:
39-
- dependency-type: all
40-
41-
- package-ecosystem: devcontainers
42-
directory: /
43-
schedule:
44-
interval: daily
45-
allow:
46-
- dependency-type: all
5+
- package-ecosystem: github-actions
6+
directory: "/"
7+
schedule:
8+
interval: daily
9+
allow:
10+
- dependency-type: all
11+
ignore:
12+
- dependency-name: actions/stale
13+
- dependency-name: dessant/lock-threads
14+
groups:
15+
artifacts:
16+
patterns:
17+
- actions/*-artifact
18+
- package-ecosystem: bundler
19+
directory: "/"
20+
schedule:
21+
interval: daily
22+
allow:
23+
- dependency-type: all
4724

48-
- package-ecosystem: pip
49-
directory: /
50-
schedule:
51-
interval: daily
52-
allow:
53-
- dependency-type: all

.github/workflows/docs.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Documentation CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
HOMEBREW_DEVELOPER: 1
14+
HOMEBREW_NO_AUTO_UPDATE: 1
15+
HOMEBREW_NO_ENV_HINTS: 1
16+
HOMEBREW_BOOTSNAP: 1
17+
HOMEBREW_NO_INSTALL_CLEANUP: 1
18+
19+
jobs:
20+
docs:
21+
runs-on: ubuntu-22.04
22+
steps:
23+
- name: Set up Homebrew
24+
id: set-up-homebrew
25+
uses: Homebrew/actions/setup-homebrew@master
26+
with:
27+
core: false
28+
cask: false
29+
test-bot: false
30+
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Install vale
35+
run: brew install vale
36+
37+
- name: Cleanup Homebrew/brew docs
38+
if: github.repository == 'Homebrew/brew'
39+
run: |
40+
set -xeuo pipefail
41+
42+
# Avoid failing on broken symlinks.
43+
rm Library/Homebrew/os/mac/pkgconfig/fuse/fuse.pc
44+
rm Library/Homebrew/os/mac/pkgconfig/fuse/osxfuse.pc
45+
46+
# No ignore support (https://github.com/errata-ai/vale/issues/131).
47+
rm -r Library/Homebrew/vendor
48+
49+
- name: Run Vale
50+
run: vale docs/
51+
52+
- name: Install Ruby
53+
uses: ruby/setup-ruby@78c01b705fd9d5ad960d432d3a0cfa341d50e410 # v1.179.1
54+
with:
55+
bundler-cache: true
56+
working-directory: docs
57+
58+
- name: Check Markdown syntax
59+
working-directory: docs
60+
run: bundle exec rake lint
61+
62+
- name: Check code blocks conform to our Ruby style guide
63+
run: brew style docs
64+
65+
- name: Generate formulae.brew.sh API samples
66+
if: github.repository == 'Homebrew/formulae.brew.sh'
67+
working-directory: docs
68+
run: ../script/generate-api-samples.rb
69+
70+
- name: Build the site and check for broken links
71+
working-directory: docs
72+
run: bundle exec rake test
73+
env:
74+
JEKYLL_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ api/cask-source/
1313
api/cask/
1414
api/formula/
1515
api/internal/
16+
docs/_includes/api-samples/
17+
docs/tmp/
18+
docs/Gemfile.lock
1619
cask/
1720
formula/

.vale.ini

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
StylesPath = ./docs/vale-styles
2+
3+
[formats]
4+
rb = md
5+
6+
[*.{md,rb}]
7+
BasedOnStyles = Homebrew

docs/.mdl_ruleset.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rule 'HB034', 'Bare unstyled URL used' do
2+
tags :links, :url
3+
aliases 'no-bare-unstyled-urls'
4+
check do |doc|
5+
doc.matching_text_element_lines(%r{(?<=\s)https?://})
6+
end
7+
end

docs/.mdl_style.rb

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
all
2+
rule 'MD007', indent: 2 # Unordered list indentation
3+
rule 'MD026', punctuation: ',;:' # Trailing punctuation in header
4+
exclude_rule 'MD013' # Line length
5+
exclude_rule 'MD029' # Ordered list item prefix
6+
exclude_rule 'MD033' # Inline HTML
7+
exclude_rule 'MD034' # Bare URL used (replaced by HB034)
8+
exclude_rule 'MD046' # Code block style

docs/.mdlrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
git_recurse true
2+
ignore_front_matter true
3+
style "#{File.dirname(__FILE__)}/.mdl_style.rb"
4+
rulesets ["#{File.dirname(__FILE__)}/.mdl_ruleset.rb"]

docs/.rubocop.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
inherit_from: ../Library/.rubocop.yml
2+
3+
AllCops:
4+
Exclude:
5+
- Gemfile
6+
- ".mdl*.rb"
7+
- Rakefile
8+
- "_site/**/*"
9+
- Manpage.md
10+
11+
# These are included in docs deliberately to show what
12+
# `brew create` does and what the user should replace.
13+
FormulaAudit/Comments:
14+
Enabled: false
15+
16+
# This forces us to use dummy descriptions/homepages in example formulae which we don't need to clutter the docs with.
17+
FormulaAudit/Desc:
18+
Enabled: false
19+
FormulaAudit/Homepage:
20+
Enabled: false
21+
22+
Layout/LineLength:
23+
Exclude:
24+
- Bottles.md # The bottle block line length is long in its full form.
25+
26+
# Apparently Casks are allowed to have constant definitions in blocks and we document this.
27+
Lint/ConstantDefinitionInBlock:
28+
Enabled: false
29+
30+
# A fake regexp is deliberately documented for `inreplace` in the Formula Cookbook.
31+
Style/RedundantRegexpArgument:
32+
Enabled: false

docs/.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3.2

docs/Gemfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
source "https://rubygems.org"
2+
3+
ruby file: ".ruby-version"
4+
5+
gem "github-pages", group: :jekyll_plugins
6+
7+
group :test do
8+
gem "html-proofer"
9+
gem "mdl"
10+
gem "rake"
11+
gem "webrick"
12+
end

docs/Rakefile

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require "rake"
2+
3+
task default: :build
4+
5+
desc "Build the site."
6+
task :build do
7+
sh "jekyll", "build"
8+
end
9+
10+
desc "Run Markdownlint to validate the Markdown style."
11+
task :lint do
12+
sh "mdl $(git ls-files '*.md' | grep -v 'Manpage.md')"
13+
end
14+
15+
desc "Run HTMLProofer to validate the HTML output."
16+
task test: :build do
17+
require "html-proofer"
18+
HTMLProofer.check_directory(
19+
"./_site",
20+
parallel: { in_threads: 4 },
21+
favicon: true,
22+
ignore_status_codes: [0, 403],
23+
check_favicon: true,
24+
check_opengraph: true,
25+
check_html: true,
26+
check_img_http: true,
27+
enforce_https: true,
28+
ignore_files: [
29+
%r{Kickstarter-Supporters},
30+
],
31+
ignore_urls: [
32+
"/",
33+
%r{https://formulae.brew.sh"},
34+
%r{https://github.com/},
35+
'https://legacy.python.org/dev/peps/pep-0453/#recommendations-for-downstream-distributors',
36+
],
37+
cache: {
38+
timeframe: {
39+
external: "1h"
40+
}
41+
}
42+
).run
43+
end

0 commit comments

Comments
 (0)