From 550c8414110957fea4f21f7a8034fb482df37c4a Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Sat, 24 Nov 2018 18:38:40 +0000 Subject: [PATCH] release script --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++-------- Makefile | 15 +++++++++++---- scripts/release.sh | 16 ---------------- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d859a25..8d08ef1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ # Check https://circleci.com/docs/2.0/language-go/ for more details version: 2 jobs: - build: + test: docker: # specify the version - image: liamg/golang-opengl @@ -11,7 +11,7 @@ jobs: steps: - checkout - run: make test - release: + build-linux: docker: # specify the version - image: liamg/golang-opengl @@ -20,17 +20,40 @@ jobs: - build steps: - checkout - - run: make release - - run: tree release - filters: - tags: - only: /.*/ + - run: make build-linux + - run: tree bin + build-darwin: + docker: + # specify the version + - image: karalabe/xgo-latest:latest + working_directory: /go/src/github.com/liamg/aminal + steps: + - checkout + - run: make build-darwin + - run: tree bin + release: + docker: + # specify the version + - image: karalabe/xgo-latest:latest + working_directory: /go/src/github.com/liamg/aminal + steps: + - checkout + - run: echo nothing to do workflows: version: 2 build: jobs: - - build + - test + - build-darwin + requires: + - test + - build-linux + requires: + - test - release: + requires: + - build-linux + - build-darwin filters: tags: only: /.*/ diff --git a/Makefile b/Makefile index 0879515..0ba5c97 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,14 @@ update-fonts: install-tools curl -L https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Bold/complete/Hack%20Bold%20Nerd%20Font%20Complete.ttf -o "${FONTPATH}/Hack Bold Nerd Font Complete.ttf" packr -v -.PHONY: release -release: test install-tools - ./scripts/release.sh - \ No newline at end of file +.PHONY: build-linux +build-linux: test install-tools + mkdir -p bin + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o bin/aminal-linux-amd64 + +.PHONY: build-darwin +build-darwin: test install-tools + mkdir -p bin + xgo --targets=darwin/amd64 --dest=bin -out ${BINARY}-darwin-amd64 . + + diff --git a/scripts/release.sh b/scripts/release.sh index 698f82b..15b8358 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,22 +1,6 @@ #!/bin/bash set -e -BINARY=aminal - -if [[ "${CIRCLE_TAG}" == "" ]]; then - exit 0 # no tag, nothing to release -fi -mkdir -p release/bin/darwin/amd64/ -mkdir -p release/bin/linux/amd64/ -mkdir -p release/bin/linux/i386/ - -# build for osx using xgo - this cannot be used for linux builds due to missing deps in the xgo containers -# xgo --targets=darwin/amd64 --dest=release/bin/darwin/amd64 -out ${BINARY} . - -GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -o release/bin/linux/i386/aminal -GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o release/bin/linux/amd64/aminal - -exit 0 git tag "${VERSION}"