Merge pull request #6894 from nkprince007/unit-test-deps

github actions: Download deps before unit tests
pull/6900/head
Medya Ghazizadeh 2020-03-05 11:12:09 -08:00 committed by GitHub
commit 4c599a4c75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 49 additions and 41 deletions

View File

@ -1,8 +1,10 @@
name: CI
on: [pull_request]
env:
GOPROXY: https://proxy.golang.org
jobs:
# Runs before all other jobs
# builds the minikube binaries
# builds the minikube binaries
build_minikube:
env:
TIME_ELAPSED: time
@ -11,7 +13,9 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: build binaries
- name: Download Dependencies
run : go mod download
- name: Build Binaries
run : |
make minikube-linux-amd64
make e2e-linux-amd64
@ -36,11 +40,13 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: install libvirt
run : |
- name: Install libvirt
run : |
sudo apt-get update
sudo apt-get install -y libvirt-dev
- name: lint
- name: Download Dependencies
run : go mod download
- name: Lint
env:
TESTSUITE: lintall
run : make test
@ -53,11 +59,13 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: install libvirt
run : |
- name: Install libvirt
run : |
sudo apt-get update
sudo apt-get install -y libvirt-dev
- name: unit test
- name: Download Dependencies
run : go mod download
- name: Unit Test
env:
TESTSUITE: unittest
run :
@ -85,11 +93,11 @@ jobs:
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download binaries
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run integration test
- name: Run Integration Test
continue-on-error: true
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
@ -107,7 +115,7 @@ jobs:
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: Generate html report
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
@ -153,11 +161,11 @@ jobs:
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download binaries
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run integration test
- name: Run Integration Test
continue-on-error: true
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
@ -170,12 +178,12 @@ jobs:
START_TIME=$(date -u +%s)
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
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: Generate html report
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
@ -184,7 +192,7 @@ jobs:
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
echo ::set-env name=STAT::${STAT}
@ -215,11 +223,11 @@ jobs:
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download binaries
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run integration test
- name: Run Integration Test
continue-on-error: true
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
@ -232,12 +240,12 @@ jobs:
START_TIME=$(date -u +%s)
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
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: Generate html report
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
@ -246,7 +254,7 @@ jobs:
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
echo ::set-env name=STAT::${STAT}
@ -276,12 +284,12 @@ jobs:
shell: bash
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.1.16/gopogh-linux-amd64
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download binaries
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
- name: Download Binaries
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run integration test
- name: Run Integration Test
continue-on-error: true
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
@ -294,12 +302,12 @@ jobs:
START_TIME=$(date -u +%s)
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
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: Generate html report
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
@ -308,7 +316,7 @@ jobs:
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
echo ::set-env name=STAT::${STAT}
@ -343,8 +351,8 @@ jobs:
sudo apt-key add - < Release.key || true
sudo apt-get update -qq
sudo apt-get -qq -y install podman
sudo podman version || true
sudo podman info || true
sudo podman version || true
sudo podman info || true
- name: Install gopogh
shell: bash
run: |
@ -354,7 +362,7 @@ jobs:
uses: actions/download-artifact@v1
with:
name: minikube_binaries
- name: Run integration test
- name: Run Integration Test
continue-on-error: true
# bash {0} to allow test to continue to next step. in case of
shell: bash {0}
@ -367,12 +375,12 @@ jobs:
START_TIME=$(date -u +%s)
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
END_TIME=$(date -u +%s)
TIME_ELAPSED=$(($END_TIME-$START_TIME))
TIME_ELAPSED=$(($END_TIME-$START_TIME))
min=$((${TIME_ELAPSED}/60))
sec=$((${TIME_ELAPSED}%60))
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: Generate html report
- name: Generate HTML Report
shell: bash
run: |
cd minikube_binaries
@ -381,7 +389,7 @@ jobs:
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
FailNum=$(echo $STAT | jq '.NumberOfFail')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
TestsNum=$(echo $STAT | jq '.NumberOfTests')
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
echo ::set-env name=STAT::${STAT}
@ -398,14 +406,14 @@ jobs:
echo $STAT | jq '.FailedTests' || true
echo "-------------------------------------------------------"
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
# After all 4 integration tests finished
# After all 4 integration tests finished
# collect all the reports and upload
upload_all_reports:
if: always()
needs: [docker_ubuntu_16_04,docker_ubuntu_18_04,none_ubuntu16_04,none_ubuntu18_04,podman_ubuntu_18_04]
runs-on: ubuntu-18.04
steps:
- name: download results docker_ubuntu_16_04
- name: Download Results docker_ubuntu_16_04
uses: actions/download-artifact@v1
with:
name: docker_ubuntu_16_04
@ -415,7 +423,7 @@ jobs:
run: |
mkdir -p all_reports
cp -r docker_ubuntu_16_04 ./all_reports/
- name: download results docker_ubuntu_18_04
- name: Download Results docker_ubuntu_18_04
uses: actions/download-artifact@v1
with:
name: docker_ubuntu_18_04
@ -425,7 +433,7 @@ jobs:
run: |
mkdir -p all_reports
cp -r docker_ubuntu_18_04 ./all_reports/
- name: download results none_ubuntu16_04
- name: Download Results none_ubuntu16_04
uses: actions/download-artifact@v1
with:
name: none_ubuntu16_04
@ -435,21 +443,21 @@ jobs:
run: |
mkdir -p all_reports
cp -r none_ubuntu16_04 ./all_reports/
- name: download results none_ubuntu18_04
- name: Download Results none_ubuntu18_04
uses: actions/download-artifact@v1
with:
name: none_ubuntu18_04
- name: cp none_ubuntu18_04 to all_report
- name: Copy none_ubuntu18_04 to all_report
continue-on-error: true
shell: bash {0}
run: |
mkdir -p all_reports
cp -r none_ubuntu18_04 ./all_reports/
- name: download results podman_ubuntu_18_04
- name: Download Results podman_ubuntu_18_04
uses: actions/download-artifact@v1
with:
name: podman_ubuntu_18_04
- name: cp podman_ubuntu_18_04 to all_report
- name: Copy podman_ubuntu_18_04 to all_report
continue-on-error: true
shell: bash {0}
run: |