68 lines
2.6 KiB
Ruby
68 lines
2.6 KiB
Ruby
require "language/go"
|
|
|
|
class GitlabCiMultiRunner < Formula
|
|
desc "The official GitLab CI runner written in Go"
|
|
homepage "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
|
url "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git",
|
|
:tag => "v1.3.3",
|
|
:revision => "6220bd5f0cdb5008ba9488fabcd556959e80dce5"
|
|
head "https://gitlab.com/gitlab-org/gitlab-ci-multi-runner.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "b45ac3284c46efa6e31a29be144c9515427fd058ff3406c0b219cb12d7f74000" => :el_capitan
|
|
sha256 "5de0a8797c284796b5a7fe2d28c58aa36c0802d59d4d8dbdb418f331c199b89f" => :yosemite
|
|
sha256 "d18d86b23af0d6a49091fa7b32337f54f3f05ae56db8f0bea8e4287c5e076ad0" => :mavericks
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "godep" => :build
|
|
depends_on "docker" => :recommended
|
|
|
|
go_resource "github.com/jteeuwen/go-bindata" do
|
|
url "https://github.com/jteeuwen/go-bindata.git",
|
|
:revision => "a0ff2567cfb70903282db057e799fd826784d41d"
|
|
end
|
|
|
|
resource "prebuilt-x86_64.tar.gz" do
|
|
url "https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.3.3/docker/prebuilt-x86_64.tar.gz",
|
|
:using => :nounzip
|
|
version "1.3.3"
|
|
sha256 "5ae536cb7598607f1a0d4c0cb7f31d83d6c19e386106ea50192933a726f33ca9"
|
|
end
|
|
|
|
def install
|
|
mkdir_p buildpath/"src/gitlab.com/gitlab-org"
|
|
ln_sf buildpath, buildpath/"src/gitlab.com/gitlab-org/gitlab-ci-multi-runner"
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
ENV.prepend_create_path "PATH", buildpath/"bin"
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
cd buildpath/"src/github.com/jteeuwen/go-bindata/go-bindata" do
|
|
system "go", "install"
|
|
end
|
|
|
|
resource("prebuilt-x86_64.tar.gz").stage do
|
|
system "go-bindata", "-pkg", "docker", "-nocompress", "-nomemcopy", "-nometadata", "-o", buildpath/"executors/docker/bindata.go", "prebuilt-x86_64.tar.gz"
|
|
end
|
|
|
|
cd "src/gitlab.com/gitlab-org/gitlab-ci-multi-runner" do
|
|
commit_sha = `git rev-parse --short HEAD`
|
|
|
|
# Disable vendor support for go 1.5 and above
|
|
ENV["GO15VENDOREXPERIMENT"] = "0"
|
|
|
|
# Copy from Makefile
|
|
system "godep", "go", "build", "-o", "gitlab-ci-multi-runner", "-ldflags", "-X main.NAME=gitlab-ci-multi-runner -X main.VERSION=#{version} -X main.REVISION=#{commit_sha}"
|
|
bin.install "gitlab-ci-multi-runner"
|
|
bin.install_symlink "#{bin}/gitlab-ci-multi-runner" => "gitlab-runner"
|
|
end
|
|
end
|
|
|
|
test do
|
|
assert_match "Version: #{version}", shell_output("#{bin}/gitlab-ci-multi-runner --version")
|
|
assert_match "Version: #{version}", shell_output("#{bin}/gitlab-runner --version")
|
|
end
|
|
end
|