forked from ory/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
68 lines (56 loc) · 2.25 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
sudo: required
go_import_path: github.com/ory/hydra
cache:
directories:
- ./vendor/
before_cache:
services:
- docker
env:
- DOCKER_BIND_LOCALHOST=true DATABASE_URL=memory
language: go
go:
- 1.9
before_install:
- sudo apt-get install curl
install:
- go get github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/Masterminds/glide github.com/mitchellh/gox
- git clone https://github.com/docker-library/official-images.git ~/official-images
- glide install
- go install github.com/ory/hydra
- glide update
- go install github.com/ory/hydra
script:
- touch ./coverage.tmp
- |
echo 'mode: atomic' > coverage.txt
- |
go list ./... | grep -v /cmd | grep -v /vendor | xargs -n1 -I{} sh -c 'go test -race -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp
- touch ./coverage.tmp
- |
go list ./cmd/... | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp -coverpkg $(go list ./... | grep -v /vendor | tr "\n" ",") {} && tail -n +2 coverage.tmp >> coverage.txt || exit 255' && rm coverage.tmp
- goveralls -coverprofile="coverage.txt"
- docker build -t hydra-travis-ci -f Dockerfile-without-telemetry .
- docker run -d hydra-travis-ci
- DATABASE_URL=memory hydra host --dangerous-auto-logon --dangerous-force-http --disable-telemetry &
- while ! echo exit | nc localhost 4444; do sleep 1; done
# Test clients
- hydra clients create --id foobar
- hydra clients delete foobar
# Test token on arbitrary endpoints
- |-
curl --header "Authorization: bearer $(hydra token client)" http://localhost:4444/clients
# Test token validation
- hydra token validate $(hydra token client)
after_success:
- |-
[ "${TRAVIS_TAG}" != "" ] && [ "${TRAVIS_GO_VERSION}" == "1.8" ] && gox -ldflags "-X github.com/ory/hydra/cmd.Version=`git describe --tags` -X github.com/ory/hydra/cmd.BuildTime=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ory/hydra/cmd.GitHash=`git rev-parse HEAD`" -output "dist/{{.Dir}}-{{.OS}}-{{.Arch}}"
deploy:
provider: releases
file_glob: true
api_key: "$GITHUB_TOKEN"
file: "dist/*"
skip_cleanup: true
on:
tags: true
go: 1.8