diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2017-04-28 18:16:55 +0200 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2017-05-23 15:26:35 +0200 |
commit | 25a32cfa1e0b1c7e6af723053bad0f432ffd0b32 (patch) | |
tree | bc6d2958eeedb0b0c15d329ec90cc6d0d90cb919 /support | |
parent | 285c061ed8933c0d94a9ad027f99653039673324 (diff) | |
download | gitlab-shell-25a32cfa1e0b1c7e6af723053bad0f432ffd0b32.tar.gz |
Use gitaly-upload-pack and gitaly-receive-pack
Diffstat (limited to 'support')
-rwxr-xr-x | support/go-test | 12 | ||||
-rw-r--r-- | support/go_build.rb | 33 |
2 files changed, 45 insertions, 0 deletions
diff --git a/support/go-test b/support/go-test new file mode 100755 index 0000000..e4f87b7 --- /dev/null +++ b/support/go-test @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +require_relative 'go_build' +include GoBuild + +def main + create_fresh_build_dir + run!(GO_ENV, %W[go test #{GO_PACKAGE}/...]) + puts 'OK' +end + +main diff --git a/support/go_build.rb b/support/go_build.rb new file mode 100644 index 0000000..82f94d2 --- /dev/null +++ b/support/go_build.rb @@ -0,0 +1,33 @@ +# Helper functions to build go code in gitlab-shell + +require 'fileutils' + +# This will set the ROOT_PATH variable +require_relative '../lib/gitlab_init' + +module GoBuild + GO_DIR = 'go' + BUILD_DIR = File.join(ROOT_PATH, 'go_build') + GO_PACKAGE = File.join('gitlab.com/gitlab-org/gitlab-shell', GO_DIR) + + GO_ENV = { + 'GOPATH' => BUILD_DIR, + 'GO15VENDOREXPERIMENT' => '1', + } + + def create_fresh_build_dir + FileUtils.rm_rf(BUILD_DIR) + build_source_dir = File.join(BUILD_DIR, 'src', GO_PACKAGE) + FileUtils.mkdir_p(build_source_dir) + FileUtils.cp_r(File.join(ROOT_PATH, GO_DIR, '.'), build_source_dir) + end + + def run!(env, cmd) + raise "env must be a hash" unless env.is_a?(Hash) + raise "cmd must be an array" unless cmd.is_a?(Array) + + if !system(env, *cmd) + abort "command failed: #{env.inspect} #{cmd.join(' ')}" + end + end +end |