ci #42
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: CI | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| workflow_dispatch: | |
| jobs: | |
| lint-and-license: | |
| name: Linter & License Check | |
| runs-on: ubuntu-22.04 | |
| container: ghcr.io/jaxtonmax/hvisor-ci:22.04_pro | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Format Check | |
| run: make fmt-test | |
| - name: License Check | |
| run: ./tools/license_checker.sh | |
| unittest: | |
| name: Unittest | |
| runs-on: ubuntu-22.04 | |
| container: ghcr.io/jaxtonmax/hvisor-ci:22.04_pro | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { arch: aarch64, board: "qemu-gicv3" } | |
| - { arch: aarch64, board: "qemu-gicv2" } | |
| - { arch: riscv64, board: "qemu-plic" } | |
| - { arch: riscv64, board: "qemu-aia" } | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up environment variables | |
| run: | | |
| echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV | |
| echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV | |
| - name: Run Unit Test | |
| run: make test | |
| build: | |
| name: Build All Targets | |
| runs-on: ubuntu-22.04 | |
| container: ghcr.io/jaxtonmax/hvisor-ci:22.04_pro | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { arch: aarch64, board: "qemu-gicv3" } | |
| - { arch: aarch64, board: "qemu-gicv2" } | |
| - { arch: aarch64, board: "zcu102" } | |
| - { arch: aarch64, board: "imx8mp" } | |
| - { arch: aarch64, board: "rk3568" } | |
| - { arch: aarch64, board: "rk3588" } | |
| - { arch: aarch64, board: "ok6254-c" } | |
| - { arch: riscv64, board: "qemu-aia" } | |
| - { arch: riscv64, board: "qemu-plic" } | |
| - { arch: loongarch64, board: "ls3a5000" } | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Cache and Install LoongArch Toolchain | |
| if: matrix.arch == 'loongarch64' | |
| uses: actions/cache@v4 | |
| with: | |
| path: /opt/loongarch-toolchain | |
| key: ${{ runner.os }}-loongarch-toolchain-v8.0 | |
| - name: Download LoongArch Toolchain if not cached | |
| if: matrix.arch == 'loongarch64' && steps.cache-loongarch.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p /opt/loongarch-toolchain | |
| wget -qO- https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/8.0/loongarch64-clfs-8.0-cross-tools-gcc-full.tar.xz | tar -xJ -C /opt/loongarch-toolchain | |
| - name: Add LoongArch Toolchain to PATH | |
| if: matrix.arch == 'loongarch64' | |
| run: echo "/opt/loongarch-toolchain/cross-tools/bin" >> $GITHUB_PATH | |
| - name: Set up environment variables | |
| run: | | |
| echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV | |
| echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV | |
| - name: Build | |
| run: make | |
| systemtest: | |
| name: Systemtest | |
| runs-on: ubuntu-22.04 | |
| container: | |
| image: ghcr.io/jaxtonmax/hvisor-ci:22.04_pro | |
| options: --cap-add=SYS_ADMIN --privileged | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { arch: aarch64, board: "qemu-gicv3" } | |
| - { arch: riscv64, board: "qemu-plic" } | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - name: Set up environment variables | |
| run: | | |
| echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV | |
| echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV | |
| - name: Clone and Build hvisor-tool in an Isolated Environment | |
| run: | | |
| echo "--- Cloning and building hvisor-tool for ${{ matrix.arch }} ---" | |
| VIRDISK_DIR="${{ github.workspace }}/platform/${{ matrix.arch }}/${{ matrix.board }}/image/virtdisk" | |
| echo "Ensuring directory exists: ${VIRDISK_DIR}" | |
| mkdir -p "${VIRDISK_DIR}" | |
| cd "${VIRDISK_DIR}" | |
| echo "Cloning hvisor-tool repository" | |
| git clone https://github.com/syswonder/hvisor-tool.git | |
| echo "Initializing submodules for hvisor-tool" | |
| cd hvisor-tool | |
| git submodule update --init --recursive | |
| cd .. | |
| HVISOR_TOOL_TOOLS_DIR="${VIRDISK_DIR}/hvisor-tool/tools" | |
| MAKE_ARCH="" | |
| CC_WITH_SYSROOT="" | |
| # --- 关键修复:添加 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 来禁用编译时强化 --- | |
| if [ "${{ matrix.arch }}" = "aarch64" ]; then | |
| MAKE_ARCH="arm64" | |
| CC_WITH_SYSROOT="aarch64-linux-gnu-gcc --sysroot=/usr/aarch64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" | |
| elif [ "${{ matrix.arch }}" = "riscv64" ]; then | |
| MAKE_ARCH="riscv" | |
| CC_WITH_SYSROOT="riscv64-linux-gnu-gcc --sysroot=/usr/riscv64-linux-gnu -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0" | |
| fi | |
| # --- 修复结束 --- | |
| echo "Running make in ${HVISOR_TOOL_TOOLS_DIR}" | |
| make -C "${HVISOR_TOOL_TOOLS_DIR}" all \ | |
| ARCH=${MAKE_ARCH} \ | |
| LIBC=gnu \ | |
| CC="${CC_WITH_SYSROOT}" | |
| echo "--- hvisor-tool build complete ---" | |
| - name: Run System Test (skipping tool build) | |
| run: | | |
| export SKIP_HVISOR_TOOL_BUILD=true | |
| make stest |