chore: update lint workflow to be only on pull requests #196
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 | |
push: | |
tags: | |
- v* | |
branches: | |
- main | |
paths: | |
- "**/*.go" | |
pull_request: | |
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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: false | |
- name: Run Unit Tests | |
run: go test ./test/controllerstest | |
e2e: | |
runs-on: ubuntu-latest | |
name: E2E Test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: false | |
- name: Install Prerequisites | |
run: | | |
# Install clusterctl | |
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.3/clusterctl-linux-amd64 -o clusterctl | |
chmod +x clusterctl | |
sudo mv clusterctl /usr/local/bin/ | |
#Install Kind | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
# Install envsubst | |
GOBIN="$(pwd)/bin" go install -tags tools github.com/drone/envsubst/v2/cmd/[email protected] | |
# Install kubectl | |
curl -LO "https://dl.k8s.io/release/v1.29.2/bin/linux/amd64/kubectl" | |
chmod +x ./kubectl | |
sudo mv ./kubectl /usr/local/bin/kubectl | |
# Install DevSpace | |
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: Create and Start Kind Cluster | |
run: | | |
kind create cluster --image=kindest/node:v1.28.9@sha256:dca54bc6a6079dd34699d53d7d4ffa2e853e46a20cd12d619a09207e35300bd0 | |
echo "=== cluster-info ===" | |
kubectl cluster-info --context kind-kind | |
- name: Init | |
run: | | |
clusterctl init | |
echo "=== config get-contexts ===" | |
kubectl config get-contexts | |
- name: DevSpace Deploy | |
run: | | |
devspace deploy -p deploy | |
- name: Display Kubernetes Env | |
run: | | |
echo "=== Kubectl version ===" | |
kubectl version | |
echo "=== Kubectl config ===" | |
kubectl config view | |
echo "=== Kubectl get pods ===" | |
kubectl get pods -A | |
echo "=== Kubectl get namespaces ===" | |
kubectl get namespaces | |
echo "=== Test get crd ===" | |
kubectl get crd | |
- name: Create Vcluster Custom Resource K3S | |
run: | | |
export CLUSTER_NAME=vcluster-k3s | |
export CLUSTER_NAMESPACE=vcluster-k3s | |
export CHART_VERSION=0.20.0-beta.15 | |
export VCLUSTER_YAML=$(cat ./test/e2e/k3s-values.yaml | sed -z 's/\n/\\n/g') | |
kubectl create namespace ${CLUSTER_NAMESPACE} | |
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f - | |
- name: Validate Resource Ready K3S | |
run: | | |
kubectl wait --for=condition=ready vcluster -n vcluster-k3s vcluster-k3s --timeout=100s | |
- name: Run E2E Tests K3S | |
run: CLUSTER_NAME=vcluster-k3s NAMESPACE=vcluster-k3s LOCAL_PORT=14550 go test -mod=vendor ./test/e2e -v | |
- name: Create Vcluster Custom Resource K0S | |
run: | | |
export CLUSTER_NAME=vcluster-k0s | |
export CLUSTER_NAMESPACE=vcluster-k0s | |
export CHART_VERSION=0.20.0-beta.15 | |
export CHART_NAME=vcluster | |
export VCLUSTER_YAML=$(cat ./test/e2e/k0s-values.yaml | sed -z 's/\n/\\n/g') | |
kubectl create namespace ${CLUSTER_NAMESPACE} | |
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f - | |
- name: Validate Resource Ready K0S | |
run: | | |
kubectl wait --for=condition=ready vcluster -n vcluster-k0s vcluster-k0s --timeout=100s | |
- name: Run E2E Tests K0S | |
run: CLUSTER_NAME=vcluster-k0s NAMESPACE=vcluster-k0s LOCAL_PORT=14551 go test -mod=vendor ./test/e2e -v | |
- name: Create Vcluster Custom Resource K8S | |
run: | | |
export CLUSTER_NAME=vcluster-k8s | |
export CLUSTER_NAMESPACE=vcluster-k8s | |
export CHART_VERSION=0.20.0-beta.15 | |
export CHART_NAME=vcluster | |
export VCLUSTER_YAML=$(cat ./test/e2e/k8s-values.yaml | sed -z 's/\n/\\n/g') | |
kubectl create namespace ${CLUSTER_NAMESPACE} | |
cat templates/cluster-template.yaml | ./bin/envsubst | kubectl apply -n ${CLUSTER_NAMESPACE} -f - | |
- name: Validate Resource Ready K8S | |
run: | | |
kubectl wait --for=condition=ready vcluster -n vcluster-k8s vcluster-k8s --timeout=100s | |
- name: Run E2E Tests K8S | |
run: CLUSTER_NAME=vcluster-k8s NAMESPACE=vcluster-k8s LOCAL_PORT=14552 go test -mod=vendor ./test/e2e -v |