提交 4c984814 编写于 作者: 李光春's avatar 李光春

update

上级 454c1df2
# 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
# 使用vendor文件夹构建
export GO15VENDOREXPERIMENT=1
export GOPROXY=https://goproxy.cn,direct
# 在工作目录创建源文件夹
mkdir -p $GOPATH/src/dtapps/
# 拷贝代码到创建好的目录
cp -rf . $GOPATH/src/dtapps/
# 进入项目
cd $GOPATH/src/dtapps/
# 构建,在GOPATH下生成构建包
go mod tidy
# 列出文件
ls -lh
\ No newline at end of file
kind: pipeline
type: docker
name: default
steps:
- name: dtapps
image: golang
commands:
- go mod tidy
- ls -lh
......@@ -54,9 +54,6 @@
[comment]: <> (gitlab.com)
[![gitlab (.com)](https://gitlab.com/dtapps/go-ssh-tunnel/badges/master/pipeline.svg)](https://gitlab.com/dtapps/go-ssh-tunnel)
[comment]: <> (codechina.csdn.net)
[![codechina.csdn (.net)](https://codechina.csdn.net/dtapps/go-ssh-tunnel/badges/master/pipeline.svg)](https://codechina.csdn.net/dtapps/go-ssh-tunnel)
## 下载使用
- 把.example.config.yaml文件重命名为config.yaml
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册