Skip to content

Commit 56b9a6e

Browse files
authored
Speed up CI Build (agones-dev#996)
* Speed up CI Build - Run more things in parallel. - Cache C++ build output, as that is the longer path. - Remove clean from run-sdk-conformance-test to remove race condition. - Allowing more e2e tests to run in parrallel
1 parent 3976519 commit 56b9a6e

5 files changed

Lines changed: 72 additions & 12 deletions

File tree

‎build/e2e-image/e2e.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ set -e
1717
echo "installing current release"
1818
DOCKER_RUN= make install
1919
echo "starting e2e test"
20-
DOCKER_RUN= make test-e2e ARGS=-parallel=32
20+
DOCKER_RUN= make test-e2e ARGS=-parallel=64
2121
echo "completed e2e test"

‎build/includes/sdk.mk‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ run-sdk-conformance-no-build: ensure-build-sdk-image
137137
run-sdk-conformance-test:
138138
$(MAKE) run-sdk-command COMMAND=build-sdk-test
139139
$(MAKE) run-sdk-conformance-no-build
140-
$(MAKE) run-sdk-command COMMAND=clean
141140

142141
# Run a conformance test for all SDKs supported
143142
run-sdk-conformance-tests:

‎cloudbuild.yaml‎

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ steps:
2929
- '--key=$_HTMLTEST_CACHE_KEY'
3030
waitFor: ['-']
3131

32+
- name: gcr.io/$PROJECT_ID/restore_cache
33+
id: cpp-sdk-build-restore-cache
34+
args:
35+
- '--bucket=gs://$_CACHE_BUCKET'
36+
- '--key=$_CPP_SDK_BUILD_CACHE_KEY'
37+
waitFor: ['-']
38+
3239
#
3340
# Creates the initial make + docker build platform
3441
#
@@ -119,18 +126,43 @@ steps:
119126
#
120127

121128
- name: "make-docker"
122-
id: build
129+
id: build-images
123130
waitFor:
124131
- lint
125-
- ensure-build-sdk-image-base
126132
dir: "build"
127-
args: [ "-j", "4", "build"]
133+
args: [ "-j", "4", "build-images"]
128134
- name: "make-docker"
129135
id: push-images
130136
waitFor:
131-
- build
137+
- build-images
138+
dir: "build"
139+
args: [ "-j", "4", "push"]
140+
141+
#
142+
# Build all the SDKs
143+
#
144+
145+
- name: "make-docker"
146+
id: build-sdks
147+
waitFor:
148+
- lint
149+
- cpp-sdk-build-restore-cache
150+
- ensure-build-sdk-image-base
132151
dir: "build"
133-
args: [ "-j", "3", "push"]
152+
args: [ "-j", "4", "--output-sync=target", "build-sdks"]
153+
154+
#
155+
# Cache the cpp sdk build directory, to speed up subsequent builds (considerably)
156+
#
157+
158+
- name: 'gcr.io/$PROJECT_ID/save_cache'
159+
args:
160+
- '--bucket=gs://$_CACHE_BUCKET'
161+
- '--key=$_CPP_SDK_BUILD_CACHE_KEY'
162+
- '--path=sdks/cpp/.build'
163+
id: cpp-sdk-build-save-cache
164+
waitFor:
165+
- build-sdks
134166

135167
#
136168
# Run the all the automated tests (except e2e) in parallel
@@ -142,7 +174,6 @@ steps:
142174
- lint
143175
- ensure-build-sdk-image-base
144176
- htmltest-restore-cache
145-
- build
146177
dir: "build"
147178
args: [ "-j", "5", "--output-sync=target", "test" ]
148179

@@ -202,29 +233,29 @@ steps:
202233
dir: "build"
203234
args: [ "run-sdk-conformance-tests"]
204235
waitFor:
205-
- build
206-
- tests
236+
- build-images
207237

208238
#
209239
# Zip up artifacts and push to storage
210240
#
211241

212242
- name: 'gcr.io/cloud-builders/gsutil'
213243
waitFor:
214-
- build
244+
- build-sdks
215245
- tests
216246
dir: "sdks/cpp/.build"
217247
args: ['cp', '*.tar.gz', 'gs://agones-artifacts/cpp-sdk']
218248
- name: 'gcr.io/cloud-builders/gsutil'
219249
waitFor:
220-
- build
250+
- build-images
221251
- tests
222252
dir: "cmd/sdk-server/bin"
223253
args: ['cp', '*.zip', 'gs://agones-artifacts/sdk-server']
224254

225255
substitutions:
226256
_CACHE_BUCKET: agones-build-cache
227257
_HTMLTEST_CACHE_KEY: htmltest-0.10.1
258+
_CPP_SDK_BUILD_CACHE_KEY: cpp-sdk-build
228259

229260
tags: ['ci']
230261
timeout: "1h"

‎test/e2e/fleet_test.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ func TestFleetScaleUpEditAndScaleDown(t *testing.T) {
5656
fixtures := []bool{true, false}
5757

5858
for _, usePatch := range fixtures {
59+
usePatch := usePatch
5960
t.Run("Use fleet Patch "+fmt.Sprint(usePatch), func(t *testing.T) {
61+
t.Parallel()
62+
6063
client := framework.AgonesClient.AgonesV1()
6164

6265
flt := defaultFleet()
@@ -150,7 +153,11 @@ func TestFleetRollingUpdate(t *testing.T) {
150153

151154
for _, usePatch := range fixtures {
152155
for _, maxSurgeParam := range maxSurge {
156+
usePatch := usePatch
157+
maxSurgeParam := maxSurgeParam
153158
t.Run(fmt.Sprintf("Use fleet Patch %t %s", usePatch, maxSurgeParam), func(t *testing.T) {
159+
t.Parallel()
160+
154161
client := framework.AgonesClient.AgonesV1()
155162

156163
flt := defaultFleet()
@@ -255,7 +262,10 @@ func TestScaleFleetUpAndDownWithGameServerAllocation(t *testing.T) {
255262
fixtures := []bool{false, true}
256263

257264
for _, usePatch := range fixtures {
265+
usePatch := usePatch
258266
t.Run("Use fleet Patch "+fmt.Sprint(usePatch), func(t *testing.T) {
267+
t.Parallel()
268+
259269
client := framework.AgonesClient.AgonesV1()
260270

261271
flt := defaultFleet()
@@ -333,7 +343,10 @@ func TestFleetUpdates(t *testing.T) {
333343
}
334344

335345
for k, v := range fixtures {
346+
k := k
347+
v := v
336348
t.Run(k, func(t *testing.T) {
349+
t.Parallel()
337350
client := framework.AgonesClient.AgonesV1()
338351

339352
flt := v()
@@ -430,6 +443,8 @@ func TestUpdateGameServerConfigurationInFleet(t *testing.T) {
430443
}
431444

432445
func TestReservedGameServerInFleet(t *testing.T) {
446+
t.Parallel()
447+
433448
client := framework.AgonesClient.AgonesV1()
434449

435450
flt := defaultFleet()
@@ -703,6 +718,8 @@ func TestGameServerAllocationDuringGameServerDeletion(t *testing.T) {
703718
// test scale subresource usage and its ability to change Fleet Replica size.
704719
// Both scaling up and down.
705720
func TestCreateFleetAndUpdateScaleSubresource(t *testing.T) {
721+
t.Parallel()
722+
706723
client := framework.AgonesClient.AgonesV1()
707724

708725
flt := defaultFleet()
@@ -898,7 +915,10 @@ func TestFleetRecreateGameServers(t *testing.T) {
898915
}
899916

900917
for k, v := range tests {
918+
k := k
919+
v := v
901920
t.Run(k, func(t *testing.T) {
921+
t.Parallel()
902922
client := framework.AgonesClient.AgonesV1()
903923
flt := defaultFleet()
904924
// add more game servers, to hunt for race conditions

‎test/e2e/gameserverallocation_test.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ func TestCreateFleetAndGameServerAllocate(t *testing.T) {
3737
fixtures := []apis.SchedulingStrategy{apis.Packed, apis.Distributed}
3838

3939
for _, strategy := range fixtures {
40+
strategy := strategy
4041
t.Run(string(strategy), func(t *testing.T) {
42+
t.Parallel()
43+
4144
fleets := framework.AgonesClient.AgonesV1().Fleets(defaultNs)
4245
fleet := defaultFleet()
4346
fleet.Spec.Scheduling = strategy
@@ -68,7 +71,10 @@ func TestMultiClusterAllocationOnLocalCluster(t *testing.T) {
6871
fixtures := []apis.SchedulingStrategy{apis.Packed, apis.Distributed}
6972

7073
for _, strategy := range fixtures {
74+
strategy := strategy
7175
t.Run(string(strategy), func(t *testing.T) {
76+
t.Parallel()
77+
7278
fleets := framework.AgonesClient.AgonesV1().Fleets(defaultNs)
7379
fleet := defaultFleet()
7480
fleet.Spec.Scheduling = strategy
@@ -177,7 +183,11 @@ func TestCreateFullFleetAndCantGameServerAllocate(t *testing.T) {
177183
fixtures := []apis.SchedulingStrategy{apis.Packed, apis.Distributed}
178184

179185
for _, strategy := range fixtures {
186+
strategy := strategy
187+
180188
t.Run(string(strategy), func(t *testing.T) {
189+
t.Parallel()
190+
181191
fleets := framework.AgonesClient.AgonesV1().Fleets(defaultNs)
182192
fleet := defaultFleet()
183193
fleet.Spec.Scheduling = strategy

0 commit comments

Comments
 (0)