improve github actions

pull/6636/head
Medya Gh 2020-02-14 01:45:07 -08:00
parent f74c956701
commit 716036074e
1 changed files with 190 additions and 72 deletions

View File

@ -1,24 +1,24 @@
name: CI
on: [pull_request]
jobs:
docker_ubuntu_16_04:
# Runs before all other jobs
# builds the minikube binaries
build_minikube:
env:
TIME_ELAPSED: time
JOB_NAME: "Docker_Ubuntu_16_04"
COMMIT_STATUS: ""
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: build binaries
run : |
make minikube-linux-amd64
make e2e-linux-amd64
mkdir -p report
mkdir -p testhome
pwd
ls -lah
cp -r test/integration/testdata ./
ls -lah
cp -r test/integration/testdata ./out
ls -lah ./out
whoami
echo github ref $GITHUB_REF
echo workflow $GITHUB_WORKFLOW
@ -26,16 +26,56 @@ jobs:
echo event name $GITHUB_EVENT_NAME
echo workspace $GITHUB_WORKSPACE
echo "end of debug stuff"
- uses: actions/upload-artifact@v1
with:
name: minikube_binaries
path: out
unit_test:
env:
TIME_ELAPSED: time
JOB_NAME: "unit_test"
COMMIT_STATUS: ""
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: install libvirt
run : |
sudo apt-get update
sudo apt-get install -y libvirt-dev
- name: unit test
run : make test
continue-on-error: false
# Run the following integration tests after the build_minikube
# They will run in parallel and use the binaries in previous step
docker_ubuntu_16_04:
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "Docker_Ubuntu_16_04"
COMMIT_STATUS: ""
runs-on: ubuntu-16.04
steps:
- name: install gopogh
run: |
cd /tmp
GO111MODULE="on" go get github.com/medyagh/gopogh@v0.0.17 || true
cd -
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.0.18/gopogh-linux-amd64
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
continue-on-error: true
shell: bash
run: |
cd minikube_binaries
mkdir -p report
mkdir -p testhome
ls -lah
chmod a+x e2e-*
chmod a+x minikube-*
ls -lah
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -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))
@ -44,6 +84,8 @@ jobs:
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: generate gopogh report
run: |
pwd
cd minikube_binaries
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 " $GITHUB_REF" -repo "${JOB_NAME} ${GITHUB_REF} ${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
@ -59,41 +101,44 @@ jobs:
name: docker_ubuntu_16_04
path: report
docker_ubuntu_18_04:
runs-on: ubuntu-18.04
env:
TIME_ELAPSED: time
JOB_NAME: "Docker_Ubuntu_18_04"
COMMIT_STATUS: ""
runs-on: ubuntu-18.04
needs: [build_minikube]
steps:
- uses: actions/checkout@v2
- name: build binaries
run : |
make minikube-linux-amd64
make e2e-linux-amd64
mkdir -p report
mkdir -p testhome
pwd
ls -lah
cp -r test/integration/testdata ./
ls -lah
whoami
- name: install gopogh
run: |
cd /tmp
GO111MODULE="on" go get github.com/medyagh/gopogh@v0.0.17 || true
cd -
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.0.18/gopogh-linux-amd64
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
continue-on-error: true
shell: bash
run: |
pwd
cd minikube_binaries
mkdir -p report
mkdir -p testhome
ls -lah
chmod a+x e2e-*
chmod a+x minikube-*
ls -lah
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -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"
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: generate gopogh report
run: |
cd minikube_binaries
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 " $GITHUB_REF" -repo "${JOB_NAME} ${GITHUB_REF} ${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
@ -109,41 +154,97 @@ jobs:
name: docker_ubuntu_18_04
path: report
none_ubuntu16_04:
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "None_Ubuntu_16_04"
COMMIT_STATUS: ""
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- name: build binaries
run : |
make minikube-linux-amd64
make e2e-linux-amd64
mkdir -p report
mkdir -p testhome
pwd
ls -lah
cp -r test/integration/testdata ./
ls -lah
whoami
- name: install gopogh
run: |
cd /tmp
GO111MODULE="on" go get github.com/medyagh/gopogh@v0.0.17 || true
cd -
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.0.18/gopogh-linux-amd64
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
continue-on-error: true
shell: bash
run: |
pwd
cd minikube_binaries
mkdir -p report
mkdir -p testhome
ls -lah
chmod a+x e2e-*
chmod a+x minikube-*
ls -lah
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome sudo -E ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=none -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -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"
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: generate gopogh report
run: |
cd minikube_binaries
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 " $GITHUB_REF" -repo "${JOB_NAME} ${GITHUB_REF} ${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
echo status: ${STAT}
COMMIT_STATUS="${JOB_NAME} : Completed with ${STAT} in ${TIME_ELAPSED}"
echo ::set-env name=COMMIT_STATUS::${COMMIT_STATUS}
- name: The End Result
run: |
echo time elapsed is ${TIME_ELAPSED}
echo END RESULT IS ${COMMIT_STATUS}
- uses: actions/upload-artifact@v1
with:
name: none_ubuntu16_04
path: report
none_ubuntu18_04:
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "None_Ubuntu_18_04"
COMMIT_STATUS: ""
runs-on: ubuntu-18.04
steps:
- name: install gopogh
run: |
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.0.18/gopogh-linux-amd64
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
continue-on-error: true
shell: bash
run: |
pwd
cd minikube_binaries
mkdir -p report
mkdir -p testhome
ls -lah
chmod a+x e2e-*
chmod a+x minikube-*
ls -lah
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -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 gopogh report
run: |
cd minikube_binaries
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 " $GITHUB_REF" -repo "${JOB_NAME} ${GITHUB_REF} ${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
@ -159,13 +260,13 @@ jobs:
name: none_ubuntu16_04
path: report
podman_ubuntu_18_04:
needs: [build_minikube]
env:
TIME_ELAPSED: time
JOB_NAME: "Podman_Ubuntu_18_04"
COMMIT_STATUS: ""
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: install podman
run: |
. /etc/os-release
@ -174,35 +275,39 @@ jobs:
sudo apt-key add - < Release.key || true
sudo apt-get update -qq
sudo apt-get -qq -y install podman
- name: build binaries
run : |
make minikube-linux-amd64
make e2e-linux-amd64
mkdir -p report
mkdir -p testhome
pwd
ls -lah
cp -r test/integration/testdata ./
cp -r test/integration/testdata ./
ls -lah
whoami
sudo podman version || true
sudo podman info || true
- name: install gopogh
run: |
cd /tmp
GO111MODULE="on" go get github.com/medyagh/gopogh@v0.0.17 || true
cd -
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.0.18/gopogh-linux-amd64
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
continue-on-error: true
shell: bash
run: |
cd minikube_binaries
mkdir -p report
mkdir -p testhome
ls -lah
chmod a+x e2e-*
chmod a+x minikube-*
ls -lah
START_TIME=$(date -u +%s)
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome sudo -E ./out/e2e-linux-amd64 -minikube-start-args=--vm-driver=podman -expected-default-driver= -test.timeout=70m -test.v -binary=out/minikube-linux-amd64 2>&1 | tee ./report/testout.txt
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args=--vm-driver=docker -expected-default-driver= -test.timeout=70m -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"
TIME_ELAPSED="${min} min $sec seconds "
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
- name: generate gopogh report
- name: generate html report
run: |
pwd
cd minikube_binaries
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 " $GITHUB_REF" -repo "${JOB_NAME} ${GITHUB_REF} ${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
@ -216,16 +321,18 @@ jobs:
- uses: actions/upload-artifact@v1
with:
name: podman_ubuntu_18_04
path: report
path: report
# After all 4 integration tests finished
# collect all the reports and upload
upload_all_reports:
needs: [docker_ubuntu_16_04,docker_ubuntu_18_04,none_ubuntu16_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
steps:
- name: download results docker_ubuntu_16_04
uses: actions/download-artifact@v1
with:
name: docker_ubuntu_16_04
- name: see if report is there
- name: cp to all_report
shell: bash
run: |
pwd
@ -237,7 +344,7 @@ jobs:
uses: actions/download-artifact@v1
with:
name: docker_ubuntu_18_04
- name: see if report is there
- name: cp to all_report
shell: bash
run: |
pwd
@ -249,7 +356,7 @@ jobs:
uses: actions/download-artifact@v1
with:
name: none_ubuntu16_04
- name: see if report is there
- name: cp to all_report
shell: bash
run: |
pwd
@ -257,12 +364,23 @@ jobs:
ls -lah none_ubuntu16_04
mkdir -p all_reports
cp -r none_ubuntu16_04 ./all_reports/
- name: download results none_ubuntu18_04
uses: actions/download-artifact@v1
with:
name: none_ubuntu18_04
- name: cp to all_report
shell: bash
run: |
pwd
ls -lah
ls -lah none_ubuntu18_04
mkdir -p all_reports
cp -r none_ubuntu18_04 ./all_reports/
- name: download results podman_ubuntu_18_04
uses: actions/download-artifact@v1
with:
name: podman_ubuntu_18_04
- name: see if report is there
- name: cp to all_report
shell: bash
run: |
pwd