Verified Commit bcf718b5 authored by peter.oettig's avatar peter.oettig Committed by peter.oettig
Browse files

Readded tests and goreleaser for gitlab releases.

parent d966474c
Pipeline #236944 passed with stages
in 1 minute and 46 seconds
---
include:
- remote: 'https://git.scc.kit.edu/KIT-CERT/publish/-/raw/main/gitlab-ci/dummy.yml'
- remote: 'https://git.scc.kit.edu/KIT-CERT/publish/-/raw/main/gitlab-ci/ssh-config.yml'
- remote: 'https://git.scc.kit.edu/KIT-CERT/publish/-/raw/main/gitlab-ci/build_image.yml'
- remote: 'https://git.scc.kit.edu/KIT-CERT/publish/-/raw/main/gitlab-ci/dch.yml'
......@@ -16,9 +15,101 @@ variables:
MAINTAINER_EMAIL: cert@kit.edu
stages:
- dummy
- test
- build
- release
- build_image
- build_dch
- push_dch
- build_pkg
- release_pkg
test:
tags:
- docker
image: docker.io/library/golang:latest
stage: test
before_script:
- go install github.com/jstemmer/go-junit-report@latest
script:
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
# run tests with coverage profile
- go test -race -v -coverprofile .testCoverage.txt $(go list ./... | grep -v /vendor/) > coverage-result.txt 2>&1 || true
# output result for coverage badge
- cat coverage-result.txt
# for pipeline test view in gitlab
- cat coverage-result.txt | go-junit-report -set-exit-code > report.xml
artifacts:
when: always
reports:
junit: report.xml
rules:
- when: always
goreleaser_build_snapshot:
tags:
- docker
image:
name: docker.io/goreleaser/goreleaser:latest
entrypoint:
- ''
stage: build
script:
- export VERSION=$(cat VERSION)
- goreleaser build --rm-dist --snapshot
artifacts:
paths:
- build/*
expire_in: 8 hrs
rules:
# Never run for tag pipelines as there will be a full release build
- if: $CI_COMMIT_TAG != null
when: never
create_release_tag:
tags:
- docker
image:
name: docker.io/debian
stage: release
script:
- export DEBIAN_FRONTEND="noninteractive"
- apt-get update
- apt-get upgrade -y
- apt-get install -y git
- git switch $CI_COMMIT_BRANCH
- git reset --hard origin/$CI_COMMIT_BRANCH
- git config --replace-all user.email "$MAINTAINER_EMAIL"
- git config --replace-all user.name "$MAINTAINER_NAME"
- git remote set-url origin "https://oauth2:$PUSH_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH"
- git fetch --tags --prune --prune-tags
- git tag "v$(cat VERSION)"
- git push --tags
rules:
# Never runs for pipelines created through pushing a tag
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- VERSION
goreleaser_release:
stage: release
image:
name: docker.io/goreleaser/goreleaser:latest
entrypoint: [ '' ]
variables:
REPO_NAME: git.scc.kit.edu/KIT-CA/acme4netvs
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
script:
- goreleaser release --rm-dist
artifacts:
paths:
- build/*
expire_in: 2 days
rules:
# Never runs for pipelines created through pushing to a branch
- if: $CI_COMMIT_TAG != null
changes:
- VERSION
......@@ -36,9 +36,9 @@ builds:
#- "-s -w -extldflags '-static'"
# enable debugging symbols
- "-extldflags '-static'"
- "-X main.version={{.Version}}"
- "-X main.commit={{.Commit}}"
- "-X main.date={{.Date}}"
- "-X main.version={{ .Version }}"
- "-X main.commit={{ .ShortCommit }}"
- "-X main.date={{ .Date }}"
- "-X main.builtBy=goreleaser"
ignore: &ignore
- goos: darwin
......
0.1.5
0.1.6
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment