Skip to content

Better api scope setup #2410

Better api scope setup

Better api scope setup #2410

name: CI / Controller
on:
push:
branches:
- "master"
paths:
- ".github/workflows/controller.yaml"
- "go/controller/**"
pull_request:
branches:
- "**"
paths:
- ".github/workflows/controller.yaml"
- "go/controller/**"
permissions:
contents: read
env:
GOPATH: /home/runner/go/
GOPROXY: "https://proxy.golang.org"
jobs:
build:
name: Build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: go/controller
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v6
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download dependencies
run: go mod download
- run: PATH=$PATH:$GOPATH/bin make build
unit-test:
name: Unit tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: go/controller
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go/controller/go.mod
cache: true
- name: Test
run: PATH=$PATH:$GOPATH/bin make test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v6
with:
go-version-file: go/controller/go.mod
check-latest: true
cache: 'false'
- uses: golangci/golangci-lint-action@v8
with:
skip-cache: 'true'
version: v2.4.0
working-directory: go/controller
args: --timeout=30m
check-docs:
name: verify controller docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check docs
run: make codegen-crd-docs
working-directory: go/controller
- name: verify controller docs
working-directory: go/controller
run: |
git diff --exit-code -- docs/api.md || {
echo "::error docs were not generated. Please run 'make codegen-crd-docs' and commit the changes."
exit 1
}