1
0
Fork 0
home-dns/.gitlab-ci.yml

147 lines
2.5 KiB
YAML
Raw Permalink Normal View History

2018-01-22 03:53:05 +00:00
stages:
2020-04-06 04:04:28 +00:00
- status-pre
- test
2018-01-22 03:53:05 +00:00
- build
2020-04-06 03:56:05 +00:00
- image
2020-04-06 04:04:28 +00:00
- status-post
2018-01-22 03:53:05 +00:00
2020-04-06 04:07:01 +00:00
.build-base:
image: apextoaster/base:1.5
2020-04-06 03:56:05 +00:00
tags:
- platform:k8s
- runner:shared
2018-03-31 14:52:12 +00:00
.build-go:
2020-04-06 04:07:01 +00:00
extends:
- .build-base
stage: build
image: apextoaster/golang:1.14-master
2018-03-31 14:35:30 +00:00
variables:
GOPATH: /build
BUILD_OPTS: -a -v -x
before_script:
- make go-clean
2018-03-31 14:35:30 +00:00
2018-01-22 03:53:05 +00:00
artifacts:
expire_in: 1 hour
paths:
- bin/
cache: &go-cache
2018-03-31 14:52:12 +00:00
paths:
- vendor
policy: pull
2018-03-31 14:52:12 +00:00
test-go:
extends:
- .build-go
stage: test
script:
- make go-test
cache:
<<: *go-cache
policy: pull-push
build-go-darwin-x86:
extends:
- .build-go
script:
- GOOS=darwin GOARCH=386 make go-build
- GOOS=darwin GOARCH=amd64 make go-build
build-go-linux-arm:
extends:
- .build-go
script:
- GOOS=linux GOARCH=arm make go-build
- GOOS=linux GOARCH=arm64 make go-build
build-go-linux-x86:
extends:
- .build-go
script:
- GOOS=linux GOARCH=386 make go-build
- GOOS=linux GOARCH=amd64 make go-build
build-go-windows-x86:
extends:
- .build-go
script:
- GOOS=windows GOARCH=386 make go-build
- GOOS=windows GOARCH=amd64 make go-build
# always build an image (tagged by branch), publish tags to latest
.build-docker:
2020-04-06 04:07:01 +00:00
extends:
- .build-base
2020-04-06 03:56:05 +00:00
image: apextoaster/docker:18.09
2018-01-22 03:53:05 +00:00
services:
- apextoaster/docker-dind:20.10
variables: &vars-docker
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
2020-04-06 03:56:05 +00:00
2018-03-31 14:35:30 +00:00
before_script:
2020-04-06 03:56:05 +00:00
- mkdir ${HOME}/.docker
- echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json
2018-03-31 14:35:30 +00:00
script:
- ./scripts/docker-build.sh --push --default
2020-04-06 03:56:05 +00:00
after_script:
- rm -rfv ${HOME}/.docker
build-image:
extends:
- .build-docker
stage: image
dependencies:
- build-go-linux-x86
2018-01-22 03:53:05 +00:00
variables:
2020-04-06 04:05:21 +00:00
IMAGE_ARCH: ubuntu
2020-04-06 04:04:28 +00:00
build-binary:
extends:
- .build-base
stage: image
only:
- master
- tags
dependencies:
- build-go-darwin-x86
- build-go-linux-arm
- build-go-linux-x86
- build-go-windows-x86
script:
- make bundle-all
artifacts:
expire_in: 1 day
paths:
- bin/
2020-04-06 04:04:28 +00:00
github-pending:
stage: status-pre
extends:
- .build-base
script:
- ./scripts/github-status.sh pending
github-failure:
stage: status-post
extends:
- .build-base
when: on_failure
script:
- ./scripts/github-status.sh failure
github-success:
stage: status-post
extends:
- .build-base
when: on_success
script:
- ./scripts/github-status.sh success