Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Akamu
Game Server Go
Commits
630e1931
Commit
630e1931
authored
Oct 27, 2020
by
Julien Schröter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache go dependencies
parent
4900ac50
Pipeline
#2311
failed with stage
in 6 minutes and 44 seconds
Changes
1
Pipelines
4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
19 deletions
+14
-19
.gitlab-ci.yml
.gitlab-ci.yml
+14
-19
No files found.
.gitlab-ci.yml
View file @
630e1931
...
...
@@ -7,15 +7,14 @@ variables:
MYSQL_PASSWORD
:
tester
MYSQL_DATABASE
:
akamu
# The problem is that to be able to use go get, one needs to put
# the repository in the $GOPATH. So for example if your gitlab domain
# is gitlab.com, and that your repository is namespace/project, and
# the default GOPATH being /go, then you'd need to have your
# repository in /go/src/gitlab.com/namespace/project
# Thus, making a symbolic link corrects this.
before_script
:
-
mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
-
ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
.go-cache
:
variables
:
GOPATH
:
$CI_PROJECT_DIR/.go
before_script
:
-
mkdir -p .go
cache
:
paths
:
-
.go/pkg/mod/
stages
:
-
test
...
...
@@ -24,21 +23,19 @@ stages:
precheck
:
stage
:
test
extends
:
.go-cache
script
:
-
cd $GOPATH/src/$REPO_NAME
-
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.akamu.de/".insteadOf "https://gitlab.akamu.de/"
-
go get ./...
-
go fmt $(go list ./... | grep -v /vendor/)
-
go vet $(go list ./... | grep -v /vendor/)
unittest
:
stage
:
test
extends
:
.go-cache
script
:
-
cd $GOPATH/src/$REPO_NAME
-
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.akamu.de/".insteadOf "https://gitlab.akamu.de/"
-
go get ./...
-
go get -u github.com/jstemmer/go-junit-report
-
go test ./test -v 2>&1 | go-junit-report > report-unit.xml
-
go test ./test -v 2>&1 |
$GOPATH/bin/
go-junit-report > report-unit.xml
artifacts
:
reports
:
junit
:
report-unit.xml
...
...
@@ -47,8 +44,8 @@ e2etest:
stage
:
test
services
:
-
mariadb:latest
extends
:
.go-cache
script
:
-
cd $GOPATH/src/$REPO_NAME
-
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.akamu.de/".insteadOf "https://gitlab.akamu.de/"
-
apt-get update && apt-get -y install mariadb-client
-
git clone --depth 1 --single-branch -b development https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.akamu.de/akamu/data-schemas $HOME/data-schemas
...
...
@@ -57,19 +54,17 @@ e2etest:
-
TEST_CONFIGFILE=$CI_PROJECT_DIR/test/e2e/testconfig.json
-
TEST_DATAFILE=$CI_PROJECT_DIR/resources/data/testdata.sql
-
echo "{\"jwt-secret\":\"akamu\",\"database\":{\"name\":\"$MYSQL_DATABASE\",\"user\":\"$MYSQL_USER\",\"host\":\"mariadb\",\"password\":\"$MYSQL_PASSWORD\"}}" > $TEST_CONFIGFILE
-
go get ./...
-
go get -u github.com/jstemmer/go-junit-report
-
TEST_DATAFILE=$TEST_DATAFILE TEST_CONFIGFILE=$TEST_CONFIGFILE go test ./test/e2e -v 2>&1 | go-junit-report > report-e2e.xml
-
TEST_DATAFILE=$TEST_DATAFILE TEST_CONFIGFILE=$TEST_CONFIGFILE go test ./test/e2e -v 2>&1 |
$GOPATH/bin/
go-junit-report > report-e2e.xml
artifacts
:
reports
:
junit
:
report-e2e.xml
compile
:
stage
:
build
extends
:
.go-cache
script
:
-
cd $GOPATH/src/$REPO_NAME
-
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.akamu.de/".insteadOf "https://gitlab.akamu.de/"
-
go get ./...
-
GOOS=linux GOARCH=amd64 go build -tags netgo -a -ldflags "-extldflags '-static' -X 'gitlab.akamu.de/akamu/game-server-go/version.Identifier=$(< MILESTONE)' -X 'gitlab.akamu.de/akamu/game-server-go/version.Commit=$CI_COMMIT_SHORT_SHA' -X 'gitlab.akamu.de/akamu/game-server-go/version.Environment=$CI_COMMIT_REF_NAME' -X 'gitlab.akamu.de/akamu/game-server-go/version.Pipeline=$CI_PIPELINE_ID' -X 'gitlab.akamu.de/akamu/game-server-go/version.Job=$CI_JOB_ID' -X 'gitlab.akamu.de/akamu/game-server-go/version.BuiltOn=$(date)'" -o $CI_PROJECT_DIR/linux
artifacts
:
paths
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment