-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
51 lines (40 loc) · 1.88 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# for Docker configuration, see https://docs.travis-ci.com/user/docker/
sudo: required
env:
- GITLAB_ROOT_USER="root" GITLAB_ROOT_PASSWORD="12341234" GITLAB_HOST="http://localhost:8080"
language: go
services:
- docker
go:
- 1.8
before_install:
- docker pull gitlab/gitlab-ce:9.5.10-ce.0
# see https://docs.gitlab.com/omnibus/docker/README.html for details
- docker run --detach --hostname gitlab.example.com --env GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD} --publish 8443:443 --publish 8080:80 --publish 8022:22 --name gitlab --restart always gitlab/gitlab-ce:9.5.10-ce.0
- docker ps -a
# since the Gitlab container takes some time to start, we wait until the health state of the container is "healthy"
# see https://github.com/moby/moby/issues/7228 for checking container health state in Docker
- until [[ "`docker inspect -f {{.State.Health.Status}} gitlab`" = "healthy" ]]; do echo 'waiting for container to be healthy...'; sleep 5; done
script:
# get private token for root user (see https://stackoverflow.com/questions/23640961/gitlab-api-how-to-generate-the-private-token)
- export GITLAB_ROOT_PRIVATE_TOKEN=`curl ${GITLAB_HOST}/api/v3/session --data "login=${GITLAB_ROOT_USER}&password=${GITLAB_ROOT_PASSWORD}" | jq -r '.private_token'`
- echo $GITLAB_ROOT_PRIVATE_TOKEN
- sh .travis/write_golab_yml.sh
- cat .golab.yml
# at this point we have a valid .golab.yml configuration (with a valid access token!)
# install Ginkgo for testing
- go get github.com/onsi/ginkgo/ginkgo
- go get github.com/onsi/gomega
# build our application
- make
# run tests
- make test
# this deploys the built application if a commit is tagged - see https://docs.travis-ci.com/user/deployment/releases/
# TODO currently not working, see https://travis-ci.org/michaellihs/golab/builds/306958179
# deploy:
# provider: releases
# api_key: ${GITHUB_TOKEN}
# file: golab
# skip_cleanup: true
# on:
# tags: true