Skip to content
Snippets Groups Projects

Merge GitLab CI config

1 file
+ 40
7
Compare changes
  • Side-by-side
  • Inline
+ 40
7
---
image: debian:buster
variables:
GOCACHE: $CI_PROJECT_DIR/.gocache
GOPATH: $CI_PROJECT_DIR/.go
PACKAGE_REGISTRY_URL: >-
$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/needrestart2prom
cache:
paths:
- .gocache
- .go
before_script:
- echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/backports.list
- apt-get update && apt-get -qq -y -t buster-backports install golang git
- go version
build:
image: golang:1-buster
stage: build
before_script:
- go version
script:
- go build -o $CI_PROJECT_NAME-$GOOS-$GOARCH
artifacts:
@@ -29,3 +28,37 @@ build:
GOARCH:
- amd64
- arm
lint:
image: golangci/golangci-lint:v1.39-alpine
stage: test
needs: []
script:
- >-
golangci-lint
run
-v
--max-issues-per-linter=0
--max-same-issues=0
--out-format=junit-xml
--timeout=10m
> golangci-output.xml
artifacts:
paths:
- golangci-output.xml
reports:
junit: golangci-output.xml
expire_in: 7 days
upload:
stage: deploy
image: curlimages/curl:latest
needs:
- build
rules:
- if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'
script:
- |
for file in $CI_PROJECT_NAME-linux-amd64 $CI_PROJECT_NAME-linux-arm; do
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${file} ${PACKAGE_REGISTRY_URL}/${CI_COMMIT_REF}/${file} ;
done
Loading