2020-03-19 12:17:27 +01:00
|
|
|
name: Continuous Integration
|
|
|
|
|
|
|
|
on: push
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
ci:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GOFLAGS: -mod=vendor
|
|
|
|
steps:
|
2020-03-20 14:27:22 +01:00
|
|
|
- name: Checkout code
|
2020-03-19 12:17:27 +01:00
|
|
|
uses: actions/checkout@v2
|
2020-03-20 14:27:22 +01:00
|
|
|
- name: Setup Go
|
2020-03-20 14:18:44 +01:00
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: 1.14.x
|
2020-03-20 14:27:22 +01:00
|
|
|
- name: Cache build
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/.cache/go-build
|
|
|
|
key: ${{runner.os}}-go-${{hashFiles('**/go.sum')}}
|
|
|
|
restore-keys: |
|
|
|
|
${{runner.os}}-go-
|
|
|
|
- name: Format code
|
2020-03-19 12:17:27 +01:00
|
|
|
run: |
|
|
|
|
if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then
|
|
|
|
find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;
|
|
|
|
exit 1;
|
|
|
|
fi
|
2020-03-20 14:27:22 +01:00
|
|
|
- name: Test code
|
2020-03-19 12:17:27 +01:00
|
|
|
run: |
|
2020-03-19 12:21:23 +01:00
|
|
|
./test.sh
|
2020-03-20 14:27:22 +01:00
|
|
|
- name: Build binaries
|
2020-03-19 12:17:27 +01:00
|
|
|
run: |
|
|
|
|
go get github.com/mitchellh/gox
|
2020-03-20 14:30:15 +01:00
|
|
|
export PATH="$(go env GOPATH)/bin:$PATH"
|
|
|
|
gox -parallel 4 -os "linux freebsd netbsd windows" -osarch "darwin/i386 darwin/amd64"
|