149 lines
5.4 KiB
YAML
149 lines
5.4 KiB
YAML
name: ISO
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "deploy/iso/**"
|
|
env:
|
|
GOPROXY: https://proxy.golang.org
|
|
jobs:
|
|
build_test_iso:
|
|
runs-on: [self-hosted, debian9, gcp]
|
|
steps:
|
|
- name: Clean up workspace
|
|
shell: bash
|
|
run: |
|
|
pwd
|
|
ls -lah
|
|
rm -rf out
|
|
ls -lah
|
|
df -h
|
|
- 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: Install KVM
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
|
|
- name: Install ISO build tools
|
|
run: |
|
|
sudo apt-get update \
|
|
&& sudo apt-get install -y apt dpkg apt-utils ca-certificates \
|
|
&& sudo apt-get upgrade -y \
|
|
&& sudo apt-get install -y \
|
|
build-essential \
|
|
git \
|
|
wget \
|
|
cpio \
|
|
python \
|
|
unzip \
|
|
bc \
|
|
gcc-multilib \
|
|
automake \
|
|
libtool \
|
|
gnupg2 \
|
|
p7zip-full \
|
|
locales \
|
|
rsync \
|
|
dumb-init \
|
|
libpcre3-dev
|
|
sudo localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
|
- name: Build Binaries
|
|
run: |
|
|
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)
|
|
# iso needs golang 1.11.3
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.11.13'
|
|
stable: true
|
|
- name: Build ISO
|
|
run: |
|
|
whoami
|
|
make minikube_iso &> ./out/iso.log
|
|
make checksum
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.14.6'
|
|
stable: true
|
|
- 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
|
|
- 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: |
|
|
cd out
|
|
ls -lah
|
|
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=kvm2 --iso-url=file://$(pwd)/minikube.iso" -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=$(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')
|
|
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: iso_functional_test_kvm2_ubuntu
|
|
path: out/report
|
|
- uses: actions/upload-artifact@v1
|
|
with:
|
|
name: iso log
|
|
path: out/iso.log
|
|
- name: The End Result iso_functional_test_kvm2_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" -lt 32 ];then echo "*** Failed to pass at least 32 ! ***";exit 2;fi
|
|
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi |