8
8
check :
9
9
runs-on : " ubuntu-latest"
10
10
steps :
11
- - uses : actions/checkout@v3
12
- - uses : ./.github/composite/go- setup
11
+ - uses : actions/checkout@v4
12
+ - uses : knative/actions/ setup-go@main
13
13
- name : Lint
14
14
run : make check && make check-templates
15
15
- name : Check that 'func.yaml schema' is up-to-date
@@ -25,131 +25,240 @@ jobs:
25
25
runs-on : ${{ matrix.os }}
26
26
steps :
27
27
- run : git config --global core.autocrlf false
28
- - uses : actions/checkout@v3
29
- - uses : ./.github/composite/go- setup
30
- - uses : actions/setup-java@v1
28
+ - uses : actions/checkout@v4
29
+ - uses : knative/actions/ setup-go@main
30
+ - uses : actions/setup-java@v4
31
31
with :
32
32
java-version : ${{ matrix.java }}
33
+ distribution : ' temurin'
34
+ - uses : actions/setup-python@v5
35
+ with :
36
+ python-version : ' 3.10'
33
37
- name : Unit Test
34
38
run : make test
35
39
- name : Template Unit Tests
36
40
run : make test-templates
37
- - uses : codecov/codecov-action@v3
41
+ - uses : codecov/codecov-action@v5
38
42
with :
39
43
files : ./coverage.txt
40
44
flags : unit-tests-${{ matrix.os }}
45
+ fail_ci_if_error : true
46
+ verbose : true
47
+ token : ${{ secrets.CODECOV_TOKEN }}
41
48
42
49
test-integration :
43
50
runs-on : " ubuntu-latest"
44
51
steps :
45
- - uses : actions/checkout@v3
46
- - uses : ./.github/composite/go-setup
52
+ - name : Set Environment Variables
53
+ run : |
54
+ echo "KUBECONFIG=${{ github.workspace }}/hack/bin/kubeconfig.yaml" >> "$GITHUB_ENV"
55
+ echo "PATH=${{ github.workspace }}/hack/bin:$PATH" >> "$GITHUB_ENV"
56
+ - uses : actions/checkout@v4
57
+ - uses : knative/actions/setup-go@main
47
58
- name : Install Binaries
48
- run : ./hack/binaries.sh
59
+ run : ./hack/install- binaries.sh
49
60
- name : Allocate Cluster
50
- run : ./hack/allocate.sh
61
+ run : |
62
+ attempt=0
63
+ max_attempts=5
64
+ until [ $attempt -ge $max_attempts ]
65
+ do
66
+ attempt=$((attempt+1))
67
+ echo "------------------ Attempt $attempt ------------------"
68
+ ./hack/allocate.sh && break
69
+ echo "------------------ failed, retrying... ------------------"
70
+ if [ $attempt -ge $max_attempts ]; then
71
+ echo "------------------ max # of retries reached, exiting ------------------"
72
+ exit 1
73
+ fi
74
+ ./hack/delete.sh
75
+ echo "------------------ sleep for 5 minutes ------------------"
76
+ sleep 300
77
+ done
78
+ echo "------------------ finished! attempt $attempt ------------------"
51
79
- name : Local Registry
52
80
run : ./hack/registry.sh
81
+ - name : Setup testing images
82
+ run : ./hack/setup-testing-images.sh
53
83
- name : Integration Tests
54
84
run : make test-integration
55
- - uses : codecov/codecov-action@v3
85
+ - uses : codecov/codecov-action@v5
56
86
with :
57
87
files : ./coverage.txt
58
88
flags : integration-tests
89
+ fail_ci_if_error : true
90
+ verbose : true
91
+ token : ${{ secrets.CODECOV_TOKEN }}
59
92
60
93
e2e-test :
61
94
strategy :
62
95
matrix :
63
96
os : ["ubuntu-latest"]
64
97
runs-on : ${{ matrix.os }}
65
98
steps :
66
- - uses : actions/checkout@v3
67
- - uses : ./.github/composite/go-setup
99
+ - name : Set Environment Variables
100
+ run : |
101
+ echo "KUBECONFIG=${{ github.workspace }}/hack/bin/kubeconfig.yaml" >> "$GITHUB_ENV"
102
+ echo "PATH=${{ github.workspace }}/hack/bin:$PATH" >> "$GITHUB_ENV"
103
+ - uses : actions/checkout@v4
104
+ - uses : knative/actions/setup-go@main
68
105
- name : Install Binaries
69
- run : ./hack/binaries.sh
106
+ run : ./hack/install- binaries.sh
70
107
- name : Allocate Cluster
71
- run : ./hack/allocate.sh
108
+ run : |
109
+ attempt=0
110
+ max_attempts=5
111
+ until [ $attempt -ge $max_attempts ]
112
+ do
113
+ attempt=$((attempt+1))
114
+ echo "------------------ Attempt $attempt ------------------"
115
+ ./hack/allocate.sh && break
116
+ echo "------------------ failed, retrying... ------------------"
117
+ if [ $attempt -ge $max_attempts ]; then
118
+ echo "------------------ max # of retries reached, exiting ------------------"
119
+ exit 1
120
+ fi
121
+ ./hack/delete.sh
122
+ echo "------------------ sleep for 5 minutes ------------------"
123
+ sleep 300
124
+ done
125
+ echo "------------------ finished! attempt $attempt ------------------"
72
126
- name : Local Registry
73
127
run : ./hack/registry.sh
74
128
- name : E2E Test
75
129
run : make test-e2e
76
- - uses : codecov/codecov-action@v3
130
+ - uses : codecov/codecov-action@v5
77
131
with :
78
132
files : ./coverage.txt
79
133
flags : e2e-test
134
+ fail_ci_if_error : true
135
+ verbose : true
136
+ token : ${{ secrets.CODECOV_TOKEN }}
80
137
81
138
e2e-on-cluster-test :
82
139
strategy :
83
140
matrix :
84
141
os : ["ubuntu-latest"]
85
142
runs-on : ${{ matrix.os }}
86
143
steps :
87
- - uses : actions/checkout@v3
88
- - uses : ./.github/composite/go-setup
144
+ - name : Set Environment Variables
145
+ run : |
146
+ echo "KUBECONFIG=${{ github.workspace }}/hack/bin/kubeconfig.yaml" >> "$GITHUB_ENV"
147
+ echo "PATH=${{ github.workspace }}/hack/bin:$PATH" >> "$GITHUB_ENV"
148
+ - uses : actions/checkout@v4
149
+ - uses : knative/actions/setup-go@main
89
150
-
uses :
imjasonh/[email protected]
90
151
- name : Install Binaries
91
- run : ./hack/binaries.sh
152
+ run : ./hack/install- binaries.sh
92
153
- name : Allocate Cluster
93
- run : ./hack/allocate.sh
154
+ run : |
155
+ attempt=0
156
+ max_attempts=5
157
+ until [ $attempt -ge $max_attempts ]
158
+ do
159
+ attempt=$((attempt+1))
160
+ echo "------------------ Attempt $attempt ------------------"
161
+ ./hack/allocate.sh && break
162
+ echo "------------------ failed, retrying... ------------------"
163
+ if [ $attempt -ge $max_attempts ]; then
164
+ echo "------------------ max # of retries reached, exiting ------------------"
165
+ exit 1
166
+ fi
167
+ ./hack/delete.sh
168
+ echo "------------------ sleep for 5 minutes ------------------"
169
+ sleep 300
170
+ done
171
+ echo "------------------ finished! attempt $attempt ------------------"
94
172
- name : Setup testing images
95
173
run : ./hack/setup-testing-images.sh
96
174
- name : Deploy Tekton
97
- run : ./hack/tekton.sh
175
+ run : ./hack/install- tekton.sh
98
176
- name : Deploy Test Git Server
99
- run : ./test/gitserver .sh
177
+ run : ./hack/install-git-server .sh
100
178
- name : E2E On Cluster Test
101
179
env :
102
180
E2E_RUNTIMES : " "
103
181
run : make test-e2e-on-cluster
104
- - uses : codecov/codecov-action@v3
182
+ - uses : codecov/codecov-action@v5
105
183
with :
106
184
files : ./coverage.txt
107
185
flags : e2e-test-oncluster
186
+ fail_ci_if_error : true
187
+ verbose : true
188
+ token : ${{ secrets.CODECOV_TOKEN }}
108
189
109
190
build :
110
191
needs : [check, test-unit, test-integration, e2e-test, e2e-on-cluster-test]
111
192
runs-on : ubuntu-latest
112
193
steps :
113
- - uses : actions/checkout@v3
114
- - uses : ./.github/composite/go- setup
194
+ - uses : actions/checkout@v4
195
+ - uses : knative/actions/ setup-go@main
115
196
# Standard build tasks
116
197
- name : Build
117
198
run : make cross-platform
118
199
# Upload all build artifacts
119
- - uses : actions/upload-artifact@v2
200
+ - uses : actions/upload-artifact@v4
120
201
with :
121
202
name : OSX Binary (AMD)
122
203
path : func_darwin_amd64
123
- - uses : actions/upload-artifact@v2
204
+ - uses : actions/upload-artifact@v4
124
205
with :
125
206
name : OSX Binary (ARM)
126
207
path : func_darwin_arm64
127
- - uses : actions/upload-artifact@v2
208
+ - uses : actions/upload-artifact@v4
128
209
with :
129
210
name : Linux Binary (AMD)
130
211
path : func_linux_amd64
131
- - uses : actions/upload-artifact@v2
212
+ - uses : actions/upload-artifact@v4
132
213
with :
133
214
name : Linux Binary (ARM)
134
215
path : func_linux_arm64
135
- - uses : actions/upload-artifact@v2
216
+ - uses : actions/upload-artifact@v4
136
217
with :
137
218
name : Linux Binary (PPC64LE)
138
219
path : func_linux_ppc64le
139
- - uses : actions/upload-artifact@v2
220
+ - uses : actions/upload-artifact@v4
140
221
with :
141
222
name : Linux Binary (S390X)
142
223
path : func_linux_s390x
143
- - uses : actions/upload-artifact@v2
224
+ - uses : actions/upload-artifact@v4
144
225
with :
145
226
name : Windows Binary
146
227
path : func_windows_amd64.exe
147
228
229
+ publish-utils-image :
230
+ needs : build
231
+ runs-on : ubuntu-latest
232
+ steps :
233
+ - uses : actions/checkout@v4
234
+ - uses : knative/actions/setup-go@main
235
+ - uses : docker/setup-qemu-action@v3
236
+ - name : Login to GitHub Container Registry
237
+ uses : docker/login-action@v3
238
+ with :
239
+ registry : ghcr.io
240
+ username : ${{ github.actor }}
241
+ password : ${{ secrets.GITHUB_TOKEN }}
242
+ - name : Build and push
243
+ run : |
244
+ for a in amd64 arm64 ppc64le s390x; do
245
+ CGO_ENABLED=0 go build -o "func-util-$a" -trimpath -ldflags '-w -s' ./cmd/func-util
246
+ done
247
+ docker buildx create --name multiarch --driver docker-container --use
248
+ docker buildx build . -f Dockerfile.utils \
249
+ --platform=linux/ppc64le,linux/s390x,linux/amd64,linux/arm64 \
250
+ --push \
251
+ -t "ghcr.io/knative/func-utils:v2" \
252
+ --annotation index:org.opencontainers.image.description="Knative Func Utils Image" \
253
+ --annotation index:org.opencontainers.image.source="https://github.com/knative/func" \
254
+ --annotation index:org.opencontainers.image.vendor="https://github.com/knative/func" \
255
+ --annotation index:org.opencontainers.image.url="https://github.com/knative/func/pkgs/container/func-utils"
256
+
148
257
publish-image :
149
258
needs : build
150
259
runs-on : ubuntu-latest
151
260
steps :
152
- - uses : actions/checkout@v3
153
- - uses : ./.github/composite/go- setup
261
+ - uses : actions/checkout@v4
262
+ - uses : knative/actions/ setup-go@main
154
263
-
uses :
imjasonh/[email protected]
155
264
- run : ko build --platform=linux/ppc64le,linux/s390x,linux/amd64,linux/arm64 -B ./cmd/func
0 commit comments