Add a docker container & run tests there

This is a bit of a weird idea:  We run tests as part of the docker build.
This commit is contained in:
Matthew McPherrin
2019-08-14 16:57:11 -07:00
parent 4a522082fc
commit 54580f496c
2 changed files with 27 additions and 11 deletions
+6 -11
View File
@@ -5,19 +5,14 @@ language: go
go:
- '1.12.x'
install:
- pip install cram --user
before_script:
- go vet -v ./...
services:
- docker
script:
- GOOS=linux GOARCH=amd64 go build -o certigo-linux-amd64
- GOOS=darwin GOARCH=amd64 go build -o certigo-darwin-amd64
- GOOS=windows GOARCH=amd64 go build -o certigo-windows-amd64.exe
- go test -v ./...
- ln -s certigo-linux-amd64 certigo
- PATH=$PWD:$PATH cram -v tests/*.t
- docker build -f Dockerfile .
- GOOS=linux GOARCH=amd64 go build -o certigo-$GOOS-$GOARCH
- GOOS=darwin GOARCH=amd64 go build -o certigo-$GOOS-$GOARCH
- GOOS=windows GOARCH=amd64 go build -o certigo-$GOOS-$GOARCH
deploy:
provider: releases
+21
View File
@@ -0,0 +1,21 @@
FROM golang:alpine AS builder
COPY . /src
WORKDIR /src
ENV CGO_ENABLED=0
RUN go build -mod=vendor -o /bin/certigo
RUN go vet -mod=vendor ./...
RUN go test -mod=vendor ./...
FROM python
RUN pip install cram
COPY --from=builder /bin/certigo /bin/certigo
COPY tests /tests
RUN cram -v /tests/*.t
FROM alpine
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
COPY --from=builder /bin/certigo /bin/certigo
ENTRYPOINT ["/bin/certigo"]