build by Make

This commit is contained in:
Michael Kuzmin 2019-01-04 17:20:34 +03:00
parent 23ce26e82c
commit c6e97fe887
5 changed files with 40 additions and 35 deletions

View File

@ -72,7 +72,7 @@ object Build : BuildType({
steps {
script {
name = "Build"
scriptContent = "./build.sh"
scriptContent = "make build -j 3"
dockerImage = golangImage
dockerPull = true
}
@ -84,15 +84,7 @@ object Build : BuildType({
script {
name = "Test"
scriptContent = """
set -eux
go test -c ./driver
go test -c ./iso
go test -c ./clone
./test.sh | go-test-teamcity
""".trimIndent()
scriptContent = "make test | go-test-teamcity"
dockerImage = golangImage
dockerPull = true
dockerRunParameters = "--network=container:vpn"

36
Makefile Normal file
View File

@ -0,0 +1,36 @@
GOOPTS := GOARCH=amd64 CGO_ENABLED=0
build: iso clone
iso: iso-linux iso-windows iso-macos
clone: clone-linux clone-windows clone-macos
iso-linux: modules bin
$(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso
iso-windows: modules bin
$(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso
iso-macos: modules bin
$(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso
clone-linux: modules bin
$(GOOPTS) GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone
clone-windows: modules bin
$(GOOPTS) GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone
clone-macos: modules bin
$(GOOPTS) GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone
modules:
go mod download
bin:
mkdir -p bin
rm -f bin/*
test:
PACKER_ACC=1 go test -v -count 1 ./driver ./iso ./clone
.PHONY: bin test

View File

@ -1,16 +0,0 @@
#!/bin/sh
set -eux
export CGO_ENABLED=0
export GOARCH=amd64
mkdir -p bin
rm -f bin/*
GOOS=darwin go build -o bin/packer-builder-vsphere-iso.macos ./cmd/iso
GOOS=linux go build -o bin/packer-builder-vsphere-iso.linux ./cmd/iso
GOOS=windows go build -o bin/packer-builder-vsphere-iso.exe ./cmd/iso
GOOS=darwin go build -o bin/packer-builder-vsphere-clone.macos ./cmd/clone
GOOS=linux go build -o bin/packer-builder-vsphere-clone.linux ./cmd/clone
GOOS=windows go build -o bin/packer-builder-vsphere-clone.exe ./cmd/clone

View File

@ -7,7 +7,7 @@ services:
- modules:/go/pkg/mod
- cache:/root/.cache
working_dir: /work
command: ./build.sh
command: make build -j 3
test:
image: jetbrainsinfra/golang:1.11.4
@ -20,7 +20,7 @@ services:
environment:
VSPHERE_USERNAME:
VSPHERE_PASSWORD:
command: ./test.sh
command: make test
volumes:
modules:

View File

@ -1,7 +0,0 @@
#!/bin/sh
set -eux
export PACKER_ACC=1
go test -v -count 1 -timeout 20m ./driver ./iso ./clone