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"