0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-24 23:30:39 +00:00

User standardized build system.

This commit is contained in:
John Engelman 2016-01-26 23:47:58 +01:00
parent ec8a395cdd
commit ab8b30fc1f
2 changed files with 52 additions and 18 deletions

View File

@ -1,28 +1,38 @@
build: build:
image: golang:1.5 image: golang:1.5
environment: environment:
- GO15VENDOREXPERIMENT=1
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0 - CGO_ENABLED=0
commands: commands:
- go get - make deps
- go build - make vet
- go test - make build
- make test
publish: publish:
docker: coverage:
username: drone
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: objectpartners/drone-terraform
when: when:
branch: master branch: master
docker:
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-terraform
tag: latest
when:
branch: master
docker:
username: $$DOCKER_USER
password: $$DOCKER_PASS
email: $$DOCKER_EMAIL
repo: plugins/drone-terraform
tag: develop
when:
branch: develop
plugin: plugin:
name: Terraform name: Terraform
desc: Execute Terraform commands desc: Execute Terraform plan and apply
type: deploy type: deploy
image: objectpartners/drone-terraform image: plugins/drone-terraform
labels: labels:
- terraform - terraform

View File

@ -1,8 +1,32 @@
deps: .PHONY: clean deps fmt vet test docker
GO15VENDOREXPERIMENT=1 go get -u ./...
build: EXECUTABLE ?= drone-terraform
GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build IMAGE ?= plugins/$(EXECUTABLE)
CI_BUILD_NUMBER ?= 0
LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')"
PACKAGES = $(shell go list ./... | grep -v /vendor/)
clean: clean:
rm drone-terraform go clean -i ./...
deps:
go get -t ./...
fmt:
go fmt $(PACKAGES)
vet:
go vet $(PACKAGES)
test:
@for PKG in $(PACKAGES); do go test -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
docker:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-s -w $(LDFLAGS)'
docker build --rm -t $(IMAGE) .
$(EXECUTABLE): $(wildcard *.go)
go build -ldflags '-s -w $(LDFLAGS)'
build: $(EXECUTABLE)