This commit is contained in:
Joseph Barnett
2017-08-15 02:36:13 +00:00
committed by GitHub
6 changed files with 77 additions and 14 deletions

View File

@@ -1,12 +1,24 @@
build: pipeline:
image: golang:1.5 build:
environment: image: ${IMAGE}
- GO15VENDOREXPERIMENT=1
- CGO_ENABLED=0
commands: commands:
- go test -cover -coverprofile coverage.out - go build
- go test
publish: ecr:
coverage: image: plugins/ecr
when: region: us-east-1
branch: master access_key: ${ECR_ACCESS_KEY}
secret_key: ${ECR_SECRET_KEY}
repo: 995121555896.dkr.ecr.us-east-1.amazonaws.com/cloudlock/test-sit-ci-built-svc
dockerfile: ./Dockerfile
context: .
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DOCKER_LAUNCH_DEBUG=true
matrix:
IMAGE:
# - golang:1.7
# - golang:1.8
- golang:latest

43
.drone.yml.sig Normal file
View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="bradrydzewski">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<link rel="shortcut icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="shortcut icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<title></title>
<script>
window.ENV = {};
window.ENV.server = window.location.protocol+"//"+window.location.host;
</script>
<script>
if (!window.EventSource) {
var ssePolyfill = document.createElement("script");
ssePolyfill.src = "https://cdnjs.cloudflare.com/ajax/libs/event-source-polyfill/0.0.9/eventsource.min.js";
document.body.appendChild(ssePolyfill);
}
</script>
<script src="/bower_components/webcomponentsjs/webcomponents-loader.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
<link rel="import" href="/src/drone/drone-app.html">
<style>
html, body {
padding:0px;
margin:0px;
}
</style>
</head>
<body>
<drone-app></drone-app>
</body>
</html>

6
Dockerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM golang:latest
RUN mkdir /app
ADD . /app/
WORKDIR /app
RUN go build -o main .
CMD ["/app/main"]

View File

@@ -1,3 +1,5 @@
# drone-with-go [![Build Status](http://beta.drone.io/api/badges/drone-demos/drone-with-go/status.svg)](http://beta.drone.io/drone-demos/drone-with-go) [![Build Status](https://aircover.co/badges/drone-demos/drone-with-go/coverage.svg)](https://aircover.co/drone-demos/drone-with-go) # drone-with-go [![Build Status](http://beta.drone.io/api/badges/drone-demos/drone-with-go/status.svg)](http://beta.drone.io/drone-demos/drone-with-go) [![Build Status](https://aircover.co/badges/drone-demos/drone-with-go/coverage.svg)](https://aircover.co/drone-demos/drone-with-go)
An example of how to test Go code with Drone. An example of how to test Go code with Drone.
Inspect the .drone.yml file for details on the build steps for this simple go project.

View File

@@ -8,5 +8,5 @@ func main() {
// HelloWorld is a function that returns a string containing "hello world". // HelloWorld is a function that returns a string containing "hello world".
func HelloWorld() string { func HelloWorld() string {
return "hello world" return "hello joseph"
} }

View File

@@ -10,7 +10,7 @@ func TestMain(m *testing.M) {
} }
func TestHelloWorld(t *testing.T) { func TestHelloWorld(t *testing.T) {
if HelloWorld() != "hello world" { if HelloWorld() != "hello joseph" {
t.Errorf("got %s expected %s", HelloWorld(), "hello world") t.Errorf("got %s expected %s", HelloWorld(), "hello world")
} }
} }