From 2e1a313aa6e583f329db184be1b617b9225fd6fd Mon Sep 17 00:00:00 2001 From: Johannes Edmeier Date: Thu, 19 Dec 2024 10:27:55 +0100 Subject: [PATCH] build: run e2e tests for different runtimes in parallel --- .github/workflows/ci.yml | 42 +++++++++++++++++++++++++++++++++++++--- Makefile | 13 +++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63989b4..5f7240a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,13 +15,49 @@ concurrency: cancel-in-progress: true jobs: + e2e-tests: + name: E2E Tests (${{ matrix.e2e-runtime }}) + runs-on: steadybit_runner_ubuntu_latest_4cores_16GB + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + e2e-runtime: ['docker', 'containerd', 'cri-o'] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Remove non-semver tags (from helmchart) for goreleaser to work properly + run: | + git tag -d $(git tag -l | grep -v "^v[0-9]*.[0-9]*.[0-9]*") + + - uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Enable KVM group perms + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + sudo apt-get update + sudo apt-get install -y libvirt-clients libvirt-daemon-system libvirt-daemon virtinst bridge-utils qemu qemu-system-x86 + sudo usermod -a -G kvm,libvirt $USER + + - name: Audit + run: | + make prepare_audit + go mod download + echo 'exec in a new sell for the group change to take effect' + sudo -u $USER env "PATH=$PATH" "E2E_RUNTIMES=${{ matrix.e2e-runtime }}" make e2e-test + extension-ci: uses: steadybit/extension-kit/.github/workflows/reusable-extension-ci.yml@main + needs: [e2e-tests] with: go_version: '1.23' - runs_on: steadybit_runner_ubuntu_latest_4cores_16GB - use_kvm: true - run_make_prepare_audit: true build_linux_packages: true VERSION_BUMPER_APPID: ${{ vars.GH_APP_STEADYBIT_APP_ID }} secrets: diff --git a/Makefile b/Makefile index 7942c51..b557c9b 100755 --- a/Makefile +++ b/Makefile @@ -39,13 +39,22 @@ prepare_audit: minikube config set cpus max minikube config set memory 8g -## audit: run quality control checks +## audit: run quality control checks - in CI we run the e2e tests separate .PHONY: audit audit: go vet ./... go run honnef.co/go/tools/cmd/staticcheck@latest -checks=all,-SA1019,-ST1000,-U1000,-ST1003 ./... - go test -race -vet=off -coverprofile=coverage.out -timeout 35m -v ./... go mod verify +ifeq ($(CI), true) + go test -race -vet=off -coverprofile=coverage.out -timeout 35m -v $(shell go list ./... | grep -v /e2e) +else + go test -race -vet=off -coverprofile=coverage.out -timeout 35m -v ./... +endif + +## e2e: run quality control checks +.PHONY: e2e-test +e2e-test: + go test -race -vet=off -coverprofile=e2e-coverage.out -timeout 35m -v ./e2e/... ## charttesting: Run Helm chart unit tests .PHONY: charttesting