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 { steps {
script { script {
name = "Build" name = "Build"
scriptContent = "./build.sh" scriptContent = "make build -j 3"
dockerImage = golangImage dockerImage = golangImage
dockerPull = true dockerPull = true
} }
@ -84,15 +84,7 @@ object Build : BuildType({
script { script {
name = "Test" name = "Test"
scriptContent = """ scriptContent = "make test | go-test-teamcity"
set -eux
go test -c ./driver
go test -c ./iso
go test -c ./clone
./test.sh | go-test-teamcity
""".trimIndent()
dockerImage = golangImage dockerImage = golangImage
dockerPull = true dockerPull = true
dockerRunParameters = "--network=container:vpn" 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 - modules:/go/pkg/mod
- cache:/root/.cache - cache:/root/.cache
working_dir: /work working_dir: /work
command: ./build.sh command: make build -j 3
test: test:
image: jetbrainsinfra/golang:1.11.4 image: jetbrainsinfra/golang:1.11.4
@ -20,7 +20,7 @@ services:
environment: environment:
VSPHERE_USERNAME: VSPHERE_USERNAME:
VSPHERE_PASSWORD: VSPHERE_PASSWORD:
command: ./test.sh command: make test
volumes: volumes:
modules: 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