-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
config.yml
171 lines (164 loc) · 6.1 KB
/
config.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
format:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go get -u golang.org/x/tools/cmd/goimports
- run: dep ensure -vendor-only
- run: ./scripts/test-format.sh
test:
docker:
- image: circleci/golang:1.10
environment:
- TEST_DATABASE_POSTGRESQL=postgres://test:test@localhost:5432/hydra?sslmode=disable
- TEST_DATABASE_MYSQL=root:test@(localhost:3306)/mysql?parseTime=true
- image: postgres:9.5
environment:
- POSTGRES_USER=test
- POSTGRES_PASSWORD=test
- POSTGRES_DB=hydra
- image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=test
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go get -u github.com/mattn/goveralls golang.org/x/tools/cmd/cover github.com/ory/go-acc
- run: dep ensure -vendor-only
- run: go install github.com/ory/hydra
- run: go-acc -o coverage.txt ./...
- run: go test -race -short $(go list ./... | grep -v cmd)
- run: ./scripts/test-e2e.sh
- run: test -z "$CIRCLE_PR_NUMBER" && goveralls -service=circle-ci -coverprofile=coverage.txt -repotoken=$COVERALLS_REPO_TOKEN || echo "forks are not allowed to push to coveralls"
swagger:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go get -u github.com/go-swagger/go-swagger/cmd/swagger golang.org/x/tools/cmd/goimports
- run: dep ensure -vendor-only
- run: curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- run: sudo apt-get install -y default-jre nodejs
- run: sudo npm i -g yarn
- run: yarn
- run: ./scripts/test-sdk.sh
build-docker:
docker:
- image: library/docker:17.10
steps:
- checkout
- setup_remote_docker:
version: 17.10.0-ce
- run: docker build -f Dockerfile -t hydra-test .
- run: docker build -f Dockerfile-alpine -t hydra-test-alpine .
- run: docker run hydra-test help
release:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- setup_remote_docker:
version: 17.10.0-ce
# Environment dependencies
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go get -u github.com/mitchellh/gox github.com/tcnksm/ghr
- run: dep ensure -vendor-only
- run: curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
- run: sudo apt-get install -y nodejs
# Build binaries for GitHub
- run: ./scripts/run-deploy.sh
- run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/
# Build and push docker image
- run: docker build --build-arg git_tag=$(git describe --tags) --build-arg git_commit=$(git rev-parse HEAD) -f Dockerfile -t oryd/hydra:$CIRCLE_TAG .
- run: docker build --build-arg git_tag=$(git describe --tags) --build-arg git_commit=$(git rev-parse HEAD) -f Dockerfile-alpine -t oryd/hydra:$CIRCLE_TAG-alpine .
- run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
- run: docker push oryd/hydra:$CIRCLE_TAG
- run: docker push oryd/hydra:$CIRCLE_TAG-alpine
# Release node / JavaScript SDK
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: sudo npm i -g npm
- run: npm view ory-hydra-sdk
- run: npm publish
changelog:
docker:
- image: circleci/ruby:2.4-node
steps:
- checkout
- run: gem install github_changelog_generator
- run: sudo npm i -g doctoc
- run: github_changelog_generator -u ory -p hydra -o CHANGELOG.md --token $GITHUB_TOKEN
- run: doctoc CHANGELOG.md
- run: git config --global user.email "circleci@ory.am"
- run: git config --global user.name "ORY Continuous Integration"
- run: git add CHANGELOG.md
- run: |
git commit -m "docs: Incorporates changes from version $(git describe --tags)" -- CHANGELOG.md
- run: git remote rm origin
- run: git remote add origin https://arekkas:$GITHUB_TOKEN@github.com/ory/hydra.git
- run: git push origin HEAD:master
publish-docs:
docker:
- image: alpine/git:1.0.4
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- run: git config --global user.email "hi@ory.am"
- run: git config --global user.name "ORY Continuous Integration"
- run: "git clone https://arekkas:$DOCS_TOKEN_PUSH@github.com/ory/docs.git ../docs"
- run: "cp ./docs/api.swagger.json ../docs/apis/hydra.json"
- run: "(cd ../docs && git add -A && git commit -a -m \"Updates ORY Hydra Swagger definitions\" && git push origin) || exit 0"
workflows:
version: 2
"test, build, push, and deploy":
jobs:
- format:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- publish-docs:
filters:
branches:
only: master
- swagger:
filters:
tags:
only: /.*/
- build-docker:
requires:
- test
- swagger
- format
filters:
tags:
only: /.*/
- release:
requires:
- build-docker
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- changelog:
requires:
- release
filters:
tags:
only: /.*/
branches:
ignore: /.*/