Skip to content
Snippets Groups Projects

Merge GitLab CI config

Merged Thomas Schneider requested to merge ci into main
2 files
+ 40
8
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 40
7
---
---
image: debian:buster
variables:
variables:
GOCACHE: $CI_PROJECT_DIR/.gocache
GOCACHE: $CI_PROJECT_DIR/.gocache
GOPATH: $CI_PROJECT_DIR/.go
GOPATH: $CI_PROJECT_DIR/.go
 
PACKAGE_REGISTRY_URL: >-
 
$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/needrestart2prom
cache:
cache:
paths:
paths:
- .gocache
- .gocache
- .go
- .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:
build:
 
image: golang:1-buster
 
stage: build
 
before_script:
 
- go version
script:
script:
- go build -o $CI_PROJECT_NAME-$GOOS-$GOARCH
- go build -o $CI_PROJECT_NAME-$GOOS-$GOARCH
artifacts:
artifacts:
@@ -29,3 +28,37 @@ build:
@@ -29,3 +28,37 @@ build:
GOARCH:
GOARCH:
- amd64
- amd64
- arm
- 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