(ci): pre-configuration of e2e testing #61
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: Run the build with upterm debugging enabled | |
(https://github.com/lhotari/action-upterm/) | |
required: false | |
default: false | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: e2e-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
name: Unit Test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.22" | |
- name: Run Unit Tests | |
run: go test ./... | |
e2e: | |
runs-on: ubuntu-latest | |
name: E2E Test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Install kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
- name: Create and Start Kind Cluster | |
run: | | |
kind create cluster | |
kubectl cluster-info --context kind-kind | |
- name: Install DevSpace | |
run: | | |
curl -fsSL -o /tmp/devspace https://github.com/devspace-cloud/devspace/releases/latest/download/devspace-linux-amd64 | |
chmod +x /tmp/devspace | |
sudo mv /tmp/devspace /usr/local/bin/devspace | |
- name: Verify Kubernetes context | |
run: | | |
kubectl config get-contexts | |
- name: Check Kubernetes connectivity | |
run: | | |
echo "=== Kube config ===" | |
cat $HOME/.kube/config | |
echo "=== Kubectl version ===" | |
kubectl version --client | |
echo "=== Kubectl config ===" | |
kubectl config view | |
echo "=== Kubectl current context ===" | |
kubectl config current-context | |
echo "=== Kubectl cluster info ===" | |
kubectl cluster-info | |
echo "=== Kubectl get nodes ===" | |
kubectl get nodes | |
echo "=== Kubectl get pods ===" | |
kubectl get pods --all-namespaces | |
echo "=== Kubectl get namespaces ===" | |
kubectl get namespaces | |
echo "=== Test kubectl command ===" | |
kubectl get all --all-namespaces | |
- name: DevSpace Deploy | |
run: | | |
devspace deploy -p deploy | |
- name: Create Vcluster | |
run: | | |
make envtest | |
export CLUSTER_NAME=vcluster | |
export CLUSTER_NAMESPACE=vcluster | |
export KUBERNETES_VERSION=1.23.0 | |
export HELM_VALUES="" | |
kubectl create namespace ${CLUSTER_NAMESPACE} | |
cat templates/cluster-template.yaml | ./bin/envsubst | |
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f - | |
- name: Validate resource ready | |
run: | | |
kubectl wait --for=condition=ready vcluster -n $CLUSTER_NAMESPACE $CLUSTER_NAME --timeout=30s |