65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'release*'
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
- 'release*'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GO111MODULE: on
|
|
steps:
|
|
- name: Set up Go 1.16
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.16
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check pr is properly formatted
|
|
run: diff -u <(echo -n) <(gofmt -d ./pkg ./cmd ./tools ./test)
|
|
|
|
- name: Verify goimports
|
|
run: go get -u golang.org/x/tools/cmd/goimports && bash hack/verify-goimports.sh
|
|
|
|
- name: Downloading go dependencies
|
|
run: go mod vendor
|
|
|
|
- name: Build
|
|
run: make all
|
|
|
|
- name: Make OpenAPI Spec
|
|
run: make openapi
|
|
|
|
- name: Uploading code coverage
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
file: ./coverage.txt
|
|
flags: unittests
|
|
name: codecov-umbrella
|
|
fail_ci_if_error: false
|
|
|
|
- name: Build and push docker images
|
|
env:
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
|
REPO=kubespheredev TAG=${GITHUB_REF#refs/*/} make container-push
|