forked from htdvisser/ssh-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
40 lines (35 loc) · 919 Bytes
/
.gitlab-ci.yml
File metadata and controls
40 lines (35 loc) · 919 Bytes
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
image: golang:1.25
variables:
DOCKER_IMAGE: registry.gitlab.com/htdvisser/ssh-gateway
GOPROXY: https://proxy.golang.org
GO111MODULLE: 'on'
stages:
- test
- build
- release
test:
stage: test
script:
- go test -cover -race -coverprofile=coverage.txt -covermode=atomic ./...
- go fmt ./...
build:
stage: build
artifacts:
paths:
- dist
script:
- if [[ ! -d dist ]]; then mkdir dist; fi
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 make build
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 make build
docker:
stage: release
image: docker:git
services:
- docker:dind
before_script:
- export DOCKER_BRANCH=$(echo $CI_COMMIT_REF_NAME | sed 's:/:-:g')
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t $DOCKER_IMAGE:$DOCKER_BRANCH .
- docker push $DOCKER_IMAGE:$DOCKER_BRANCH