首次提交
continuous-integration/drone/push Build is failing Details

This commit is contained in:
李寻欢 2020-01-07 08:56:43 +08:00
parent 1c22b18fd2
commit 2f4c15eb9f
3 changed files with 62 additions and 0 deletions

36
.drone.yml Normal file
View File

@ -0,0 +1,36 @@
kind: pipeline
name: default
steps:
- name: linter
image: golang:latest
environment:
GOPROXY: https://mirrors.aliyun.com/goproxy/
commands:
- go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
- golangci-lint run
- name: build
image: golang:latest
environment:
GOPROXY: https://mirrors.aliyun.com/goproxy/
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
commands:
- go build -o demo-app
- name: docker
image: plugins/docker
settings:
registry: docker.gitee.ltd
repo: docker.gitee.ltd/lxh/golang-demo
use_cache: true
username: docker
password: dockeruser
tags:
- latest
- 0.0.1
when:
event: push
branch: master

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module drone-ci-golang
go 1.13

23
main.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)
func main() {
r := gin.Default()
r.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H {
"health": true,
})
})
if err := r.Run(":8080"); err != nil {
logrus.WithError(err).Fatal("Couldn't listen")
}
}