-
Notifications
You must be signed in to change notification settings - Fork 27
169 lines (146 loc) · 4.43 KB
/
pr-checks.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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
name: pr-checks
on:
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: make docs
run: |
make docs
git diff --exit-code
gofmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: run gofmt test
run: ./automation/presubmit-tests/gofmt.sh
escapes_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: run escapes detect
run: make escapes_detect
golangci:
permissions:
contents: read
# NOTE: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
runs-on: ubuntu-latest
steps:
- name: code checkout
uses: actions/checkout@v3
- uses: actions/setup-go@main
with:
go-version-file: go.mod
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
args: --timeout=3m --issues-exit-code=0 ./...
only-new-issues: true
vulnerability_detect:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: run vulnerability detect
run: make govulncheck
bundle:
needs: [docs, golangci, gofmt, vulnerability_detect, escapes_detect]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: bundle
run: |
make generate manifests bundle
git diff --exit-code
build-images:
needs: [docs, golangci, gofmt, vulnerability_detect, escapes_detect]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@main
with:
go-version-file: go.mod
- uses: ./.github/compute-version
id: version
- name: additional image tags
id: additional_tags
shell: bash
run: |
echo "result=$(git rev-parse --short HEAD),v1alpha1" >> $GITHUB_OUTPUT
- name: build images for PR checks
uses: ./.github/publish-images
with:
image_registry: "localhost:5001"
version: ${{ steps.version.outputs.version }}
additional_tags: ${{ steps.additional_tags.outputs.result }}
e2e:
needs: [docs, golangci, gofmt, vulnerability_detect, escapes_detect]
env:
KIND_VERSION: "0.15.0"
GO111MODULE: "on"
OPERATOR_IMAGE: "quay.io/sustainable_computing_io/kepler-operator"
KUBECONFIG: /tmp/.kube/config
KIND_WORKER_NODES: 2
name: e2e
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@main
with:
go-version-file: go.mod
- name: Install all tools
run: make tools
- name: use kepler action for kind cluster build
uses: sustainable-computing-io/[email protected]
with:
cluster_provider: kind
runningBranch: kind
env:
PROMETHEUS_ENABLE: "true"
- name: Ensure cluster is able to run OLM bundles
run: make cluster-prereqs
- uses: ./.github/compute-version
id: version
- name: Run e2e tests
run: |
./tests/run-e2e.sh --ci
env:
VERSION: ${{ steps.version.outputs.version }}
- name: Capture cluster state
if: always()
shell: bash
run: |
# Capture apiserver state
# TODO: enable this when we have oc installed as part of `make tools`
# oc adm inspect node --dest-dir cluster-state || true
# oc adm inspect -A statefulset --dest-dir cluster-state || true
# oc adm inspect -A deployment --dest-dir cluster-state || true
# oc adm inspect -A ns --dest-dir cluster-state || true
cp -r tmp/e2e cluster-state/ || true
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: cluster-state
path: cluster-state