diff --git a/.github/workflows/library-helloworld.yaml b/.github/workflows/library-helloworld.yaml index 48fb2cf3..ca7c404a 100644 --- a/.github/workflows/library-helloworld.yaml +++ b/.github/workflows/library-helloworld.yaml @@ -85,3 +85,35 @@ jobs: with: name: index.unikraft.io/unikraft.org/helloworld:latest push: true + + + run: + name: Test helloworld:latest (Local build) + needs: [build] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install kraft CLI + run: | + echo "deb [trusted=yes] https://deb.pkg.kraftkit.sh/ /" | sudo tee /etc/apt/sources.list.d/kraftkit.list + sudo apt-get update + sudo apt-get install -y kraftkit + - name: Build, run and validate unikernel + run: | + set -euo pipefail + sudo chmod 666 /dev/kvm + cd library/helloworld/latest + echo "Build helloworld:latest unikernel" + kraft build --no-cache --no-update --plat qemu --arch x86_64 + + echo "Run helloworld:latest unikernel" + kraft run --rm -M 256M --plat qemu --arch x86_64 . & + PID=$! + sleep 5 + + echo "helloworld:latest unikernel started successfully locally" + + echo "Cleanup helloworld:latest unikernel" + sudo kill "$PID" || true