From 7488be82b5f7376b3c3d7031e93ab5075ca74543 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Sun, 16 Aug 2020 09:30:07 +0300 Subject: [PATCH] Added build workflow --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ ci/build.sh | 5 +++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100755 ci/build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..93c06f8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: build + +on: + push: + branches: + - master + +jobs: + golang: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Golang + uses: actions/setup-go@v2 + with: + go-version: 1.15.x + + - uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Test + run: ci/test.sh + + - name: Build + run: ci/build.sh diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 0000000..4b5ae17 --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export GO111MODULE="on" +go get -u github.com/mitchellh/gox # cross compile +gox -os "linux darwin windows" -arch "amd64" -osarch="windows/386" -output "dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -ldflags "-X main.buildStamp=`date -u '+%Y-%m-%d_%I:%M:%S%p'` -X main.gitRevision=`git describe --tags || git rev-parse HEAD` -s -w"