name: KIC_IMAGE on: pull_request: paths: - "deploy/kicbase/**" env: GOPROXY: https://proxy.golang.org jobs: build_test_kic_image: runs-on: [self-hosted, debian9, gcp] steps: - name: Clean up shell: bash run: | pwd ls -lah rm -rf out ls -lah df -h sudo rm -f /etc/cron.hourly/cleanup_and_reboot || true - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: go-version: '1.14.6' stable: true - name: Download Dependencies run: go mod download - name: Build Binaries run: | sudo apt-get update sudo apt-get install -y make build-essential make linux make e2e-linux-amd64 cp -r test/integration/testdata ./out whoami echo github ref $GITHUB_REF echo workflow $GITHUB_WORKFLOW echo home $HOME echo event name $GITHUB_EVENT_NAME echo workspace $GITHUB_WORKSPACE echo "end of debug stuff" echo $(which jq) - name: Build Image run: | docker images make kic-base-image docker images - name: Info shell: bash run: | hostname uname -r lsb_release -a - name: Install kubectl shell: bash run: | curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl sudo install kubectl /usr/local/bin/kubectl kubectl version --client=true - name: Install gopogh shell: bash run: | curl -LO https://github.com/medyagh/gopogh/releases/download/v0.2.4/gopogh-linux-amd64 sudo install gopogh-linux-amd64 /usr/local/bin/gopogh sudo apt-get install -y jq rm -f gopogh-linux-amd64 || true - name: Run Integration Test continue-on-error: false # bash {0} to allow test to continue to next step. in case of shell: bash {0} run: | KIC_VERSION=$(egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2) KIC_IMG_HEAD="local/kicbase:${KIC_VERSION}-snapshot" cd out mkdir -p report mkdir -p testhome chmod a+x e2e-* chmod a+x minikube-* START_TIME=$(date -u +%s) KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args="--vm-driver=docker --base-image=${KIC_IMG_HEAD}" -test.v -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt END_TIME=$(date -u +%s) 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 shell: bash run: | cd out export PATH=${PATH}:`go env GOPATH`/bin go tool test2json -t < ./report/testout.txt > ./report/testout.json || true STAT=$(/usr/local/bin/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' || true) TestsNum=$(echo $STAT | jq '.NumberOfTests' || true) 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} - uses: actions/upload-artifact@v1 with: name: kic_image_functional_test_docker_ubuntu path: out/report - name: The End Result build_test_kic_image_docker_ubuntu shell: bash run: | echo ${GOPOGH_RESULT} numFail=$(echo $STAT | jq '.NumberOfFail') numPass=$(echo $STAT | jq '.NumberOfPass') echo "*******************${numPass} Passes :) *******************" echo $STAT | jq '.PassedTests' || true echo "*******************************************************" echo "---------------- ${numFail} Failures :( ----------------------------" echo $STAT | jq '.FailedTests' || true echo "-------------------------------------------------------" numPass=$(echo $STAT | jq '.NumberOfPass') if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi