init
continuous-integration/drone/push Build is passing Details

master
wanggang 4 years ago
commit 3f42d3db63

@ -0,0 +1,25 @@
kind: pipeline
type: docker
name: default
platform:
arch: amd64
os: linux
steps:
- name: test
image: golang:1.16.4
commands:
- go test
- name: build
image: golang:1.16.4
commands:
- go build -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}"
- name: publish
image: plugins/docker:19.03.8
environment:
PLUGIN_REGISTRY: 10.10.14.176:5000
PLUGIN_REPO: 10.10.14.176:5000/go/example
settings:
insecure: true
tags:
- latest
- ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}-${DRONE_REPO_BRANCH}-${DRONE_COMMIT_SHA:0:8}

@ -0,0 +1,3 @@
FROM scratch
ADD example /
ENTRYPOINT ["/example"]

@ -0,0 +1,2 @@
# example

@ -0,0 +1,3 @@
module example
go 1.14

@ -0,0 +1,12 @@
package main
import "fmt"
func main() {
fmt.Println(HelloWorld())
}
// HelloWorld is a function that returns a string containing "hello world".
func HelloWorld() string {
return "hello world"
}

@ -0,0 +1,16 @@
package main
import (
"os"
"testing"
)
func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func TestHelloWorld(t *testing.T) {
if HelloWorld() != "hello world" {
t.Errorf("got %s expected %s", HelloWorld(), "hello world")
}
}
Loading…
Cancel
Save