Formula/gitbay-runner.rb
40 lines · 1308 bytes
1class GitbayRunner < Formula
2 desc "CI runner for gitbay: builds the repositories you attach it to"
3 homepage "https://gitbay.org/krz/gitbay"
4 url "https://gitbay.org/krz/gitbay.git",
5 tag: "v1.48.0",
6 revision: "e92e4b9b60fd1606e1817cd6dfae0122628986db"
7 license "0BSD"
8 head "https://gitbay.org/krz/gitbay.git", branch: "main"
9
10 depends_on "go" => :build
11
12 def install
13 system "go", "build", *std_go_args(ldflags: "-s -w"), "./cmd/gitbay-runner"
14 end
15
16 service do
17 # No arguments: the runner reads ~/.config/gitbay-runner/config.toml,
18 # which `gitbay-runner init` writes.
19 run [opt_bin/"gitbay-runner"]
20 keep_alive true
21 log_path var/"log/gitbay-runner.log"
22 error_log_path var/"log/gitbay-runner.err.log"
23 end
24
25 def caveats
26 <<~EOS
27 Generate this machine's key and config, and print the key to attach:
28 gitbay-runner init -remote git@gitbay.org
29 Attach it to each repository it should build, as a repository admin:
30 gitbay repo runner add owner/name < ~/.config/gitbay-runner/id_ed25519.pub
31 Then:
32 brew services start krz/tap/gitbay-runner
33 EOS
34 end
35
36 test do
37 # -version prints the commit the binary was built from.
38 assert_match(/\A[0-9a-f]{12}/, shell_output("#{bin}/gitbay-runner -version"))
39 end
40end