gembrew 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +44 -27
- data/lib/gembrew/adder.rb +9 -5
- data/lib/gembrew/commands/build.rb +1 -1
- data/lib/gembrew/commands/shell.rb +1 -1
- data/lib/gembrew/config.rb +17 -19
- data/lib/gembrew/docker_check.rb +6 -5
- data/lib/gembrew/docker_runner.rb +10 -5
- data/lib/gembrew/generator.rb +15 -10
- data/lib/gembrew/templates/README.md.erb +13 -0
- data/lib/gembrew/templates/formula.rb.erb +16 -6
- data/lib/gembrew/templates/gembrew.yml.erb +5 -5
- data/lib/gembrew/templates/test.yml +69 -29
- data/lib/gembrew/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b5f610bdf10a353ade54ab13743f154b56d0af7e5aceac0d6b3364135520f97
|
|
4
|
+
data.tar.gz: dd0daaec17e0f724b80f477b0f2c0ab68e5e02ebfef7248ca5cb8a4cd1164390
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a09ac710d80edfb925b6e8935df241c05b3cec090f9ae21c24fb19ab9b0d7fcb04ef867c8b6959303e4d276d00f82acfe65b1d31acf40d3eb81c030a6567ca6
|
|
7
|
+
data.tar.gz: a458d322068a01abbb692df5919efb9be8bec07edcf1e518d569bfa019befde0dd3d03e7916b7656f831de5a6391b7b402ab47b47ffc1a749bf610fc2aa92fdb
|
data/README.md
CHANGED
|
@@ -21,9 +21,10 @@ gembrew check
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
`init` creates a tap repository containing `README.md`, `gembrew/`, `Formula/`,
|
|
24
|
-
and a GitHub Actions workflow that
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
and a GitHub Actions workflow that uses Homebrew's `test-bot` on Linux, Apple
|
|
25
|
+
Silicon, and Intel macOS. Pull requests test changed formulae; pushes, scheduled
|
|
26
|
+
runs, and manual runs test every formula. It accepts an empty directory or an
|
|
27
|
+
existing tap containing `Formula/`.
|
|
27
28
|
Supplying a gem name also creates its first configuration. The gem name is
|
|
28
29
|
optional, so `gembrew init` can prepare an empty tap or add Gembrew to an
|
|
29
30
|
existing one. Existing README and workflow files are never overwritten.
|
|
@@ -36,27 +37,34 @@ README.md
|
|
|
36
37
|
workflows/
|
|
37
38
|
test.yml
|
|
38
39
|
gembrew/
|
|
39
|
-
example
|
|
40
|
+
example/
|
|
41
|
+
formula.yml
|
|
42
|
+
test.rb
|
|
40
43
|
Formula/
|
|
41
44
|
```
|
|
42
45
|
|
|
43
|
-
`gembrew/example.yml` contains:
|
|
46
|
+
`gembrew/example/formula.yml` contains the gem metadata and source:
|
|
44
47
|
|
|
45
48
|
```yaml
|
|
46
49
|
gem: example
|
|
50
|
+
version: "" # required
|
|
51
|
+
source:
|
|
52
|
+
type: rubygems
|
|
53
|
+
```
|
|
47
54
|
|
|
48
|
-
test:
|
|
49
|
-
|
|
55
|
+
`gembrew/example/test.rb` contains the generated default test:
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
system bin/"example", "--version"
|
|
50
59
|
```
|
|
51
60
|
|
|
52
|
-
Edit
|
|
61
|
+
Edit these files as needed, then generate `Formula/example.rb`:
|
|
53
62
|
|
|
54
63
|
```shell
|
|
55
64
|
gembrew build
|
|
56
65
|
```
|
|
57
66
|
|
|
58
|
-
Each
|
|
59
|
-
with:
|
|
67
|
+
Each directory under `gembrew/` describes one formula. Add more published gems with:
|
|
60
68
|
|
|
61
69
|
```shell
|
|
62
70
|
gembrew add another-gem
|
|
@@ -69,10 +77,9 @@ generate just one:
|
|
|
69
77
|
gembrew build example
|
|
70
78
|
```
|
|
71
79
|
|
|
72
|
-
The required settings are `gem`, `version`,
|
|
73
|
-
or `test_from_file`.
|
|
80
|
+
The required settings in `formula.yml` are `gem`, `version`, and `source`.
|
|
74
81
|
The output defaults to `Formula/NAME.rb`, where `NAME` is the configuration
|
|
75
|
-
|
|
82
|
+
directory name. Relative output paths are resolved from the tap root.
|
|
76
83
|
|
|
77
84
|
```yaml
|
|
78
85
|
gem: example
|
|
@@ -89,20 +96,29 @@ executable: example
|
|
|
89
96
|
# Optional additional Homebrew formula dependencies:
|
|
90
97
|
dependencies:
|
|
91
98
|
- bash
|
|
99
|
+
- bash :macos_only
|
|
92
100
|
- libffi :system_on_macos
|
|
93
101
|
|
|
94
|
-
# Optional output override. The default for gembrew/example
|
|
102
|
+
# Optional output override. The default for gembrew/example is shown here.
|
|
95
103
|
output: Formula/example.rb
|
|
104
|
+
```
|
|
96
105
|
|
|
97
|
-
|
|
98
|
-
|
|
106
|
+
Tag a dependency with `:system_on_macos` when macOS provides it and Homebrew
|
|
107
|
+
should install its formula only on other platforms. Tag it with `:macos_only`
|
|
108
|
+
when Homebrew should install it only on macOS.
|
|
109
|
+
|
|
110
|
+
You may add these optional Ruby hook files beside `formula.yml`:
|
|
99
111
|
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
```text
|
|
113
|
+
install_extra.rb Runs after the standard gem installation
|
|
114
|
+
test.rb Defines the formula test
|
|
102
115
|
```
|
|
103
116
|
|
|
104
|
-
|
|
105
|
-
|
|
117
|
+
Gembrew generates a basic `COMMAND --version` test when `test.rb` is absent.
|
|
118
|
+
`gembrew init GEM` and `gembrew add GEM` create that test file so it can be
|
|
119
|
+
replaced with a meaningful functional test. Gembrew inserts `install_extra.rb`
|
|
120
|
+
at the end of the formula's `install` method, after installing the gem and
|
|
121
|
+
creating its executable wrapper.
|
|
106
122
|
|
|
107
123
|
To build the root gem from a GitHub tag while continuing to fetch its
|
|
108
124
|
dependencies from RubyGems, use:
|
|
@@ -133,15 +149,16 @@ The repository is mounted as a local tap, so formulae can be addressed by gem
|
|
|
133
149
|
name inside the shell:
|
|
134
150
|
|
|
135
151
|
```shell
|
|
136
|
-
brew style example
|
|
137
|
-
brew audit --new --online example
|
|
138
|
-
brew install --build-from-source example
|
|
139
|
-
brew test example
|
|
140
|
-
brew linkage --test example
|
|
152
|
+
brew style gembrew/tap/example
|
|
153
|
+
brew audit --new --online gembrew/tap/example
|
|
154
|
+
brew install --build-from-source gembrew/tap/example
|
|
155
|
+
brew test gembrew/tap/example
|
|
156
|
+
brew linkage --test gembrew/tap/example
|
|
141
157
|
```
|
|
142
158
|
|
|
143
|
-
To
|
|
144
|
-
Homebrew
|
|
159
|
+
To use a stock, current Homebrew container without mounting the local
|
|
160
|
+
repository or changing Homebrew's update, API, or cleanup behavior, open a
|
|
161
|
+
pristine shell:
|
|
145
162
|
|
|
146
163
|
```shell
|
|
147
164
|
gembrew shell --pristine
|
data/lib/gembrew/adder.rb
CHANGED
|
@@ -18,18 +18,22 @@ module Gembrew
|
|
|
18
18
|
raise Error, "Directory is not a Homebrew tap: #{project_path} (Formula/ does not exist)"
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
raise Error, "Gem configuration already exists: #{
|
|
21
|
+
gembrew_directory.mkpath
|
|
22
|
+
raise Error, "Gem configuration already exists: #{config_directory}" if config_directory.exist?
|
|
23
23
|
|
|
24
|
+
config_directory.mkpath
|
|
24
25
|
config_path.write render
|
|
25
|
-
|
|
26
|
+
test_path.write %[system bin/"#{gem_name}", "--version"\n]
|
|
27
|
+
config_directory
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
private
|
|
29
31
|
|
|
30
32
|
def formula_path = project_path/'Formula'
|
|
31
|
-
def
|
|
32
|
-
def
|
|
33
|
+
def gembrew_directory = project_path/'gembrew'
|
|
34
|
+
def config_directory = gembrew_directory/gem_name
|
|
35
|
+
def config_path = config_directory/'formula.yml'
|
|
36
|
+
def test_path = config_directory/'test.rb'
|
|
33
37
|
|
|
34
38
|
def render
|
|
35
39
|
template = Pathname(__dir__)/'templates/gembrew.yml.erb'
|
|
@@ -4,7 +4,7 @@ require 'gembrew/generator'
|
|
|
4
4
|
module Gembrew
|
|
5
5
|
module Commands
|
|
6
6
|
class Build < MisterBin::Command
|
|
7
|
-
help 'Generate Homebrew formulae from gembrew
|
|
7
|
+
help 'Generate Homebrew formulae from gembrew/*/formula.yml'
|
|
8
8
|
|
|
9
9
|
usage 'gembrew build [GEM]'
|
|
10
10
|
usage 'gembrew build (-h|--help)'
|
|
@@ -9,7 +9,7 @@ module Gembrew
|
|
|
9
9
|
usage 'gembrew shell [--pristine]'
|
|
10
10
|
usage 'gembrew shell (-h|--help)'
|
|
11
11
|
|
|
12
|
-
option '-p --pristine', 'Open
|
|
12
|
+
option '-p --pristine', 'Open a stock, current Homebrew container'
|
|
13
13
|
|
|
14
14
|
def run
|
|
15
15
|
DockerShell.new.call pristine: args['--pristine']
|
data/lib/gembrew/config.rb
CHANGED
|
@@ -6,19 +6,21 @@ module Gembrew
|
|
|
6
6
|
class Config
|
|
7
7
|
Dependency = Data.define(:name, :tags) do
|
|
8
8
|
def system_on_macos? = tags.include? :system_on_macos
|
|
9
|
+
def macos_only? = tags.include? :macos_only
|
|
9
10
|
end
|
|
10
11
|
|
|
11
|
-
DEPENDENCY_TAGS = %w[:system_on_macos].freeze
|
|
12
|
+
DEPENDENCY_TAGS = %w[:macos_only :system_on_macos].freeze
|
|
12
13
|
DIRECTORY = 'gembrew'
|
|
14
|
+
FILENAME = 'formula.yml'
|
|
13
15
|
ALLOWED_KEYS = %w[
|
|
14
|
-
gem version source output desc homepage license executable dependencies
|
|
16
|
+
gem version source output desc homepage license executable dependencies
|
|
15
17
|
].freeze
|
|
16
18
|
|
|
17
19
|
attr_reader :path, :project_path
|
|
18
20
|
|
|
19
21
|
def self.all(project_path = Pathname.pwd)
|
|
20
22
|
project_path = Pathname(project_path).expand_path
|
|
21
|
-
paths = (project_path/DIRECTORY).glob(
|
|
23
|
+
paths = (project_path/DIRECTORY).glob("*/#{FILENAME}").sort
|
|
22
24
|
raise Error, "No gem configurations found in #{project_path/DIRECTORY}" if paths.empty?
|
|
23
25
|
|
|
24
26
|
paths.map { |path| new path, project_path: project_path }
|
|
@@ -27,7 +29,7 @@ module Gembrew
|
|
|
27
29
|
def self.find(name, project_path = Pathname.pwd)
|
|
28
30
|
validate_name! name
|
|
29
31
|
project_path = Pathname(project_path).expand_path
|
|
30
|
-
new project_path/DIRECTORY/
|
|
32
|
+
new project_path/DIRECTORY/name/FILENAME, project_path: project_path
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
def self.validate_name!(name)
|
|
@@ -43,7 +45,7 @@ module Gembrew
|
|
|
43
45
|
validate
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
def name = path.basename
|
|
48
|
+
def name = path.dirname.basename.to_s
|
|
47
49
|
def gem_name = data.fetch('gem').to_s
|
|
48
50
|
def version = data['version']&.to_s
|
|
49
51
|
def source = data.fetch('source')
|
|
@@ -61,16 +63,8 @@ module Gembrew
|
|
|
61
63
|
@dependencies ||= data.fetch('dependencies', []).map { |value| parse_dependency value }
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
def
|
|
65
|
-
|
|
66
|
-
data.fetch('test').to_s
|
|
67
|
-
else
|
|
68
|
-
test_path = project_path/data.fetch('test_from_file')
|
|
69
|
-
raise Error, "Test file does not exist: #{test_path}" unless test_path.file?
|
|
70
|
-
|
|
71
|
-
test_path.read
|
|
72
|
-
end
|
|
73
|
-
end
|
|
66
|
+
def install_extra_body = hook_body 'install_extra.rb'
|
|
67
|
+
def test_body = hook_body 'test.rb'
|
|
74
68
|
|
|
75
69
|
private
|
|
76
70
|
|
|
@@ -95,10 +89,6 @@ module Gembrew
|
|
|
95
89
|
require_value 'source'
|
|
96
90
|
validate_source
|
|
97
91
|
validate_dependencies
|
|
98
|
-
|
|
99
|
-
return unless data.has_key?('test') == data.has_key?('test_from_file')
|
|
100
|
-
|
|
101
|
-
raise Error, 'Provide exactly one of test or test_from_file'
|
|
102
92
|
end
|
|
103
93
|
|
|
104
94
|
def require_value(key)
|
|
@@ -169,5 +159,13 @@ module Gembrew
|
|
|
169
159
|
|
|
170
160
|
Dependency.new(name:, tags: values.map { |tag| tag.delete_prefix(':').to_sym }.freeze)
|
|
171
161
|
end
|
|
162
|
+
|
|
163
|
+
def hook_body(filename)
|
|
164
|
+
hook_path = path.dirname/filename
|
|
165
|
+
return unless hook_path.file?
|
|
166
|
+
|
|
167
|
+
body = hook_path.read
|
|
168
|
+
body unless body.strip.empty?
|
|
169
|
+
end
|
|
172
170
|
end
|
|
173
171
|
end
|
data/lib/gembrew/docker_check.rb
CHANGED
|
@@ -24,16 +24,17 @@ module Gembrew
|
|
|
24
24
|
<<~BASH
|
|
25
25
|
caption() { printf '\\n\\033[1;34m==> gembrew: %s\\033[0m\\n' "$1"; }
|
|
26
26
|
formula=#{formula}
|
|
27
|
+
qualified_formula="gembrew/tap/$formula"
|
|
27
28
|
caption "styling $formula"
|
|
28
|
-
brew style "$
|
|
29
|
+
brew style "$qualified_formula"
|
|
29
30
|
caption "auditing $formula"
|
|
30
|
-
brew audit --new --online "$
|
|
31
|
+
brew audit --new --online "$qualified_formula"
|
|
31
32
|
caption "installing $formula"
|
|
32
|
-
brew install --build-from-source "$
|
|
33
|
+
brew install --build-from-source "$qualified_formula"
|
|
33
34
|
caption "testing $formula"
|
|
34
|
-
brew test "$
|
|
35
|
+
brew test "$qualified_formula"
|
|
35
36
|
caption "checking linkage for $formula"
|
|
36
|
-
brew linkage --test "$
|
|
37
|
+
brew linkage --test "$qualified_formula"
|
|
37
38
|
BASH
|
|
38
39
|
end
|
|
39
40
|
end
|
|
@@ -14,6 +14,7 @@ module Gembrew
|
|
|
14
14
|
|
|
15
15
|
def call(*command, interactive: false, pristine: false)
|
|
16
16
|
docker_command = ['docker', 'run', '--rm', '--init', '--name', container_name]
|
|
17
|
+
docker_command << '--pull=always' if pristine
|
|
17
18
|
docker_command << '-it' if interactive
|
|
18
19
|
docker_command.concat environment(interactive: interactive, pristine: pristine)
|
|
19
20
|
unless pristine
|
|
@@ -31,11 +32,15 @@ module Gembrew
|
|
|
31
32
|
attr_reader :command_runner
|
|
32
33
|
|
|
33
34
|
def environment(interactive:, pristine:)
|
|
34
|
-
result =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
result = if pristine
|
|
36
|
+
[]
|
|
37
|
+
else
|
|
38
|
+
%w[
|
|
39
|
+
--env HOMEBREW_NO_AUTO_UPDATE=1
|
|
40
|
+
--env HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
41
|
+
--env HOMEBREW_NO_INSTALL_FROM_API=1
|
|
42
|
+
]
|
|
43
|
+
end
|
|
39
44
|
prompt = pristine ? 'homebrew' : 'gembrew'
|
|
40
45
|
result.push '--env', "PS1=\\n\\n#{prompt} $ " if interactive
|
|
41
46
|
result
|
data/lib/gembrew/generator.rb
CHANGED
|
@@ -35,19 +35,24 @@ module Gembrew
|
|
|
35
35
|
|
|
36
36
|
def metadata(spec)
|
|
37
37
|
{
|
|
38
|
-
description:
|
|
39
|
-
homepage:
|
|
40
|
-
license:
|
|
41
|
-
executable:
|
|
42
|
-
source_type:
|
|
43
|
-
source_repo:
|
|
44
|
-
source_tag:
|
|
45
|
-
source_gemspec:
|
|
46
|
-
dependencies:
|
|
47
|
-
|
|
38
|
+
description: config.description || spec.summary,
|
|
39
|
+
homepage: config.homepage || inferred_homepage(spec),
|
|
40
|
+
license: config.license || spec.license || spec.licenses.first,
|
|
41
|
+
executable: executable(spec),
|
|
42
|
+
source_type: config.source_type,
|
|
43
|
+
source_repo: config.source_repo,
|
|
44
|
+
source_tag: config.source_tag,
|
|
45
|
+
source_gemspec: config.source_gemspec,
|
|
46
|
+
dependencies: formula_dependencies,
|
|
47
|
+
install_extra_body: config.install_extra_body,
|
|
48
|
+
test_body: config.test_body || %[system bin/#{executable(spec).inspect}, "--version"\n],
|
|
48
49
|
}
|
|
49
50
|
end
|
|
50
51
|
|
|
52
|
+
def executable(spec)
|
|
53
|
+
config.executable || spec.executables.first || spec.name
|
|
54
|
+
end
|
|
55
|
+
|
|
51
56
|
def formula_dependencies
|
|
52
57
|
([Config::Dependency.new(name: 'ruby', tags: [])] + config.dependencies)
|
|
53
58
|
.uniq(&:name)
|
|
@@ -23,6 +23,11 @@ Install [Gembrew](https://github.com/DannyBen/gembrew):
|
|
|
23
23
|
gem install gembrew
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
The generated GitHub Actions workflow uses Homebrew's `test-bot` on Linux,
|
|
27
|
+
Apple Silicon, and Intel macOS. Pull requests test changed formulae; pushes,
|
|
28
|
+
and manual runs test every formula. Homebrew style checks apply only to files in
|
|
29
|
+
`Formula/`; Gembrew's Ruby hook files are not standalone Homebrew formulae.
|
|
30
|
+
|
|
26
31
|
Generate all formulae:
|
|
27
32
|
|
|
28
33
|
```shell
|
|
@@ -48,6 +53,14 @@ Add another Ruby gem:
|
|
|
48
53
|
gembrew add another-gem
|
|
49
54
|
```
|
|
50
55
|
|
|
56
|
+
Each gem has a `gembrew/NAME/formula.yml` configuration. You may add these
|
|
57
|
+
optional Ruby hook files beside it:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
install_extra.rb Runs after the standard gem installation
|
|
61
|
+
test.rb Defines the formula test
|
|
62
|
+
```
|
|
63
|
+
|
|
51
64
|
Open an interactive Homebrew environment:
|
|
52
65
|
|
|
53
66
|
```shell
|
|
@@ -9,17 +9,26 @@ class <%= formula_name %> < Formula
|
|
|
9
9
|
sha256 "<%= sha256 %>"
|
|
10
10
|
license <%= license.inspect %>
|
|
11
11
|
|
|
12
|
-
<% formula_dependencies = dependencies.reject
|
|
12
|
+
<% formula_dependencies = dependencies.reject { |dependency| dependency.system_on_macos? || dependency.macos_only? } -%>
|
|
13
13
|
<% macos_dependencies = dependencies.select(&:system_on_macos?) -%>
|
|
14
|
+
<% macos_only_dependencies = dependencies.select(&:macos_only?) -%>
|
|
14
15
|
<% formula_dependencies.each do |dependency| -%>
|
|
15
16
|
depends_on <%= dependency.name.inspect %>
|
|
16
17
|
<% end -%>
|
|
17
|
-
<% if formula_dependencies.any? && macos_dependencies.any? -%>
|
|
18
|
+
<% if formula_dependencies.any? && (macos_dependencies.any? || macos_only_dependencies.any?) -%>
|
|
18
19
|
|
|
19
20
|
<% end -%>
|
|
20
21
|
<% macos_dependencies.each do |dependency| -%>
|
|
21
22
|
uses_from_macos <%= dependency.name.inspect %>
|
|
22
23
|
<% end -%>
|
|
24
|
+
<% if macos_only_dependencies.any? -%>
|
|
25
|
+
|
|
26
|
+
on_macos do
|
|
27
|
+
<% macos_only_dependencies.each do |dependency| -%>
|
|
28
|
+
depends_on <%= dependency.name.inspect %>
|
|
29
|
+
<% end -%>
|
|
30
|
+
end
|
|
31
|
+
<% end -%>
|
|
23
32
|
<% resources.each do |resource| -%>
|
|
24
33
|
|
|
25
34
|
resource <%= resource.name.inspect %> do
|
|
@@ -45,13 +54,14 @@ class <%= formula_name %> < Formula
|
|
|
45
54
|
"--ignore-dependencies", "--install-dir", libexec, "--no-document"
|
|
46
55
|
<% end -%>
|
|
47
56
|
|
|
48
|
-
rm libexec.glob("extensions/*/*/*/mkmf.log")
|
|
49
|
-
deuniversalize_machos if OS.mac?
|
|
50
|
-
|
|
51
57
|
(bin/<%= executable.inspect %>).write_env_script libexec/"bin/<%= executable %>", GEM_HOME: ENV.fetch("GEM_HOME")
|
|
58
|
+
<% if install_extra_body -%>
|
|
59
|
+
|
|
60
|
+
<%= install_extra_body.lines(chomp: true).map { |line| line.strip.empty? ? '' : " #{line}" }.join("\n") %>
|
|
61
|
+
<% end -%>
|
|
52
62
|
end
|
|
53
63
|
|
|
54
64
|
test do
|
|
55
|
-
<%= test_body.lines.map { |line| " #{line}" }.join %>
|
|
65
|
+
<%= test_body.lines(chomp: true).map { |line| line.strip.empty? ? '' : " #{line}" }.join("\n") %>
|
|
56
66
|
end
|
|
57
67
|
end
|
|
@@ -12,9 +12,6 @@ source:
|
|
|
12
12
|
# tag: v1.2.3 # optional; defaults to vVERSION
|
|
13
13
|
# gemspec: <%= gem_name %>.gemspec # optional; defaults to GEMNAME.gemspec
|
|
14
14
|
|
|
15
|
-
test: |-
|
|
16
|
-
system bin/"<%= gem_name %>", "--version"
|
|
17
|
-
|
|
18
15
|
# Optional metadata and formula overrides:
|
|
19
16
|
# desc: Example command-line application
|
|
20
17
|
# homepage: https://example.com
|
|
@@ -23,7 +20,10 @@ test: |-
|
|
|
23
20
|
# output: Formula/<%= gem_name %>.rb
|
|
24
21
|
# dependencies:
|
|
25
22
|
# - bash
|
|
23
|
+
# - bash :macos_only
|
|
26
24
|
# - libffi :system_on_macos
|
|
27
25
|
|
|
28
|
-
#
|
|
29
|
-
#
|
|
26
|
+
# Optional Ruby hook files:
|
|
27
|
+
#
|
|
28
|
+
# install_extra.rb Runs after the standard gem installation
|
|
29
|
+
# test.rb Defines the formula test
|
|
@@ -8,58 +8,98 @@ on:
|
|
|
8
8
|
pull_request:
|
|
9
9
|
workflow_dispatch:
|
|
10
10
|
|
|
11
|
-
permissions:
|
|
12
|
-
|
|
11
|
+
permissions: {}
|
|
12
|
+
|
|
13
|
+
defaults:
|
|
14
|
+
run:
|
|
15
|
+
shell: bash -xeuo pipefail {0}
|
|
13
16
|
|
|
14
17
|
jobs:
|
|
15
|
-
test:
|
|
18
|
+
test-bot:
|
|
16
19
|
name: ${{ matrix.os }}
|
|
17
20
|
runs-on: ${{ matrix.os }}
|
|
21
|
+
timeout-minutes: 60
|
|
22
|
+
container: ${{ fromJSON(toJSON(matrix.container)) }} # zizmor: ignore[unpinned-images]
|
|
18
23
|
strategy:
|
|
19
24
|
fail-fast: false
|
|
20
25
|
matrix:
|
|
21
26
|
os:
|
|
22
|
-
-
|
|
23
|
-
- macos-
|
|
27
|
+
- macos-26
|
|
28
|
+
- macos-15-intel
|
|
29
|
+
include:
|
|
30
|
+
- os: ubuntu-latest
|
|
31
|
+
container:
|
|
32
|
+
image: ghcr.io/homebrew/brew:main
|
|
33
|
+
options: --privileged
|
|
34
|
+
permissions:
|
|
35
|
+
actions: read
|
|
36
|
+
checks: read
|
|
37
|
+
contents: read
|
|
38
|
+
pull-requests: read
|
|
24
39
|
|
|
25
40
|
steps:
|
|
26
41
|
- name: Set up Homebrew
|
|
27
42
|
id: set-up-homebrew
|
|
28
|
-
uses: Homebrew/actions/setup-homebrew@
|
|
43
|
+
uses: Homebrew/actions/setup-homebrew@b35a29a0f83ee8b8ca07b219fc8db3d7bb88ab49 # 2026.08.10.2
|
|
44
|
+
with:
|
|
45
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
29
46
|
|
|
30
47
|
- name: Cache Homebrew Bundler gems
|
|
31
|
-
id: cache
|
|
32
48
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
33
49
|
with:
|
|
34
50
|
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
|
|
35
|
-
key: ${{
|
|
36
|
-
restore-keys: ${{
|
|
51
|
+
key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
|
|
52
|
+
restore-keys: ${{ matrix.os }}-rubygems-
|
|
53
|
+
|
|
54
|
+
- name: Clean runner
|
|
55
|
+
run: brew test-bot --only-cleanup-before
|
|
56
|
+
|
|
57
|
+
- name: Set up test-bot
|
|
58
|
+
run: brew test-bot --only-setup
|
|
59
|
+
|
|
60
|
+
- name: Check tap syntax
|
|
61
|
+
run: |
|
|
62
|
+
tap="${GITHUB_REPOSITORY/homebrew-/}"
|
|
63
|
+
tap_path="${{ steps.set-up-homebrew.outputs.repository-path }}"
|
|
64
|
+
brew style "$tap_path/Formula"
|
|
65
|
+
brew readall --aliases --os=all --arch=all "$tap"
|
|
66
|
+
brew audit --except=installed --tap="$tap"
|
|
37
67
|
|
|
38
|
-
- name:
|
|
39
|
-
if:
|
|
40
|
-
run: brew
|
|
68
|
+
- name: Test changed formulae
|
|
69
|
+
if: github.event_name == 'pull_request'
|
|
70
|
+
run: brew test-bot --only-formulae
|
|
41
71
|
|
|
42
|
-
- name:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
- name: Collect all formulae
|
|
73
|
+
id: all-formulae
|
|
74
|
+
if: github.event_name != 'pull_request'
|
|
46
75
|
run: |
|
|
47
76
|
shopt -s nullglob
|
|
48
|
-
|
|
77
|
+
tap_path="${{ steps.set-up-homebrew.outputs.repository-path }}"
|
|
78
|
+
paths=("$tap_path"/Formula/*.rb)
|
|
49
79
|
|
|
50
|
-
if (( ${#
|
|
51
|
-
echo "No formulae found in Formula/"
|
|
80
|
+
if (( ${#paths[@]} == 0 )); then
|
|
81
|
+
echo "No formulae found in $tap_path/Formula/"
|
|
52
82
|
exit 1
|
|
53
83
|
fi
|
|
54
84
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
brew style "$formula"
|
|
60
|
-
brew audit --new --online "$formula_name"
|
|
61
|
-
brew install --build-from-source "$formula_name"
|
|
62
|
-
brew test "$formula_name"
|
|
63
|
-
brew linkage --test "$formula_name"
|
|
64
|
-
brew uninstall "$formula_name"
|
|
85
|
+
formulae=()
|
|
86
|
+
for path in "${paths[@]}"; do
|
|
87
|
+
formula="${path##*/}"
|
|
88
|
+
formulae+=("${formula%.rb}")
|
|
65
89
|
done
|
|
90
|
+
|
|
91
|
+
joined=$(IFS=,; echo "${formulae[*]}")
|
|
92
|
+
echo "formulae=${joined}" >> "$GITHUB_OUTPUT"
|
|
93
|
+
|
|
94
|
+
- name: Test all formulae
|
|
95
|
+
if: github.event_name != 'pull_request'
|
|
96
|
+
run: >-
|
|
97
|
+
brew test-bot --only-formulae
|
|
98
|
+
--testing-formulae="${{ steps.all-formulae.outputs.formulae }}"
|
|
99
|
+
|
|
100
|
+
- name: Upload bottles as artifacts
|
|
101
|
+
if: always() && github.event_name == 'pull_request'
|
|
102
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
103
|
+
with:
|
|
104
|
+
name: bottles_${{ matrix.os }}
|
|
105
|
+
path: "*.bottle.*"
|
data/lib/gembrew/version.rb
CHANGED