Commit 7b23c6f0 authored by Nick Thomas's avatar Nick Thomas

Merge branch '194-add-makefile-to-make-things-easier' into 'master'

Add Makefile for easier building and testing

Closes #194

See merge request gitlab-org/gitlab-shell!310
parents e896becc fdfc4ab0
...@@ -15,8 +15,7 @@ before_script: ...@@ -15,8 +15,7 @@ before_script:
# primarily regression tests for particular versions of Ruby. # primarily regression tests for particular versions of Ruby.
# #
# The full rspec suite is also run against each suppported golang version # The full rspec suite is also run against each suppported golang version
- cp bin/gitlab-shell-ruby bin/gitlab-shell - make test_ruby
- bundle exec rspec --color --tag ~go --format d spec
rspec: rspec:
<<: *rspec_definition <<: *rspec_definition
...@@ -25,9 +24,9 @@ rspec: ...@@ -25,9 +24,9 @@ rspec:
except: except:
- tags - tags
rubocop: verify_ruby:
script: script:
- bundle exec rubocop - make verify_ruby
tags: tags:
- ruby - ruby
except: except:
...@@ -77,13 +76,11 @@ rspec:ruby2.1: ...@@ -77,13 +76,11 @@ rspec:ruby2.1:
script: script:
- go version - go version
- which go - which go
- bin/compile - make build verify_golang test_golang
- support/go-test
- support/go-format check
# Run the full Ruby test suite in the "go" tests. As more functionality is # Run the full Ruby test suite in the "go" tests. As more functionality is
# migrated into these tests and out of Ruby, the amount of work here will # migrated into these tests and out of Ruby, the amount of work here will
# reduce # reduce
- bundle exec rspec --color --format d spec - make test_ruby
go:1.11: go:1.11:
<<: *go_definition <<: *go_definition
...@@ -111,7 +108,6 @@ codequality: ...@@ -111,7 +108,6 @@ codequality:
artifacts: artifacts:
paths: [codeclimate.json] paths: [codeclimate.json]
sast: sast:
image: docker:stable image: docker:stable
variables: variables:
......
.PHONY: test test_ruby test_ruby_rubocop test_ruby_rspec test_go test_go_format test_go_test
validate: verify test
verify: verify_ruby verify_golang
verify_ruby:
bundle exec rubocop
verify_golang:
support/go-format check
test: test_ruby test_golang
test_ruby:
# bin/gitlab-shell must exist and needs to be the Ruby version for
# rspec to be able to test.
cp bin/gitlab-shell-ruby bin/gitlab-shell
bundle exec rspec --color --tag '~go' --format d spec
rm -f bin/gitlab-shell
test_golang:
support/go-test
setup: compile
build: compile
compile:
bin/install
bin/compile
check:
bin/check
clean:
rm -f bin/gitlab-shell
...@@ -15,8 +15,8 @@ If you access a GitLab server over HTTP(S) you end up in [gitlab-workhorse](http ...@@ -15,8 +15,8 @@ If you access a GitLab server over HTTP(S) you end up in [gitlab-workhorse](http
An overview of the four cases described above: An overview of the four cases described above:
1. git pull over ssh -> gitlab-shell -> API call to gitlab-rails (Authorization) -> accept or decline -> establish Gitaly session 1. git pull over SSH -> gitlab-shell -> API call to gitlab-rails (Authorization) -> accept or decline -> establish Gitaly session
1. git push over ssh -> gitlab-shell (git command is not executed yet) -> establish Gitaly session -> (in Gitaly) gitlab-shell pre-receive hook -> API call to gitlab-rails (authorization) -> accept or decline push 1. git push over SSH -> gitlab-shell (git command is not executed yet) -> establish Gitaly session -> (in Gitaly) gitlab-shell pre-receive hook -> API call to gitlab-rails (authorization) -> accept or decline push
## Git hooks ## Git hooks
...@@ -68,12 +68,13 @@ To install gitlab-shell you also need a Go compiler version 1.8 or newer. https: ...@@ -68,12 +68,13 @@ To install gitlab-shell you also need a Go compiler version 1.8 or newer. https:
## Setup ## Setup
./bin/install make setup
./bin/compile
## Check ## Check
./bin/check Checks if GitLab API access and redis via internal API can be reached:
make check
## Keys ## Keys
...@@ -89,14 +90,27 @@ List all keys: ...@@ -89,14 +90,27 @@ List all keys:
./bin/gitlab-keys list-keys ./bin/gitlab-keys list-keys
Remove all keys from authorized_keys file: Remove all keys from authorized_keys file:
./bin/gitlab-keys clear ./bin/gitlab-keys clear
## Testing
Run Ruby and Golang tests:
make test
Run Rubocop and gofmt:
make verify
Run both test and verify (the default Makefile target):
make validate
## Git LFS remark ## Git LFS remark
Starting with GitLab 8.12, GitLab supports Git LFS authentication through ssh. Starting with GitLab 8.12, GitLab supports Git LFS authentication through SSH.
## Migration to Go feature flags ## Migration to Go feature flags
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment