Skip to content

Commit

Permalink
Merge pull request #50 from brendanjryan/bjr-test-target
Browse files Browse the repository at this point in the history
adds a new make target for running tests
  • Loading branch information
garethr committed Jul 27, 2019
2 parents cc3fdd4 + b441e29 commit dee4fa3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Expand Up @@ -4,14 +4,16 @@ WORKDIR /
COPY . /
RUN GOOS=linux GOARCH=amd64 go build -o conftest -ldflags="-w -s" cmd/main.go

FROM golang:1.12-alpine as test
COPY --from=builder /conftest /
RUN go test /conftest/...

FROM bats/bats:v1.1.0 as acceptance
COPY --from=builder /conftest /
COPY acceptance.bats /acceptance.bats
COPY examples /examples
RUN ./acceptance.bats


FROM golang:1.12-alpine as examples

ENV TERRAFORM_VERSION=0.12.0-rc1 \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -20,6 +20,9 @@ conftest:
$(BUILD) -t $(IMAGE):$(TAG) .
$(COMMAND) tag $(IMAGE):$(TAG) $(IMAGE):latest

test: conftest
$(BUILD) --target test

push: examples conftest
$(PUSH) $(IMAGE):$(TAG)
$(PUSH) $(IMAGE):latest
Expand Down

0 comments on commit dee4fa3

Please sign in to comment.