-
Notifications
You must be signed in to change notification settings - Fork 7
109 lines (109 loc) · 3.23 KB
/
controller-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- run: PATH=$PATH:$GOPATH/bin make build
unit-test:
name: Unit tests
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
working-directory: go/controller
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Go
uses: actions/[email protected]
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- name: Test
run: PATH=$PATH:$GOPATH/bin make test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go/controller/go.mod
check-latest: true
- uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: v1.61.0
working-directory: go/controller
args: --timeout=30m
verify-docs:
name: Verify docs
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: go/controller
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Go
uses: actions/[email protected]
with:
go-version-file: go/controller/go.mod
cache: true
- name: Download dependencies
run: go mod download
- name: Download tools
run: PATH=$PATH:$GOPATH/bin make --directory=.. tools
- name: Test
run: PATH=$PATH:$GOPATH/bin make codegen-crd-docs
- name: Get changed files in the docs folder
id: changed-files-specific
uses: tj-actions/changed-files@v45
with:
files: go/controller/docs/**
- name: Fail if CRD docs are outdated
if: steps.changed-files-specific.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-files-specific.outputs.all_changed_files }}
run: |
echo "CRD docs are outdated. Please run `make codegen-crd-docs` and commit the changes."
echo "Changed files: $CHANGED_FILES"
exit 1