From 0adba9824b414c858d60c7d3cdfa0a207202fb05 Mon Sep 17 00:00:00 2001 From: Simon Kirsten <stsnkirs@stud.h-da.de> Date: Thu, 22 Aug 2019 02:05:06 +0200 Subject: [PATCH] Improved CI pipeline and added version information --- .gitlab-ci-docs.yml | 9 +++++++-- .gitlab-ci-server.yml | 29 +++++++++++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci-docs.yml b/.gitlab-ci-docs.yml index bf43f26..bbaa75e 100644 --- a/.gitlab-ci-docs.yml +++ b/.gitlab-ci-docs.yml @@ -1,16 +1,21 @@ +# This is the CI file for GitLab Pages + pages: stage: deploy image: python:3.7-alpine + before_script: # TODO: we should consider also version locking these packages: # + everything will work in the future # - we wont see any future improvements by mkdocs or mkdocs-material - pip install mkdocs - pip install mkdocs-material + script: - mkdocs build - - mv site public - - mv binaries public/ + - mv site public # move mkdocs output to public + - mv binaries public/ # move binaries from the build stage to public + artifacts: paths: - public diff --git a/.gitlab-ci-server.yml b/.gitlab-ci-server.yml index f41904c..5b76ab2 100644 --- a/.gitlab-ci-server.yml +++ b/.gitlab-ci-server.yml @@ -1,19 +1,28 @@ +# This is the CI file for the stream-tv-server + server: stage: build image: golang:1.12 - variables: - LDFLAGS: -s -X code.fbi.h-da.de/simons-nzse-2/stream-tv/pkg/twitch.ClientID=${TWITCH_CLIENT_ID} + + # TWITCH_CLIENT_ID is supplied via the GitLab CI/CD environment variables. This way only project owners can see the private key. + + before_script: + - VERSION=$(git describe --always --long --dirty) + - export LDFLAGS="-s -X stream-tv/pkg/twitch.ClientID=$TWITCH_CLIENT_ID -X stream-tv/cmd/stream-tv-server/main.version=$VERSION" + - go mod download + - echo "building $VERSION" + script: - - env GOOS=darwin GOARCH=386 go build -ldflags "${LDFLAGS}" -o binaries/darwin-x86/stream-tv-server ./cmd/stream-tv-server - - env GOOS=darwin GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o binaries/darwin-x86_64/stream-tv-server ./cmd/stream-tv-server + - env GOOS=darwin GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/darwin-x86/stream-tv-server ./cmd/stream-tv-server + - env GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/darwin-x86_64/stream-tv-server ./cmd/stream-tv-server - - env GOOS=linux GOARCH=386 go build -ldflags "${LDFLAGS}" -o binaries/linux-x86/stream-tv-server ./cmd/stream-tv-server - - env GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o binaries/linux-x86_64/stream-tv-server ./cmd/stream-tv-server - - env GOOS=linux GOARCH=arm go build -ldflags "${LDFLAGS}" -o binaries/linux-arm/stream-tv-server ./cmd/stream-tv-server - - env GOOS=linux GOARCH=arm64 go build -ldflags "${LDFLAGS}" -o binaries/linux-arm64/stream-tv-server ./cmd/stream-tv-server + - env GOOS=linux GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/linux-x86/stream-tv-server ./cmd/stream-tv-server + - env GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/linux-x86_64/stream-tv-server ./cmd/stream-tv-server + - env GOOS=linux GOARCH=arm go build -ldflags "$LDFLAGS" -o binaries/linux-arm/stream-tv-server ./cmd/stream-tv-server + - env GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o binaries/linux-arm64/stream-tv-server ./cmd/stream-tv-server - - env GOOS=windows GOARCH=386 go build -ldflags "${LDFLAGS}" -o binaries/windows-x86/stream-tv-server.exe ./cmd/stream-tv-server - - env GOOS=windows GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o binaries/windows-x86_64/stream-tv-server.exe ./cmd/stream-tv-server + - env GOOS=windows GOARCH=386 go build -ldflags "$LDFLAGS" -o binaries/windows-x86/stream-tv-server.exe ./cmd/stream-tv-server + - env GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o binaries/windows-x86_64/stream-tv-server.exe ./cmd/stream-tv-server artifacts: paths: -- GitLab