name: qemu port

on:
  push:
  pull_request:
    paths:
      - '.github/workflows/*.yml'
      - 'tools/**'
      - 'py/**'
      - 'extmod/**'
      - 'shared/**'
      - 'lib/**'
      - 'drivers/**'
      - 'ports/qemu/**'
      - 'tests/**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build_and_test_arm:
    strategy:
      fail-fast: false
      matrix:
        ci_func:  # names are functions in ci.sh
          - bigendian
          - sabrelite
          - thumb_softfp
          - thumb_hardfp
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7
    - name: Install packages
      run: tools/ci.sh qemu_setup_arm
    - name: Build and run test suite ci_qemu_build_arm_${{ matrix.ci_func }}
      run: tools/ci.sh qemu_build_arm_${{ matrix.ci_func }}
    - name: Print failures
      if: failure()
      run: tests/run-tests.py --print-failures

  build_and_test_rv32:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7
    - name: Install packages
      run: tools/ci.sh qemu_setup_rv32
    - name: Build and run test suite
      run: tools/ci.sh qemu_build_rv32
    - name: Print failures
      if: failure()
      run: tests/run-tests.py --print-failures

  build_and_test_rv64:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7
    - name: Install packages
      run: tools/ci.sh qemu_setup_rv64
    - name: Build and run test suite
      run: tools/ci.sh qemu_build_rv64
    - name: Print failures
      if: failure()
      run: tests/run-tests.py --print-failures

  build_and_test_ppc64:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v7
    - name: Install packages
      run: tools/ci.sh qemu_setup_ppc64
    - name: Build and run test suite
      run: tools/ci.sh qemu_build_ppc64
    - name: Print failures
      if: failure()
      run: tests/run-tests.py --print-failures
