diff --git a/.github/workflows/auto-tests.yaml b/.github/workflows/auto-tests.yaml new file mode 100644 index 000000000..359fcb2d5 --- /dev/null +++ b/.github/workflows/auto-tests.yaml @@ -0,0 +1,60 @@ +name: Run tests +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, ready_for_review, reopened] + branches: + - master +jobs: + run-tests: + if: github.event.pull_request.draft == false + name: Run automated tests + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up env vars + run: | + echo "GO111MODULE=on" >> $GITHUB_ENV + echo "CHANGE_MINIKUBE_NONE_USER=true" >> $GITHUB_ENV + echo "MINIKUBE_WANTUPDATENOTIFICATION=false" >> $GITHUB_ENV + echo "MINIKUBE_WANTREPORTERRORPROMPT=false" >> $GITHUB_ENV + echo "GO_VERSION=v$(sed -n 's/GO_VERSION=//p' config.base.env)" >> $GITHUB_ENV + echo "MINIKUBE_VERSION=v$(sed -n 's/MINIKUBE_VERSION=//p' config.minikube.env)" >> $GITHUB_ENV + echo "OPERATOR_SDK_VERSION=v$(sed -n 's/OPERATOR_SDK_VERSION=//p' config.base.env)" >> $GITHUB_ENV + echo "MINIKUBE_KUBERNETES_VERSION=$(sed -n 's/MINIKUBE_KUBERNETES_VERSION=//p' config.minikube.env)" >> $GITHUB_ENV + echo "HELM_VERSION=v$(sed -n 's/HELM_VERSION=//p' config.base.env)" >> $GITHUB_ENV + echo "GOPATH=/home/runner/go" >> $GITHUB_ENV + + - name: Prepare go environment + uses: actions/setup-go@v2 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Ensure Golang runtime dependencies + run: make go-dependencies + + - name: Verify code formatting + run: make verify + + - name: Prepare environment for e2e + run: | + sudo apt-get update + sudo apt-get install socat + curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$MINIKUBE_KUBERNETES_VERSION/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/ + curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/ + curl -Lo operator-sdk https://github.com/operator-framework/operator-sdk/releases/download/$OPERATOR_SDK_VERSION/operator-sdk-$OPERATOR_SDK_VERSION-x86_64-linux-gnu && chmod +x operator-sdk && sudo mv operator-sdk /usr/local/bin/ + curl -Lo helm.tar.gz https://get.helm.sh/helm-$HELM_VERSION-linux-amd64.tar.gz && tar xzfv helm.tar.gz && sudo mv linux-amd64/helm /usr/local/bin/ + sudo mkdir -p $HOME/.kube $HOME/.minikube + touch KUBECONFIG + sudo minikube start --vm-driver=none --kubernetes-version=$MINIKUBE_KUBERNETES_VERSION + sudo chown -R $USER $HOME/.kube $HOME/.minikube + + - name: Jenkins Operator - e2e + run: make build e2e + + - name: Jenkins Operator Helm Chart - e2e + run: make e2e BUILDTAGS=Helm E2E_TEST_SELECTOR='^.*Helm.*$' \ No newline at end of file