workflows: Add qemu-eest workflow #6
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: Qemu EESTs on RV32IM | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| workflow_dispatch: | |
| jobs: | |
| build-qemu-rv32im: | |
| name: Build rv32im Binary (Ubuntu 25.10) | |
| runs-on: ubuntu-latest | |
| container: ubuntu:25.10 | |
| steps: | |
| - name: Install system dependencies | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| TZ: Etc/UTC | |
| run: | | |
| apt update | |
| apt install -y \ | |
| build-essential cmake ninja-build \ | |
| git git-lfs \ | |
| python3 python3-pip pipx \ | |
| nodejs npm | |
| pipx install conan | |
| pipx ensurepath | |
| npm i -g xpm | |
| xpm install @xpack-dev-tools/riscv-none-elf-gcc@latest --global --verbose | |
| echo 'export PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH' >> ~/.bashrc | |
| echo "PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH" >> $GITHUB_ENV | |
| - name: Verify tool versions | |
| run: | | |
| riscv-none-elf-gcc --version | |
| riscv-none-elf-g++ --version | |
| cmake --version | |
| ninja --version | |
| git --version | |
| git lfs version | |
| python3 --version | |
| ctest --version | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| lfs: true | |
| - name: Build EEST blockchain tests | |
| run: | | |
| cd qemu_runner && make xpack-elf-eest | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eest-build-artifacts | |
| path: | | |
| qemu_runner/ | |
| third_party/eest-fixtures/ | |
| retention-days: 1 | |
| run-rv32im-blockchain-tests: | |
| name: Run EEST Tests via QEMU | |
| runs-on: ubuntu-latest | |
| needs: build-qemu-rv32im | |
| steps: | |
| - name: Install QEMU | |
| run: | | |
| sudo apt update | |
| sudo apt install -y qemu-system-misc cmake | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: eest-build-artifacts | |
| - name: Fix CMake paths for native runner | |
| run: | | |
| # Replace container paths with native runner paths in CMake/CTest config files | |
| find qemu_runner/build -type f \( -name "*.cmake" -o -name "*.tcl" -o -name "CMakeCache.txt" \) \ | |
| -exec sed -i 's|/__w/|/home/runner/work/|g' {} \; | |
| - name: Run EEST blockchain tests | |
| id: run_tests | |
| shell: bash | |
| run: | | |
| set +e | |
| cd qemu_runner && make rerun_ctest 2>&1 | tee output.log | |
| exit_code=${PIPESTATUS[0]} | |
| # Parse test results | |
| if grep -q "tests passed" output.log; then | |
| result_line=$(grep "tests passed" output.log | tail -1) | |
| # Extract numbers: "X% tests passed, Y tests failed out of Z" | |
| passed=$(echo "$result_line" | grep -oP '\d+(?=% tests passed)') | |
| failed=$(echo "$result_line" | grep -oP '\d+(?= tests failed)') | |
| total=$(echo "$result_line" | grep -oP '(?<=out of )\d+') | |
| echo "passed_percent=$passed" >> $GITHUB_OUTPUT | |
| echo "failed=$failed" >> $GITHUB_OUTPUT | |
| echo "total=$total" >> $GITHUB_OUTPUT | |
| echo "exit_code=$exit_code" >> $GITHUB_OUTPUT | |
| else | |
| echo "passed_percent=0" >> $GITHUB_OUTPUT | |
| echo "failed=-1" >> $GITHUB_OUTPUT | |
| echo "total=0" >> $GITHUB_OUTPUT | |
| echo "exit_code=$exit_code" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Print test summary | |
| if: always() | |
| shell: bash | |
| run: | | |
| echo "========================================" | |
| echo " EEST TEST SUMMARY" | |
| echo "========================================" | |
| echo "" | |
| echo "Results: ${{ steps.run_tests.outputs.passed_percent }}% passed, ${{ steps.run_tests.outputs.failed }} failed out of ${{ steps.run_tests.outputs.total }}" | |
| echo "========================================" | |
| - name: Upload test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eest-test-logs | |
| path: | | |
| qemu_runner/output.log | |
| qemu_runner/build/Testing/Temporary/LastTest.log | |
| retention-days: 30 | |
| - name: Check failure threshold | |
| if: always() | |
| shell: bash | |
| run: | | |
| failed=${{ steps.run_tests.outputs.failed }} | |
| total=${{ steps.run_tests.outputs.total }} | |
| exit_code=${{ steps.run_tests.outputs.exit_code }} | |
| if [[ "$failed" == "-1" ]]; then | |
| echo "ERROR: Could not parse test results" | |
| exit 1 | |
| fi | |
| if (( failed > 5 )); then | |
| echo "Too many failures - ${failed} failed out of ${total}" | |
| echo "failed" > failed.log | |
| exit 1 | |
| fi | |
| if (( failed > 0 )); then | |
| echo "WARNING: ${failed} test(s) failed, but within acceptable threshold (<=5)" | |
| else | |
| echo "SUCCESS: All ${total} tests passed!" | |
| fi |