Skip to content

Instantly share code, notes, and snippets.

@truongsinh
Created October 9, 2015 14:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save truongsinh/4dcec348b37defa11236 to your computer and use it in GitHub Desktop.
Save truongsinh/4dcec348b37defa11236 to your computer and use it in GitHub Desktop.
before_script:
- export GOPATH=$(pwd)
stages:
- build
- test
- deploy
validate-schema:
image: truongsinh/pg-client:9.4
services:
- postgres:9.4
stage: build
script:
- sql/validate.sh
format:
image: golang:1.5
stage: build
script:
- go get golang.org/x/tools/cmd/goimports
# If formatted is different than committed, exit with error
# goimports -w src/smarpshare/
- (if [ "$(bin/goimports -d src/smarpshare/)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);
# goimports -w src/*.go
- (if [ "$(bin/goimports -d src/*.go)" == "" ]; then echo "Good format"; else echo "Bad format"; exit 33; fi);
vet:
image: golang:1.5
stage: build
script:
# Vet dir src/smarpshare, dont care about unkeyed composites
- go tool vet -composites=false src/smarpshare
# Vet files in src/, dont care about unkeyed composites
- go tool vet -composites=false -shadow=true src/*.go
compile-go-1.4:
image: golang:1.4
stage: build
script:
- git submodule update --init
# Cannot use go build src/*.go
# Loop through src/*.go, go build, if exit code is not 0, then exit 66
- (for f in src/*.go; do echo "-> go build $f"; go build $f; if [ $? -ne 0 ]; then exit 66; fi; done);
compile-go-1.5:
image: golang:1.5
stage: build
script:
- git submodule update --init
# Cannot use go build src/*.go
# Loop through src/*.go, go build, if exit code is not 0, then exit 66
- (for f in src/*.go; do echo "-> go build $f"; go build $f; if [ $? -ne 0 ]; then exit 66; fi; done);
test-go-1.4:
image: golang:1.4
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -race -p 1 smarpshare/...
test-go-1.5-no-race:
image: golang:1.5
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -p 1 smarpshare/...
test-go-1.5:
image: golang:1.5
services:
- postgres:9.4
- truongsinh/rethinkdb:2.1.3
stage: test
script:
- git submodule update --init
- go run sql/latest_schema.sql.go
- go test -race -p 1 smarpshare/...
allow_failure: true
@girish15
Copy link

Hello Can you help me, I want to execute git clone command conditionally,

I want - (if [!-d /var/www/html/.git]; then git clone http://username:password@XX.XX.XX.XXX/root/myproject.git /var/www/html exit 33; fi) in below code.


cache:
  paths:
  - vendor/

before_script:
  - php -v
  - pwd
  - mkdir -p /var/www/html
  - (if [!-d /var/www/html/.git]; then git clone http://username:password@XX.XX.XX.XXX/root/myproject.git /var/www/html exit 33; fi)

stages:
  - deploy

deploy_staging:
  stage: deploy
  script:
    - echo "Deploy to staging server"
  environment:
    name: staging
    url: http://XX.XX.XX.XXX/
  script:
    - cd $webroot
    - git pull

Thanks in Advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment