Skip to content

Commit f39b8bc

Browse files
authored
Merge pull request #8760 from jackfrancis/ci-ca-1.32
[cluster-autoscaler-1.32] GHA config
2 parents 79b9292 + f5e40d5 commit f39b8bc

File tree

6 files changed

+80
-159
lines changed

6 files changed

+80
-159
lines changed

.github/workflows/ca-test.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Cluster Autoscaler
2+
3+
on:
4+
push:
5+
paths:
6+
- 'cluster-autoscaler/**'
7+
pull_request:
8+
paths:
9+
- 'cluster-autoscaler/**'
10+
11+
env:
12+
GOPATH: ${{ github.workspace }}/go
13+
14+
permissions:
15+
contents: read
16+
checks: write
17+
18+
jobs:
19+
test:
20+
name: test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/[email protected]
24+
with:
25+
path: ${{ env.GOPATH }}/src/k8s.io/autoscaler
26+
27+
- name: Set up Go
28+
uses: actions/[email protected]
29+
with:
30+
go-version: '1.23.11'
31+
cache-dependency-path: |
32+
${{ env.GOPATH}}/src/k8s.io/autoscaler/cluster-autoscaler/go.sum
33+
- name: Apt-get
34+
run: sudo apt-get install libseccomp-dev -qq
35+
36+
- name: Test
37+
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler
38+
run: hack/for-go-proj.sh cluster-autoscaler
39+
env:
40+
GO111MODULE: auto
41+
PROJECT_NAMES: ""

.github/workflows/pr.yaml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: Verify Go
22

33
on:
44
- push
@@ -9,19 +9,25 @@ env:
99

1010
permissions:
1111
contents: read
12+
checks: write
1213

1314
jobs:
14-
test-and-verify:
15+
verify:
16+
name: verify
1517
runs-on: ubuntu-latest
1618
steps:
17-
- name: Set up Go
18-
uses: actions/setup-go@v2
19+
- uses: actions/[email protected]
1920
with:
20-
go-version: '1.22.2'
21+
path: ${{ env.GOPATH }}/src/k8s.io/autoscaler
2122

22-
- uses: actions/checkout@v2
23+
- name: Set up Go
24+
uses: actions/[email protected]
2325
with:
24-
path: ${{ env.GOPATH }}/src/k8s.io/autoscaler
26+
go-version: '1.23.11'
27+
cache-dependency-path: |
28+
${{ env.GOPATH}}/src/k8s.io/autoscaler/cluster-autoscaler/go.sum
29+
${{ env.GOPATH}}/src/k8s.io/autoscaler/vertical-pod-autoscaler/go.sum
30+
${{ env.GOPATH}}/src/k8s.io/autoscaler/vertical-pod-autoscaler/e2e/go.sum
2531
2632
- name: Apt-get
2733
run: sudo apt-get install libseccomp-dev -qq
@@ -36,10 +42,4 @@ jobs:
3642
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler
3743
run: hack/verify-all.sh -v
3844
env:
39-
GO111MODULE: auto
40-
41-
- name: Test
42-
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler
43-
run: hack/for-go-proj.sh test
44-
env:
45-
GO111MODULE: auto
45+
GO111MODULE: auto

hack/for-go-proj.sh

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,39 @@ set -o pipefail
1919
set -o nounset
2020

2121
CONTRIB_ROOT="$(dirname ${BASH_SOURCE})/.."
22-
PROJECT_NAMES=(addon-resizer vertical-pod-autoscaler)
2322

2423
if [[ $# -ne 1 ]]; then
25-
echo "missing subcommand: [build|install|test]"
24+
echo "missing subcommand: [cluster-autoscaler|vertical-pod-autoscaler|addon-resizer]"
2625
exit 1
2726
fi
2827

29-
CMD="${1}"
30-
31-
case "${CMD}" in
32-
"build")
28+
PROJECT="${1}"
29+
30+
case "${PROJECT}" in
31+
"cluster-autoscaler")
32+
pushd ${CONTRIB_ROOT}/cluster-autoscaler/
33+
# TODO: #8127 - Use default analyzers set by `go test` to include `printf` analyzer.
34+
# Default analyzers that go test runs according to https://github.com/golang/go/blob/52624e533fe52329da5ba6ebb9c37712048168e0/src/cmd/go/internal/test/test.go#L649
35+
# This doesn't include the `printf` analyzer until cluster-autoscaler libraries are updated.
36+
ANALYZERS="atomic,bool,buildtags,directive,errorsas,ifaceassert,nilfunc,slog,stringintconv,tests"
37+
go test -count=1 ./... -vet="${ANALYZERS}"
38+
popd
3339
;;
34-
"install")
40+
"vertical-pod-autoscaler")
41+
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler
42+
go test -count=1 -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e | grep -v cluster-autoscaler/apis)
43+
popd
44+
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler/e2e
45+
go test -run=None ./...
46+
popd
3547
;;
36-
"test")
48+
"addon-resizer")
49+
pushd ${CONTRIB_ROOT}/addon-resizer
50+
godep go test -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e)
51+
popd
3752
;;
3853
*)
3954
echo "invalid subcommand: ${CMD}"
4055
exit 1
4156
;;
42-
esac
43-
44-
for project_name in ${PROJECT_NAMES[*]}; do
45-
(
46-
export GO111MODULE=auto
47-
project=${CONTRIB_ROOT}/${project_name}
48-
echo "${CMD}ing ${project}"
49-
cd "${project}"
50-
case "${CMD}" in
51-
"test")
52-
if [[ -n $(find . -name "Godeps.json") ]]; then
53-
godep go test -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e)
54-
else
55-
go test -race $(go list ./... | grep -v /vendor/ | grep -v vertical-pod-autoscaler/e2e | grep -v cluster-autoscaler/apis)
56-
fi
57-
;;
58-
*)
59-
godep go "${CMD}" ./...
60-
;;
61-
esac
62-
)
63-
done;
64-
65-
if [ "${CMD}" = "build" ] || [ "${CMD}" == "test" ]; then
66-
pushd ${CONTRIB_ROOT}/vertical-pod-autoscaler/e2e
67-
go test -run=None ./...
68-
popd
69-
pushd ${CONTRIB_ROOT}/cluster-autoscaler/
70-
go test ./...
71-
popd
72-
fi
57+
esac

hack/verify-golint.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ cd "${KUBE_ROOT}"
2323

2424
GOLINT=${GOLINT:-"golint"}
2525
excluded_packages=(
26-
'/vendor/'
27-
'vertical-pod-autoscaler/pkg/client'
2826
'cluster-autoscaler/cloudprovider/aws/aws-sdk-go'
2927
'cluster-autoscaler/cloudprovider/magnum/gophercloud'
3028
'cluster-autoscaler/cloudprovider/digitalocean/godo'
3129
'cluster-autoscaler/cloudprovider/bizflycloud/gobizfly'
3230
'cluster-autoscaler/cloudprovider/brightbox/gobrightbox'
3331
'cluster-autoscaler/cloudprovider/brightbox/k8ssdk'
34-
'cluster-autoscaler/cloudprovider/brightbox/linkheader'
3532
'cluster-autoscaler/cloudprovider/brightbox/go-cache'
36-
'cluster-autoscaler/cloudprovider/externalgrpc/protos'
3733
'cluster-autoscaler/cloudprovider/exoscale/internal'
3834
'cluster-autoscaler/cloudprovider/huaweicloud/huaweicloud-sdk-go-v3'
3935
'cluster-autoscaler/cloudprovider/ionoscloud/ionos-cloud-sdk-go'
@@ -45,7 +41,7 @@ excluded_packages=(
4541
'cluster-autoscaler/cloudprovider/volcengine/volcengine-go-sdk'
4642
)
4743

48-
FIND_PACKAGES='go list ./... '
44+
FIND_PACKAGES='go list ./... 2> /dev/null '
4945
for package in "${excluded_packages[@]}"; do
5046
FIND_PACKAGES+="| grep -v ${package} "
5147
done

0 commit comments

Comments
 (0)