-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
config.yml
206 lines (197 loc) · 7.2 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
# 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 install github.com/ory/hydra/test/mock-lcp
- 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:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/ory/hydra
steps:
- checkout
- setup_remote_docker:
version: 17.10.0-ce
# 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 tag oryd/hydra:$CIRCLE_TAG oryd/hydra:latest
- run: docker tag oryd/hydra:$CIRCLE_TAG-alpine oryd/hydra:latest-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
- run: docker push oryd/hydra:latest-alpine
- run: docker push oryd/hydra:latest-alpine
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 view ory-hydra-sdk
- run: npm whoami
- run: npm publish
release-binaries:
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/mitchellh/gox github.com/tcnksm/ghr
- run: dep ensure -vendor-only
- run: |
gox -parallel=2 -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}}";
- run: ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace `git describe --tags` dist/
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"
workflows:
version: 2
"test, build, push, and deploy":
jobs:
- format:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
- release-docs:
filters:
branches:
only: master
- swagger:
filters:
tags:
only: /.*/
- build-docker:
requires:
- test
- swagger
- format
filters:
tags:
only: /.*/
- release-binaries:
requires:
- build-docker
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-docker:
requires:
- build-docker
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-npm:
requires:
- build-docker
filters:
tags:
only: /.*/
branches:
ignore: /.*/
- release-changelog:
requires:
- release-docker
- release-npm
- release-binaries
filters:
tags:
only: /.*/
branches:
ignore: /.*/