parent
ad174d7356
commit
a0a164b063
@ -0,0 +1,37 @@
|
|||||||
|
# This file is a template, and might need editing before it works on your project.
|
||||||
|
image: golang:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
# Please edit to your GitLab project
|
||||||
|
REPO_NAME: gitlab.com/namespace/project
|
||||||
|
|
||||||
|
# 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
|
||||||
|
- cd $GOPATH/src/$REPO_NAME
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
format:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- go fmt $(go list ./... | grep -v /vendor/)
|
||||||
|
- go vet $(go list ./... | grep -v /vendor/)
|
||||||
|
- go test -race $(go list ./... | grep -v /vendor/)
|
||||||
|
|
||||||
|
compile:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- go build -race -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/mybinary
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- mybinary
|
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
stages:
|
||||||
|
- ".pre"
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
- deploy
|
||||||
|
- ".post"
|
||||||
|
build-job:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- echo "Compiling the code..."
|
||||||
|
- echo "Compile complete."
|
||||||
|
unit-test-job:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- echo "Running unit tests... This will take about 60 seconds."
|
||||||
|
- sleep 60
|
||||||
|
- echo "Code coverage is 90%"
|
||||||
|
lint-test-job:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- echo "Linting code... This will take about 10 seconds."
|
||||||
|
- sleep 10
|
||||||
|
- echo "No lint issues found."
|
||||||
|
deploy-job:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- echo "Deploying application..."
|
||||||
|
- echo "Application successfully deployed."
|
@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
|
patreon: # Replace with a single Patreon username
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
@ -0,0 +1,19 @@
|
|||||||
|
- name: GoLang Test
|
||||||
|
# You may pin to the exact commit or the version.
|
||||||
|
# uses: n8maninger/action-golang-test@a8263fc1a85b63937b1b365946518675ceab5740
|
||||||
|
uses: n8maninger/action-golang-test@v1
|
||||||
|
with:
|
||||||
|
# the package to run the tests for
|
||||||
|
package: # optional, default is ./...
|
||||||
|
# additional go test command line arguments, individual arguments should be separated by ';'
|
||||||
|
args: # optional, default is
|
||||||
|
# outputs a warning for long running tests, -1 to disable
|
||||||
|
show-long-running-tests: # optional, default is 30
|
||||||
|
# includes package output in the parsed output
|
||||||
|
show-package-output: # optional
|
||||||
|
# shows tests that were run and passed
|
||||||
|
show-passed-tests: # optional
|
||||||
|
# shows the unparsed std-out from go test instead of the parsed output
|
||||||
|
show-stdout: # optional
|
||||||
|
# skips installing and setting up Go, useful for defining additional parameters for actions/setup-go
|
||||||
|
skip-go-install: # optional
|
Loading…
Reference in new issue