未验证 提交 4c599a4c 编写于 作者: M Medya Ghazizadeh 提交者: GitHub

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

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