Files
poseidon/.gitlab-ci.yml
2021-04-28 11:12:53 +02:00

61 lines
1.1 KiB
YAML

default:
image: golang:latest
stages:
- build
- lint
- test
- docker
variables:
DOCKER_TLS_CERTDIR: ""
IMAGE_NAME: $DOCKER_REGISTRY/$DOCKER_IMAGE_NAME/$CI_COMMIT_REF_SLUG:latest
compile:
stage: build
needs: []
variables:
CGO_ENABLED: 0
script:
- go build -o poseidon
artifacts:
paths:
- poseidon
expire_in: 1 week
golangci-lint:
stage: lint
needs: []
image: golangci/golangci-lint:latest
script:
- golangci-lint run
golint:
stage: lint
needs: []
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
test:
stage: test
needs: []
script:
- go test ./... -v
dockerimage:
stage: docker
image: docker:latest
services:
- name: docker:dind
alias: docker
needs:
- compile
script:
- docker login -u $DOCKER_REGISTRY_USER -p $DOCKER_REGISTRY_PASSWORD $DOCKER_REGISTRY
# Prevent pull rate limit but still have normal alpine image in Dockerfile
- docker pull $DOCKER_REGISTRY/library/alpine:latest
- docker tag $DOCKER_REGISTRY/library/alpine:latest alpine:latest
- docker build -t $IMAGE_NAME .
- docker push $IMAGE_NAME