Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
notifications-bot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
archives
notifications-bot
Commits
ee44f9a4
Commit
ee44f9a4
authored
5 years ago
by
Rick Carback
Browse files
Options
Downloads
Patches
Plain Diff
Collapse build to single stage
parent
fbb8653b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+15
-40
15 additions, 40 deletions
.gitlab-ci.yml
with
15 additions
and
40 deletions
.gitlab-ci.yml
+
15
−
40
View file @
ee44f9a4
# From: https://about.gitlab.com/2017/09/21/how-to-create-ci-cd-pipeline-with-autodeploy-to-kubernetes-using-gitlab-and-helm/
cache
:
untracked
:
true
key
:
"
$CI_BUILD_REF_NAME"
paths
:
-
vendor/
variables
:
REPO_DIR
:
gitlab.com/elixxir
REPO_NAME
:
notifications-bot
DOCKER_IMAGE
:
golang:1.13.4-buster
DOCKER_IMAGE
:
elixxirlabs/cuda-go:latest
MIN_CODE_COVERAGE
:
"
0.0"
before_script
:
...
...
@@ -23,60 +17,39 @@ before_script:
-
chmod 700 ~/.ssh
-
ssh-keyscan -t rsa gitlab.com > ~/.ssh/known_hosts
-
git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"
-
export GOFLAGS=-mod=vendor
-
export PATH=$HOME/go/bin:$PATH
-
export GOPRIVATE=gitlab.com/elixxir/*
stages
:
-
setup
-
test
-
build
-
tag
-
trigger_integration
setup
:
stage
:
setup
build
:
stage
:
build
image
:
$DOCKER_IMAGE
except
:
-
tags
script
:
-
git clean -ffdx
-
go mod vendor -v
-
go build ./...
-
go mod tidy
artifacts
:
paths
:
-
vendor/
test
:
stage
:
test
image
:
$DOCKER_IMAGE
except
:
-
tags
script
:
-
GO111MODULE=off go get -u github.com/haya14busa/goverage
-
apt-get update
-
apt-get install bc -y
-
mkdir -p testdata
# Test coverage
-
go
verage -coverprofile=
testdata/coverage
-real
.out
-v
./...
2>&1 | grep -v "no packages being tested depend on"
-
go
-acc --covermode atomic --output
testdata/coverage.out ./...
-- -v
# Exclude cmd from test coverage as it is command line related tooling
# - grep -v -e cmd testdata/coverage.out > testdata/coverage-real.out
-
go tool cover -func=testdata/coverage
-real
.out
-
go tool cover -html=testdata/coverage
-real
.out -o testdata/coverage.html
-
go tool cover -func=testdata/coverage.out
-
go tool cover -html=testdata/coverage.out -o testdata/coverage.html
# Test Coverage Check
-
go tool cover -func=testdata/coverage
-real
.out | grep "total:" | awk '{print $3}' | sed 's/\%//g' > testdata/coverage-percentage.txt
-
go tool cover -func=testdata/coverage.out | grep "total:" | awk '{print $3}' | sed 's/\%//g' > testdata/coverage-percentage.txt
-
export CODE_CHECK=$(echo "$(cat testdata/coverage-percentage.txt) >= $MIN_CODE_COVERAGE" | bc -l)
-
(if [ "$CODE_CHECK" == "1" ]; then echo "Minimum coverage of $MIN_CODE_COVERAGE succeeded"; else echo "Minimum coverage of $MIN_CODE_COVERAGE failed"; exit 1; fi);
artifacts
:
paths
:
-
testdata/
build
:
stage
:
build
image
:
$DOCKER_IMAGE
except
:
-
tags
script
:
-
mkdir -p release
-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' ./...
-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/notifications.linux64 main.go
...
...
@@ -85,10 +58,12 @@ build:
-
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/notifications.darwin64 main.go
artifacts
:
paths
:
-
vendor/
-
testdata/
-
release/
tag
:
stage
:
t
ag
stage
:
t
rigger_integration
only
:
-
master
image
:
$DOCKER_IMAGE
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment