action.yml 988 bytes
name: Install Qemu RISC-V
runs:
  using: composite
  steps:
  - name: Attempt to restore toolchain from cache
    id: cache
    uses: actions/cache@v4
    with:
      path: qemu-prebuilt-9.2.1.tar.gz
      key: riscv64-qemu-cache
      restore-keys: riscv64-qemu-
  - name: Download musl toolchain
    if: steps.cache.outputs.cache-hit != 'true'
    shell: bash
    run: |
      wget https://github.com/neuq-rcore/testsuit-binary/releases/download/qemu/qemu-prebuilt-9.2.1.tar.gz
  - name: Cache sdcard.img if not cached
    if: steps.cache.outputs.cache-hit != 'true'
    uses: actions/cache@v4
    with:
      path: qemu-prebuilt-9.2.1.tar.gz
      key: riscv64-qemu-cache
  - name: Install and Add qemu to PATH
    shell: bash
    run: |
      mkdir qemu
      tar -xf qemu-prebuilt-9.2.1.tar.gz -C qemu
      echo "$PWD/qemu/bin" >> $GITHUB_PATH
  - name: Verify installation
    shell: bash
    run: |
      qemu-system-riscv64 --version
      qemu-system-loongarch64 --version