From 700c5795f5d45dcb803e04cc6a1f7de00894ed0b Mon Sep 17 00:00:00 2001 From: hiCasper Date: Wed, 22 Apr 2020 11:15:26 +0800 Subject: [PATCH] Support Github Actions (#310) --- .github/workflows/build.yml | 67 +++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ba8912a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,67 @@ +name: Build + +on: + push: + branches: [ master ] + +jobs: + + test: + name: Test + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Get dependencies + run: | + go get github.com/rakyll/statik + export PATH=$PATH:~/go/bin/ + statik -src=models -f + + - name: Test + run: go test -coverprofile=coverage.txt -covermode=atomic ./... + + build: + name: Build + needs: test + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + with: + submodules: 'recursive' + + - name: Get dependencies and build + run: | + go get github.com/rakyll/statik + export PATH=$PATH:~/go/bin/ + statik -src=models -f + sudo apt-get update + sudo apt-get -y install gcc-mingw-w64-x86-64 + sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross + sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross + chmod +x ./build.sh + ./build.sh -r b + + - name: Upload binary files + uses: actions/upload-artifact@v1 + with: + name: release + path: release/