-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
config.yml
284 lines (274 loc) · 9.45 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# 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.12
working_directory: /go/src/github.com/ory/hydra
steps:
# This is disabled for now because goimports is really slow when go modules are used, see
# https://github.com/golang/go/issues/27287
#
# - run:
# name: Enable go1.12 modules
# command: |
# echo 'export GO111MODULE=on' >> $BASH_ENV
# source $BASH_ENV
- checkout
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- run: curl -L https://git.io/vp6lP | sh -s -- -b ./bin
- run: mv ./bin/* $GOPATH/bin
- run: go mod download
- run: go mod vendor
- run: GO111MODULE=off gometalinter --disable-all --enable=goimports --enable=vet --vendor ./...
test:
docker:
- image: circleci/golang:1.12
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.6
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:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: go mod download
- run: GO111MODULE=off go get github.com/mattn/goveralls github.com/ory/go-acc
- run: go-acc -o coverage.txt ./... -- -failfast -timeout=20m
# Running race conditions requires parallel tests, otherwise it's worthless (which is the case)
# - run: go test -race -short $(go list ./... | grep -v cmd)
- 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"
test-e2e-opaque:
docker:
- image: circleci/golang:1.12
environment:
- DATABASE_URL_POSTGRES=postgres://test:test@localhost:5432/hydra?sslmode=disable
- DATABASE_URL_MYSQL=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:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: go mod verify
- run: go install github.com/ory/hydra
- run: hydra migrate sql $DATABASE_URL_POSTGRES
- run: hydra migrate sql $DATABASE_URL_MYSQL
- run: DATABASE_URL=$DATABASE_URL_POSTGRES ./scripts/test-e2e.sh
- run: DATABASE_URL=$DATABASE_URL_MYSQL ./scripts/test-e2e.sh
# See https://github.com/ory/hydra/issues/1179
# - run: DATABASE_URL=memory ./scripts/test-e2e.sh
test-e2e-plugin:
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: go mod verify
- run: go install github.com/ory/hydra
- run: OAUTH2_ACCESS_TOKEN_STRATEGY=jwt ./scripts/test-e2e-plugin.sh
- run: ./scripts/test-e2e-plugin.sh
test-e2e-jwt:
docker:
- image: circleci/golang:1.12
environment:
- DATABASE_URL_POSTGRES=postgres://test:test@localhost:5432/hydra?sslmode=disable
- DATABASE_URL_MYSQL=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:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: go mod verify
- run: go install github.com/ory/hydra
- run: hydra migrate sql $DATABASE_URL_POSTGRES
- run: hydra migrate sql $DATABASE_URL_MYSQL
- run: OAUTH2_ACCESS_TOKEN_STRATEGY=jwt DATABASE_URL=$DATABASE_URL_POSTGRES ./scripts/test-e2e.sh
- run: OAUTH2_ACCESS_TOKEN_STRATEGY=jwt DATABASE_URL=$DATABASE_URL_MYSQL ./scripts/test-e2e.sh
# See https://github.com/ory/hydra/issues/1179
# - run: OAUTH2_ACCESS_TOKEN_STRATEGY=jwt DATABASE_URL=memory ./scripts/test-e2e.sh
release-npm:
docker:
- image: circleci/node:8.9.3
working_directory: ~/hydra
steps:
- checkout
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- run: |
npm version -f --no-git-tag-version $CIRCLE_TAG
- run: npm publish --access public
release-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
release-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"
benchmark:
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: git config --global user.email "hi@ory.am"
- run: git config --global user.name "ORY Continuous Integration"
- run: go get -u github.com/rakyll/hey
- run: go install .
- run: ./scripts/run-bench.sh
- run: ./scripts/run-configuration.sh
- run: "git clone https://arekkas:$DOCS_TOKEN_PUSH@github.com/ory/docs.git ../docs"
- run: "cp BENCHMARKS.md ../docs/docs/performance/hydra.md"
- run: "cp configuration.md ../docs/docs/hydra/configuration.md"
- run: "(cd ../docs && git add -A && git commit -a -m \"Updates ORY Hydra autogenerated docs\" && git push origin) || exit 0"
release:
docker:
- image: circleci/golang:1.12
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.12 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
echo 'export DOCKER_FULL_TAG=$(echo $CIRCLE_TAG | tr '+' '_')' >> $BASH_ENV
echo 'export DOCKER_SHORT_TAG=$(echo $CIRCLE_TAG | cut -d '+' -f1)' >> $BASH_ENV
source $BASH_ENV
- checkout
- setup_remote_docker
- run: docker login --username "$DOCKER_USERNAME" --password "$DOCKER_PASSWORD"
- run: cp ./.releaser/LICENSE.txt ./LICENSE.txt
- run: curl -sL https://git.io/goreleaser | bash
workflows:
version: 2
"test, build, push, and deploy":
jobs:
- format:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- test-e2e-opaque:
filters:
tags:
only: /.*/
- test-e2e-jwt:
filters:
tags:
only: /.*/
- test-e2e-plugin:
filters:
tags:
only: /.*/
- release-docs:
requires:
- test
filters:
branches:
only: master
- benchmark:
# Avoids race conditions when pushing
requires:
- release-docs
filters:
branches:
only: master
- release:
requires:
- test
- format
- test-e2e-opaque
- test-e2e-plugin
- test-e2e-jwt
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-npm:
requires:
- release
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-changelog:
requires:
- release
- release-npm
filters:
tags:
only: /.*/
branches:
ignore: /.*/