Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cli-client
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
cli-client
Commits
60a323ec
Commit
60a323ec
authored
Sep 19, 2022
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Add .gitlab-ci.yml
parent
164713da
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+63
-0
63 additions, 0 deletions
.gitlab-ci.yml
with
63 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
63
−
0
View file @
60a323ec
before_script
:
-
go version || echo "Go executable not found."
-
echo $CI_BUILD_REF
-
echo $CI_PROJECT_DIR
-
echo $PWD
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan -t rsa $GITLAB_SERVER > ~/.ssh/known_hosts
-
rm -rf ~/.gitconfig
-
git config --global url."git@$GITLAB_SERVER:".insteadOf "https://gitlab.com/"
-
git config --global url."git@$GITLAB_SERVER:".insteadOf "https://git.xx.network/" --add
-
export PATH=$HOME/go/bin:$PATH
stages
:
-
test
-
build
test
:
stage
:
test
image
:
$DOCKER_IMAGE
except
:
-
tags
script
:
-
git clean -ffdx
-
go mod vendor -v
-
go build ./...
-
go mod tidy
-
mkdir -p testdata
# Test coverage
-
go-acc --covermode atomic --output testdata/coverage.out ./... -- -v
# Exclude some specific packages and files
-
cat testdata/coverage.out | grep -v cmd | grep -v mockserver | grep -v pb[.]go | grep -v main.go > testdata/coverage-real.out
-
go tool cover -func=testdata/coverage-real.out
-
go tool cover -html=testdata/coverage-real.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
-
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
:
-
vendor/
-
testdata/
build
:
stage
:
build
image
:
$DOCKER_IMAGE
except
:
-
tags
script
:
-
go mod vendor -v
-
make version
-
mkdir -p release
-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/cli-client.linux64 main.go
-
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/cli-client.win64 main.go
-
GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/cli-client.win32 main.go
-
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/cli-client.darwin64 main.go
artifacts
:
paths
:
-
release/
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