From e5136332e3e6aa6d52ab3cbd626dfefb5f86d540 Mon Sep 17 00:00:00 2001 From: Dominic Wong Date: Thu, 4 Jun 2020 13:46:22 +0100 Subject: [PATCH] Add build and test of micro to pre-release testing (#1684) * fix up example test build * build and test micro when cutting a new release --- .github/workflows/micro-main.yml | 34 +++++++++++++++++++ .../workflows/scripts/build-all-examples.sh | 6 ++-- .github/workflows/scripts/build-micro.sh | 14 ++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/micro-main.yml create mode 100755 .github/workflows/scripts/build-micro.sh diff --git a/.github/workflows/micro-main.yml b/.github/workflows/micro-main.yml new file mode 100644 index 00000000..f74f1c79 --- /dev/null +++ b/.github/workflows/micro-main.yml @@ -0,0 +1,34 @@ +name: Build and test micro +on: + push: + branches: + - 'release-**' + +jobs: + + build: + name: Build and test micro + 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 this code + uses: actions/checkout@v2 + with: + path: 'go-micro' + + - name: Check out micro + uses: actions/checkout@v2 + with: + repository: 'micro/micro' + path: 'micro' + + - name: Build all + run: $GITHUB_WORKSPACE/go-micro/.github/workflows/scripts/build-micro.sh $GITHUB_SHA + working-directory: micro + \ No newline at end of file diff --git a/.github/workflows/scripts/build-all-examples.sh b/.github/workflows/scripts/build-all-examples.sh index 67896217..6501b421 100755 --- a/.github/workflows/scripts/build-all-examples.sh +++ b/.github/workflows/scripts/build-all-examples.sh @@ -4,7 +4,7 @@ function build_binary { echo building $1 pushd $1 - go build + go build -o _main local ret=$? if [ $ret -gt 0 ]; then failed=1 @@ -32,9 +32,7 @@ function check_dir { } failed_arr=() failed=0 -this_hash=$1 -go mod init github.com/micro/examples -go mod edit -require=github.com/micro/go-micro/v2@$1 +go mod edit -replace github.com/micro/go-micro/v2=github.com/micro/go-micro/v2@$1 check_dir . $1 if [ $failed -gt 0 ]; then echo Some builds failed diff --git a/.github/workflows/scripts/build-micro.sh b/.github/workflows/scripts/build-micro.sh new file mode 100755 index 00000000..38b9b999 --- /dev/null +++ b/.github/workflows/scripts/build-micro.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# set -x + +failed=0 +go mod edit -replace github.com/micro/go-micro/v2=github.com/micro/go-micro/v2@$1 +# basic test, build the binary +go build +failed=$? +if [ $failed -gt 0 ]; then + exit $failed +fi +# unit tests +IN_TRAVIS_CI=yes go test -v ./... +# TODO integration tests \ No newline at end of file