Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Run integration tests

on:
pull_request:
types: [labeled, synchronize, reopened]
paths-ignore:
- 'docs/**'

jobs:
integration-tests:
runs-on: ubuntu-22.04
Comment thread
lukasfrank marked this conversation as resolved.
Resolved

if: contains(github.event.pull_request.labels.*.name, 'integration-tests')

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'

- name: Install dependencies
run: |
set -x

if [ ! -e /dev/kvm ]; then
echo "KVM not available"
exit 1
fi

sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
ca-certificates libc-bin gcc cpu-checker
sudo update-ca-certificates
sudo rm -rf /var/lib/apt/lists

# curl -L "https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.1/cloud-hypervisor-static-aarch64" -o "cloud-hypervisor"
# curl -L "https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.1/ch-remote-static-aarch64" -o "ch-remote"
Comment thread
lukasfrank marked this conversation as resolved.
Resolved

sudo curl -L "https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.1/cloud-hypervisor-static" -o "/usr/local/bin/cloud-hypervisor"

# sudo curl -L "https://github.com/cloud-hypervisor/rust-hypervisor-firmware/releases/download/0.5.0/hypervisor-fw-aarch64" -o "/usr/local/bin/hypervisor-fw"
sudo curl -L "https://github.com/cloud-hypervisor/rust-hypervisor-firmware/releases/download/0.5.0/hypervisor-fw" -o "/usr/local/bin/hypervisor-fw"

sudo chmod a+x /usr/local/bin/cloud-hypervisor
# chmod a+x /usr/local/bin/ch-remote

# Create chp group and user
if ! getent group chp > /dev/null 2>&1; then
sudo groupadd -g 65532 chp
fi
if ! getent passwd chp > /dev/null 2>&1; then
sudo useradd -u 65532 -g chp -s /sbin/nologin -M -d /nonexistent chp
fi

sudo usermod -aG kvm chp

# Create storage directory
sudo mkdir -p /var/lib/chp
sudo mkdir -p /run/chp/ch
sudo chown chp:chp /var/lib/chp
sudo chmod 0755 /var/lib/chp
sudo chown chp:chp /run/chp/ch
sudo chmod 0755 /run/chp/ch
echo "CH_SOCKET_DIR=/run/chp/ch/" >> $GITHUB_ENV

sudo -u chp /usr/local/bin/cloud-hypervisor --api-socket /run/chp/ch/01.sock -v &
sudo -u chp /usr/local/bin/cloud-hypervisor --api-socket /run/chp/ch/02.sock -v &

sleep 2

# Make sockets accessible to runner
sudo chmod o+rw /run/chp/ch/*.sock

sudo ls -la /run/chp/ch


- name: Run integration tests
run: |
sudo kvm-ok
sudo /usr/local/bin/cloud-hypervisor --version
make integration-tests
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.26 AS builder
FROM --platform=$BUILDPLATFORM golang:1.24.1 AS builder
ARG TARGETOS
ARG TARGETARCH
ARG BUILDPLATFORM
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ test: generate manifests fmt vet test-only ## Run tests.

.PHONY: test-only
test-only: envtest ## Run *only* the tests - no generation, linting etc.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go run github.com/onsi/ginkgo/v2/ginkgo run -r --label-filter="!integration" -coverprofile cover.out


##@ Build
Expand Down Expand Up @@ -256,4 +256,8 @@ $(GOIMPORTS): $(LOCALBIN)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

.PHONY: integration-tests
integration-tests: ## Run integration tests against code. For dependencies, refer to the integration-test workflow.
go run github.com/onsi/ginkgo/v2/ginkgo run -r -vv --label-filter="integration" -coverprofile cover.out
Comment thread
friegger marked this conversation as resolved.
Resolved
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ path = [
"mkdocs.yml",
"hack/**.sh",
"mkdocs.yml",
"dev-vm/**",
"cloud-hypervisor/cloud-hypervisor.yaml",
"cloud-hypervisor/client/**"
]
Expand Down
Loading
Loading