Skip to content

Commit

Permalink
Switch to go modules and add vendor (ory#1077)
Browse files Browse the repository at this point in the history
Closes ory#1074

Signed-off-by: arekkas <aeneas@ory.am>
  • Loading branch information
aeneasr committed Oct 9, 2018
1 parent a68cca9 commit 2b491c9
Show file tree
Hide file tree
Showing 1,684 changed files with 433,900 additions and 830 deletions.
56 changes: 37 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ version: 2
jobs:
format:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.11 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- 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
- run: curl -L https://git.io/vp6lP | sh
- run: mv ./bin/* $GOPATH/bin
- run: gometalinter --disable-all --enable=gofmt --vendor ./...

test:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
environment:
- TEST_DATABASE_POSTGRESQL=postgres://test:test@localhost:5432/hydra?sslmode=disable
- TEST_DATABASE_MYSQL=root:test@(localhost:3306)/mysql?parseTime=true
Expand All @@ -30,10 +34,14 @@ jobs:
- MYSQL_ROOT_PASSWORD=test
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.11 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go mod verify
- 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 ./...
Expand All @@ -45,13 +53,12 @@ jobs:

swagger:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
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: go get github.com/go-swagger/go-swagger/cmd/swagger
- run: curl -L https://git.io/vp6lP | sh
- 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
Expand All @@ -71,9 +78,14 @@ jobs:

release-docker:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.11 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- checkout
- setup_remote_docker:
version: 17.10.0-ce
Expand Down Expand Up @@ -103,13 +115,16 @@ jobs:

release-binaries:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.11 modules
command: |
echo 'export GO111MODULE=on' >> $BASH_ENV
source $BASH_ENV
- 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/
Expand Down Expand Up @@ -146,15 +161,18 @@ jobs:

benchmark:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
working_directory: /go/src/github.com/ory/hydra
steps:
- run:
name: Enable go1.11 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: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: go get -u github.com/rakyll/hey
- run: dep ensure -vendor-only
- run: go install .
- run: ./scripts/run-bench.sh
- run: cat BENCHMARKS.md
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
vendor/
.idea/
.vagrant/
docs/
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ node_modules/
*.log
*.stackdump
.DS_Store
vendor/
.hydra.yml
cover.out
output/
Expand All @@ -17,4 +16,3 @@ Dockerfile-plugin-*
plugin-*.so
hydra-docker-bin
cookies.txt
vendor.orig
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.10-alpine
FROM golang:1.11-alpine

ARG git_tag
ARG git_commit
Expand All @@ -8,12 +8,15 @@ RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

WORKDIR /go/src/github.com/ory/hydra

ADD ./Gopkg.lock ./Gopkg.lock
ADD ./Gopkg.toml ./Gopkg.toml
RUN dep ensure -vendor-only
ENV GO111MODULE=on

ADD ./go.mod ./go.mod
ADD ./go.sum ./go.sum


ADD . .

RUN go mod verify
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -X github.com/ory/hydra/cmd.Version=$git_tag -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_commit" -a -installsuffix cgo -o hydra

FROM scratch
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.10-alpine
FROM golang:1.11-alpine

ARG git_tag
ARG git_commit
Expand All @@ -8,9 +8,12 @@ RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

WORKDIR /go/src/github.com/ory/hydra

ADD ./Gopkg.lock ./Gopkg.lock
ADD ./Gopkg.toml ./Gopkg.toml
RUN dep ensure -vendor-only
ENV GO111MODULE=on

ADD ./go.mod ./go.mod
ADD ./go.sum ./go.sum

RUN go mod download

ADD . .

Expand Down
Loading

0 comments on commit 2b491c9

Please sign in to comment.