ci: download rootfs #46
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_arceos_aarch64 | |
| vmrootfs_name: qemu_arceos_aarch64 | |
| # - arch: riscv64 | |
| # vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml | |
| # vmconfigs_name: ArceOS | |
| # vmimage_name: qemu_arceos_riscv64 | |
| # - arch: x86_64 | |
| # vmconfigs: configs/vms/arceos-x86_64-qemu-smp1.toml | |
| # vmconfigs_name: ArceOS | |
| # vmimage_name: qemu_arceos_x86_64 | |
| 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 rootfs | |
| run: | | |
| if [ -n "${{ matrix.vmrootfs_name }}" ]; then | |
| ROOTFS_URL="https://github.com/arceos-hypervisor/axvisor-guest/releases/download/v0.0.19/${{ matrix.vmrootfs_name }}.tar.gz" | |
| ROOTFS_DIR="/tmp/axvisor/rootfs/${{ matrix.vmrootfs_name }}" | |
| ROOTFS_IMG_PATH="${ROOTFS_DIR}/rootfs.img" | |
| mkdir -p "${ROOTFS_DIR}" | |
| echo "Downloading rootfs from ${ROOTFS_URL}" | |
| curl -L "${ROOTFS_URL}" -o "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz" | |
| echo "Extracting rootfs to ${ROOTFS_DIR}" | |
| tar -xzf "${ROOTFS_DIR}/${{ matrix.vmrootfs_name }}.tar.gz" -C "${ROOTFS_DIR}" | |
| echo "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 vmrootfs_name specified, skipping rootfs download" | |
| 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 }} |