Skip to content

Commit 4c599a4

Browse files
authored
Merge pull request #6894 from nkprince007/unit-test-deps
github actions: Download deps before unit tests
2 parents 50a4461 + de4cb21 commit 4c599a4

File tree

1 file changed

+49
-41
lines changed

1 file changed

+49
-41
lines changed

.github/workflows/main.yml

+49-41
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: CI
22
on: [pull_request]
3+
env:
4+
GOPROXY: https://proxy.golang.org
35
jobs:
46
# Runs before all other jobs
5-
# builds the minikube binaries
7+
# builds the minikube binaries
68
build_minikube:
79
env:
810
TIME_ELAPSED: time
@@ -11,7 +13,9 @@ jobs:
1113
runs-on: ubuntu-18.04
1214
steps:
1315
- uses: actions/checkout@v2
14-
- name: build binaries
16+
- name: Download Dependencies
17+
run : go mod download
18+
- name: Build Binaries
1519
run : |
1620
make minikube-linux-amd64
1721
make e2e-linux-amd64
@@ -36,11 +40,13 @@ jobs:
3640
runs-on: ubuntu-18.04
3741
steps:
3842
- uses: actions/checkout@v2
39-
- name: install libvirt
40-
run : |
43+
- name: Install libvirt
44+
run : |
4145
sudo apt-get update
4246
sudo apt-get install -y libvirt-dev
43-
- name: lint
47+
- name: Download Dependencies
48+
run : go mod download
49+
- name: Lint
4450
env:
4551
TESTSUITE: lintall
4652
run : make test
@@ -53,11 +59,13 @@ jobs:
5359
runs-on: ubuntu-18.04
5460
steps:
5561
- uses: actions/checkout@v2
56-
- name: install libvirt
57-
run : |
62+
- name: Install libvirt
63+
run : |
5864
sudo apt-get update
5965
sudo apt-get install -y libvirt-dev
60-
- name: unit test
66+
- name: Download Dependencies
67+
run : go mod download
68+
- name: Unit Test
6169
env:
6270
TESTSUITE: unittest
6371
run :
@@ -85,11 +93,11 @@ jobs:
8593
run: |
8694
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
8795
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
88-
- name: Download binaries
96+
- name: Download Binaries
8997
uses: actions/download-artifact@v1
9098
with:
9199
name: minikube_binaries
92-
- name: Run integration test
100+
- name: Run Integration Test
93101
continue-on-error: true
94102
# bash {0} to allow test to continue to next step. in case of
95103
shell: bash {0}
@@ -107,7 +115,7 @@ jobs:
107115
sec=$((${TIME_ELAPSED}%60))
108116
TIME_ELAPSED="${min} min $sec seconds "
109117
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
110-
- name: Generate html report
118+
- name: Generate HTML Report
111119
shell: bash
112120
run: |
113121
cd minikube_binaries
@@ -153,11 +161,11 @@ jobs:
153161
run: |
154162
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
155163
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
156-
- name: Download binaries
164+
- name: Download Binaries
157165
uses: actions/download-artifact@v1
158166
with:
159167
name: minikube_binaries
160-
- name: Run integration test
168+
- name: Run Integration Test
161169
continue-on-error: true
162170
# bash {0} to allow test to continue to next step. in case of
163171
shell: bash {0}
@@ -170,12 +178,12 @@ jobs:
170178
START_TIME=$(date -u +%s)
171179
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--driver=docker -test.timeout=70m -test.v -timeout-multiplier=3 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
172180
END_TIME=$(date -u +%s)
173-
TIME_ELAPSED=$(($END_TIME-$START_TIME))
181+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
174182
min=$((${TIME_ELAPSED}/60))
175183
sec=$((${TIME_ELAPSED}%60))
176184
TIME_ELAPSED="${min} min $sec seconds "
177185
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
178-
- name: Generate html report
186+
- name: Generate HTML Report
179187
shell: bash
180188
run: |
181189
cd minikube_binaries
@@ -184,7 +192,7 @@ jobs:
184192
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
185193
echo status: ${STAT}
186194
FailNum=$(echo $STAT | jq '.NumberOfFail')
187-
TestsNum=$(echo $STAT | jq '.NumberOfTests')
195+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
188196
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
189197
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
190198
echo ::set-env name=STAT::${STAT}
@@ -215,11 +223,11 @@ jobs:
215223
run: |
216224
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
217225
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
218-
- name: Download binaries
226+
- name: Download Binaries
219227
uses: actions/download-artifact@v1
220228
with:
221229
name: minikube_binaries
222-
- name: Run integration test
230+
- name: Run Integration Test
223231
continue-on-error: true
224232
# bash {0} to allow test to continue to next step. in case of
225233
shell: bash {0}
@@ -232,12 +240,12 @@ jobs:
232240
START_TIME=$(date -u +%s)
233241
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome sudo -E ./e2e-linux-amd64 -minikube-start-args=--driver=none -test.timeout=70m -test.v -timeout-multiplier=3 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
234242
END_TIME=$(date -u +%s)
235-
TIME_ELAPSED=$(($END_TIME-$START_TIME))
243+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
236244
min=$((${TIME_ELAPSED}/60))
237245
sec=$((${TIME_ELAPSED}%60))
238246
TIME_ELAPSED="${min} min $sec seconds "
239247
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
240-
- name: Generate html report
248+
- name: Generate HTML Report
241249
shell: bash
242250
run: |
243251
cd minikube_binaries
@@ -246,7 +254,7 @@ jobs:
246254
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
247255
echo status: ${STAT}
248256
FailNum=$(echo $STAT | jq '.NumberOfFail')
249-
TestsNum=$(echo $STAT | jq '.NumberOfTests')
257+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
250258
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
251259
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
252260
echo ::set-env name=STAT::${STAT}
@@ -276,12 +284,12 @@ jobs:
276284
shell: bash
277285
run: |
278286
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
279-
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
280-
- name: Download binaries
287+
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
288+
- name: Download Binaries
281289
uses: actions/download-artifact@v1
282290
with:
283291
name: minikube_binaries
284-
- name: Run integration test
292+
- name: Run Integration Test
285293
continue-on-error: true
286294
# bash {0} to allow test to continue to next step. in case of
287295
shell: bash {0}
@@ -294,12 +302,12 @@ jobs:
294302
START_TIME=$(date -u +%s)
295303
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome sudo -E ./e2e-linux-amd64 -minikube-start-args=--driver=none -test.timeout=70m -test.v -timeout-multiplier=3 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
296304
END_TIME=$(date -u +%s)
297-
TIME_ELAPSED=$(($END_TIME-$START_TIME))
305+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
298306
min=$((${TIME_ELAPSED}/60))
299307
sec=$((${TIME_ELAPSED}%60))
300308
TIME_ELAPSED="${min} min $sec seconds "
301309
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
302-
- name: Generate html report
310+
- name: Generate HTML Report
303311
shell: bash
304312
run: |
305313
cd minikube_binaries
@@ -308,7 +316,7 @@ jobs:
308316
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
309317
echo status: ${STAT}
310318
FailNum=$(echo $STAT | jq '.NumberOfFail')
311-
TestsNum=$(echo $STAT | jq '.NumberOfTests')
319+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
312320
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
313321
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
314322
echo ::set-env name=STAT::${STAT}
@@ -343,8 +351,8 @@ jobs:
343351
sudo apt-key add - < Release.key || true
344352
sudo apt-get update -qq
345353
sudo apt-get -qq -y install podman
346-
sudo podman version || true
347-
sudo podman info || true
354+
sudo podman version || true
355+
sudo podman info || true
348356
- name: Install gopogh
349357
shell: bash
350358
run: |
@@ -354,7 +362,7 @@ jobs:
354362
uses: actions/download-artifact@v1
355363
with:
356364
name: minikube_binaries
357-
- name: Run integration test
365+
- name: Run Integration Test
358366
continue-on-error: true
359367
# bash {0} to allow test to continue to next step. in case of
360368
shell: bash {0}
@@ -367,12 +375,12 @@ jobs:
367375
START_TIME=$(date -u +%s)
368376
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome sudo -E ./e2e-linux-amd64 -minikube-start-args=--driver=podman -test.timeout=70m -test.v -timeout-multiplier=3 -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
369377
END_TIME=$(date -u +%s)
370-
TIME_ELAPSED=$(($END_TIME-$START_TIME))
378+
TIME_ELAPSED=$(($END_TIME-$START_TIME))
371379
min=$((${TIME_ELAPSED}/60))
372380
sec=$((${TIME_ELAPSED}%60))
373381
TIME_ELAPSED="${min} min $sec seconds "
374382
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
375-
- name: Generate html report
383+
- name: Generate HTML Report
376384
shell: bash
377385
run: |
378386
cd minikube_binaries
@@ -381,7 +389,7 @@ jobs:
381389
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
382390
echo status: ${STAT}
383391
FailNum=$(echo $STAT | jq '.NumberOfFail')
384-
TestsNum=$(echo $STAT | jq '.NumberOfTests')
392+
TestsNum=$(echo $STAT | jq '.NumberOfTests')
385393
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
386394
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
387395
echo ::set-env name=STAT::${STAT}
@@ -398,14 +406,14 @@ jobs:
398406
echo $STAT | jq '.FailedTests' || true
399407
echo "-------------------------------------------------------"
400408
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
401-
# After all 4 integration tests finished
409+
# After all 4 integration tests finished
402410
# collect all the reports and upload
403411
upload_all_reports:
404412
if: always()
405413
needs: [docker_ubuntu_16_04,docker_ubuntu_18_04,none_ubuntu16_04,none_ubuntu18_04,podman_ubuntu_18_04]
406414
runs-on: ubuntu-18.04
407415
steps:
408-
- name: download results docker_ubuntu_16_04
416+
- name: Download Results docker_ubuntu_16_04
409417
uses: actions/download-artifact@v1
410418
with:
411419
name: docker_ubuntu_16_04
@@ -415,7 +423,7 @@ jobs:
415423
run: |
416424
mkdir -p all_reports
417425
cp -r docker_ubuntu_16_04 ./all_reports/
418-
- name: download results docker_ubuntu_18_04
426+
- name: Download Results docker_ubuntu_18_04
419427
uses: actions/download-artifact@v1
420428
with:
421429
name: docker_ubuntu_18_04
@@ -425,7 +433,7 @@ jobs:
425433
run: |
426434
mkdir -p all_reports
427435
cp -r docker_ubuntu_18_04 ./all_reports/
428-
- name: download results none_ubuntu16_04
436+
- name: Download Results none_ubuntu16_04
429437
uses: actions/download-artifact@v1
430438
with:
431439
name: none_ubuntu16_04
@@ -435,21 +443,21 @@ jobs:
435443
run: |
436444
mkdir -p all_reports
437445
cp -r none_ubuntu16_04 ./all_reports/
438-
- name: download results none_ubuntu18_04
446+
- name: Download Results none_ubuntu18_04
439447
uses: actions/download-artifact@v1
440448
with:
441449
name: none_ubuntu18_04
442-
- name: cp none_ubuntu18_04 to all_report
450+
- name: Copy none_ubuntu18_04 to all_report
443451
continue-on-error: true
444452
shell: bash {0}
445453
run: |
446454
mkdir -p all_reports
447455
cp -r none_ubuntu18_04 ./all_reports/
448-
- name: download results podman_ubuntu_18_04
456+
- name: Download Results podman_ubuntu_18_04
449457
uses: actions/download-artifact@v1
450458
with:
451459
name: podman_ubuntu_18_04
452-
- name: cp podman_ubuntu_18_04 to all_report
460+
- name: Copy podman_ubuntu_18_04 to all_report
453461
continue-on-error: true
454462
shell: bash {0}
455463
run: |

0 commit comments

Comments
 (0)