From 96ddf4cfa06b56555cd3ae359d73b26047333c36 Mon Sep 17 00:00:00 2001 From: zryfish Date: Fri, 27 Mar 2020 10:35:10 +0800 Subject: [PATCH] add workflow to dev branch (#1972) --- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 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 000000000..b6619cc74 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Go + +on: + push: + branches: + - 'master' + - 'dev' + tags: + - 'release-*' + pull_request: + branches: + - 'master' + - 'dev' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + env: + GO111MODULE: on + 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 + + - name: Check pr is properly formatted + run: diff -u <(echo -n) <(gofmt -d ./pkg ./cmd ./tools ./test) + + - name: Downloading go dependencies + run: go mod vendor + + - name: Install kubebuilder + run: bash hack/install_kubebuilder.sh + + - name: Build + run: make all + + - name: Uploading code coverage + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) + + - name: Get branch name + id: extract_branch + shell: bash + run: echo "##[set-output name=branch;]$(ehco ${GITHUB_REF#refs/heads/})" + + - name: Build and push docker images + env: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + if: github.event_name == 'push' + run: bash hack/docker_build.sh ${{ steps.extract_branch.outputs.branch }}