chores: add release yaml #141
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: { } | |
workflow_dispatch: { } | |
jobs: | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
cache: false | |
go-version-file: go.mod | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.50.1 | |
args: --timeout 10m0s | |
unit-tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- step: mod | |
name: Check Go modules | |
command: go mod tidy && git add go.* && git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1); | |
- step: manifests | |
name: Check manifests | |
command: make manifests && git add config && git diff --cached --exit-code || (echo 'Please run "make manifests" to generate manifests' && exit 1); | |
- step: generate | |
name: Check auto-generated codes | |
command: make generate && git add pkg apis && git diff --cached --exit-code || (echo 'Please run "make generate" to generate Go codes' && exit 1); | |
- step: gofmt | |
name: Verify gofmt | |
command: make fmt && git add apis pkg cmd && git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1); | |
- step: govet | |
name: Verify govet | |
command: make vet && git add apis pkg cmd && git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1); | |
- step: build | |
name: Run Go build | |
command: make build | |
- step: test | |
name: Run Go test | |
command: make fast-test | |
name: unit-tests(${{ matrix.name }}) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
cache: false | |
go-version-file: go.mod | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-ut-${{ matrix.step }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-ut-${{ matrix.step }}- | |
- name: ${{ matrix.name }} | |
run: | | |
${{ matrix.command }} |