feat(ci): add x86_64 NimbOS support and upgrade guest images to v0.0.20 #55
Workflow file for this run
This file contains hidden or 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: Test for QEMU | |
| on: [push, pull_request, workflow_dispatch] | |
| jobs: | |
| test-qemu: | |
| name: "Test qemu: ${{ matrix.arch }} - ${{ matrix.vmconfigs_name }}" | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: aarch64 | |
| vmconfigs: configs/vms/arceos-aarch64-qemu-smp1.toml | |
| vmconfigs_name: ArceOS | |
| vmimage_name: qemu_aarch64_arceos | |
| # - arch: riscv64 | |
| # vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml | |
| # vmconfigs_name: ArceOS | |
| # vmimage_name: qemu_arceos_riscv64 | |
| - arch: x86_64 | |
| vmconfigs: configs/vms/nimbos-x86_64-qemu-smp1.toml | |
| vmconfigs_name: NimbOS | |
| vmimage_name: qemu_x86_64_nimbos | |
| fail-fast: false | |
| runs-on: | |
| - self-hosted | |
| - linux | |
| - intel | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: cargo +stable install -f --git https://github.com/ZR233/ostool ostool | |
| - name: Download images and patch vm configs | |
| run: | | |
| IFS=',' read -ra CONFIGS <<< "${{ matrix.vmconfigs }}" | |
| IFS=',' read -ra IMAGES <<< "${{ matrix.vmimage_name }}" | |
| for i in "${!CONFIGS[@]}"; do | |
| img="${IMAGES[$i]}" | |
| img=$(echo "$img" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | |
| config="${CONFIGS[$i]}" | |
| config=$(echo "$config" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') | |
| cargo xtask image download $img | |
| img_name="qemu-${{ matrix.arch }}" | |
| sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img_name"'"|' "$config" | |
| echo "Updated kernel_path in $config" | |
| done | |
| - name: Download IMAGES | |
| run: | | |
| IMAGES_URL="https://github.com/arceos-hypervisor/axvisor-guest/releases/download/v0.0.20/${{ matrix.vmimage_name }}.tar.gz" | |
| IMAGES_DIR="/tmp/axvisor/images/${{ matrix.vmimage_name }}" | |
| ROOTFS_IMG_PATH="${IMAGES_DIR}/rootfs.img" | |
| mkdir -p "${IMAGES_DIR}" | |
| echo "Downloading rootfs from ${IMAGES_URL}" | |
| curl -L "${IMAGES_URL}" -o "${IMAGES_DIR}/${{ matrix.vmimage_name }}.tar.gz" | |
| # Extract the tar.gz file | |
| echo "Extracting archive to ${IMAGES_DIR}" | |
| tar -xzf "${IMAGES_DIR}/${{ matrix.vmimage_name }}.tar.gz" -C "${IMAGES_DIR}" | |
| # Check if rootfs.img exists after extraction | |
| if [ -f "${ROOTFS_IMG_PATH}" ]; then | |
| echo "Found rootfs.img, patching qemu-aarch64.toml file..." | |
| sed -i 's|file=${workspaceFolder}/tmp/rootfs.img|file='"${ROOTFS_IMG_PATH}"'|' ".github/workflows/qemu-${{ matrix.arch }}.toml" | |
| echo "Rootfs setup completed" | |
| else | |
| echo "No rootfs.img found, removing rootfs device configuration from qemu-${{ matrix.arch }}.toml..." | |
| sed -i '/-device/,/virtio-blk-device,drive=disk0/d' ".github/workflows/qemu-${{ matrix.arch }}.toml" | |
| sed -i '/-drive/,/id=disk0,if=none,format=raw,file=${workspaceFolder}\/tmp\/rootfs.img/d' ".github/workflows/qemu-${{ matrix.arch }}.toml" | |
| sed -i 's/root=\/dev\/vda rw //' ".github/workflows/qemu-${{ matrix.arch }}.toml" | |
| echo "Rootfs device configuration removed" | |
| fi | |
| - name: Run tests | |
| run: | | |
| export RUST_LOG=debug | |
| cargo xtask qemu \ | |
| --build-config configs/board/qemu-${{ matrix.arch }}.toml \ | |
| --qemu-config .github/workflows/qemu-${{ matrix.arch }}.toml \ | |
| --vmconfigs ${{ matrix.vmconfigs }} |