-
Notifications
You must be signed in to change notification settings - Fork 57
156 lines (156 loc) · 5.72 KB
/
Copy pathpr.yml
File metadata and controls
156 lines (156 loc) · 5.72 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Go Test on Pull Requests
on:
pull_request:
types:
- opened
- synchronize
- reopened
merge_group:
types: [checks_requested]
jobs:
go:
name: Check sources
runs-on: ubuntu-latest
env:
OPERATOR_SDK_VERSION: v1.39.1
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: go.mod
- name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
id: cache-operator-sdk
with:
path: ~/cache
key: operator-sdk-${{ env.OPERATOR_SDK_VERSION }}
- name: Download Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
if: steps.cache-operator-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache
wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null
chmod +x ~/cache/operator-sdk-${OPERATOR_SDK_VERSION}
- name: Install Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
run: |
mkdir -p ~/bin
cp ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} ~/bin/operator-sdk
echo "$HOME/bin" >> $GITHUB_PATH
- name: Regenerate executables with current environment packages
run: |
rm -f bin/kustomize bin/controller-gen
make kustomize controller-gen
- name: Cache go modules
id: cache-mod
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
if: steps.cache-mod.outputs.cache-hit != 'true'
- name: Check go mod status
run: |
go mod tidy
if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]]
then
echo "Go mod state is not clean:"
git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen'
exit 1
fi
- name: Check format
run: |
make fmt
if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]]
then
echo "Some files are not properly formatted."
echo "Please run `go fmt` and amend your commit."
git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen'
exit 1
fi
- uses: dominikh/staticcheck-action@9716614d4101e79b4340dd97b10e54d68234e431 # v1.4.1
with:
version: "2025.1.1"
install-go: false
- name: Check manifests
run: |
make generate manifests
if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]]
then
echo "generated sources are not up to date:"
git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen'
exit 1
fi
- name: Check RBAC wildcards
run: |
if grep -n "*" config/rbac/*.yaml ; then
echo "RBAC files contain wildcards (*)"
exit 1
fi
- name: Run Go Tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
with:
flags: unit-tests
token: ${{ secrets.CODECOV_TOKEN }}
- name: Ensure make build succeeds
run: make build
- name: Ensure make bundle succeeds
run: make bundle
docker:
name: Check docker build
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- name: Check if dockerimage build is working
run: docker build -f ./Dockerfile .
check-agents-md:
name: Check AGENTS.md line count
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Enforce AGENTS.md max 60 lines
run: |
lines=$(grep -c '.' AGENTS.md)
if [ "$lines" -gt 60 ]; then
echo "AGENTS.md has $lines non-empty lines (max 60)"
exit 1
fi
gitlint:
name: Run gitlint checks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
ref: ${{ github.sha }}
- name: Install gitlint into container
run: |
python3 -m venv venv
source venv/bin/activate
python3 -m pip install gitlint
- name: Run gitlint check
run: |
source venv/bin/activate
RAW_BASE_REF="${{ github.base_ref || github.event.merge_group.base_ref }}"
BASE_REF="${RAW_BASE_REF#refs/heads/}"
echo "Base ref: $BASE_REF"
git fetch origin "$BASE_REF"
gitlint --commits "origin/$BASE_REF"..HEAD
check-renovate-config-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- uses: konflux-ci/renovate-config-validator-action@main
with:
config_file: .github/renovate.json