api: use dep instead of go get

This commit is contained in:
Adhityaa Chandrasekar 2018-10-18 01:18:01 -04:00
parent 93c9ce0cad
commit a36b11f07d
5 changed files with 20 additions and 8 deletions

View File

@ -26,14 +26,20 @@ build-src:
except: except:
- master - master
- tags - tags
script: before_script:
- apt update - apt update
- apt install -y curl gnupg git make golang - apt install -y curl gnupg git make golang
- mkdir -p /go/src /go/bin /go/pkg
- export GOPATH=/go
- export PATH=$PATH:/go/bin
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME
- curl -sL https://deb.nodesource.com/setup_10.x | bash - - curl -sL https://deb.nodesource.com/setup_10.x | bash -
- apt update - apt update
- apt install -y nodejs - apt install -y nodejs
- npm install -g html-minifier@3.5.7 uglify-js@3.4.1 sass@1.5.1 - npm install -g html-minifier@3.5.7 uglify-js@3.4.1 sass@1.5.1
- mkdir -p src/gitlab.com/commento && cd src/gitlab.com/commento && ln -s $CI_PROJECT_DIR && cd $CI_PROJECT_NAME script:
- cd /go/src/$CI_PROJECT_NAME
- make devel - make devel
- make prod - make prod
@ -58,12 +64,17 @@ go-test:
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
POSTGRES_DB: commento_test POSTGRES_DB: commento_test
COMMENTO_POSTGRES: postgres://postgres:postgres@postgres/commento_test?sslmode=disable COMMENTO_POSTGRES: postgres://postgres:postgres@postgres/commento_test?sslmode=disable
GOPATH: $CI_PROJECT_DIR
except: except:
- master - master
- tags - tags
before_script:
- mkdir -p /go/src /go/bin /go/pkg
- export GOPATH=/go
- export PATH=$PATH:/go/bin
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- ln -s $CI_PROJECT_DIR /go/src/$CI_PROJECT_NAME
script: script:
- mkdir -p src/gitlab.com/commento && cd src/gitlab.com/commento && ln -s $CI_PROJECT_DIR && cd $CI_PROJECT_NAME - cd /go/src/$CI_PROJECT_NAME
- make test - make test
go-fmt: go-fmt:

View File

@ -4,7 +4,8 @@ FROM golang:1.10.2-alpine AS api-build
COPY ./api /go/src/commento-ce/api COPY ./api /go/src/commento-ce/api
WORKDIR /go/src/commento-ce/api WORKDIR /go/src/commento-ce/api
RUN apk update && apk add bash make git RUN apk update && apk add bash make git curl
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
RUN make prod -j$(($(nproc) + 1)) RUN make prod -j$(($(nproc) + 1))

View File

View File

@ -25,15 +25,15 @@ clean:
# later down the line). # later down the line).
devel-go: devel-go:
go get -v . dep ensure
go build -i -v -o $(GO_DEVEL_BUILD_BINARY) go build -i -v -o $(GO_DEVEL_BUILD_BINARY)
prod-go: prod-go:
go get -v . dep ensure
go build -i -v -o $(GO_PROD_BUILD_BINARY) go build -i -v -o $(GO_PROD_BUILD_BINARY)
test-go: test-go:
go get -v . dep ensure
go test -v . go test -v .
$(shell mkdir -p $(GO_DEVEL_BUILD_DIR) $(GO_PROD_BUILD_DIR)) $(shell mkdir -p $(GO_DEVEL_BUILD_DIR) $(GO_PROD_BUILD_DIR))