|
| 1 | +name: Qemu EESTs on RV32IM |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 0 */3 * *" # Run every 3 days at midnight UTC |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-run-rv32im: |
| 10 | + name: Build and Run EEST Tests (Ubuntu 25.10) |
| 11 | + runs-on: ubuntu-latest |
| 12 | + container: ubuntu:25.10 |
| 13 | + steps: |
| 14 | + - name: Install system dependencies |
| 15 | + env: |
| 16 | + DEBIAN_FRONTEND: noninteractive |
| 17 | + TZ: Etc/UTC |
| 18 | + run: | |
| 19 | + apt update |
| 20 | + apt install -y \ |
| 21 | + build-essential cmake ninja-build \ |
| 22 | + git git-lfs \ |
| 23 | + python3 python3-pip pipx \ |
| 24 | + nodejs npm \ |
| 25 | + qemu-system-misc |
| 26 | + pipx install conan |
| 27 | + pipx ensurepath |
| 28 | + npm i -g xpm |
| 29 | + xpm install @xpack-dev-tools/riscv-none-elf-gcc@latest --global --verbose |
| 30 | + echo 'export PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH' >> ~/.bashrc |
| 31 | + echo "PATH=$HOME/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/15.2.0-1.1/.content/bin:$PATH" >> $GITHUB_ENV |
| 32 | +
|
| 33 | + - name: Verify tool versions |
| 34 | + run: | |
| 35 | + riscv-none-elf-gcc --version |
| 36 | + riscv-none-elf-g++ --version |
| 37 | + cmake --version |
| 38 | + ninja --version |
| 39 | + git --version |
| 40 | + git lfs version |
| 41 | + python3 --version |
| 42 | + ctest --version |
| 43 | + qemu-system-riscv32 --version |
| 44 | +
|
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + submodules: recursive |
| 49 | + lfs: true |
| 50 | + |
| 51 | + - name: Build EEST blockchain tests |
| 52 | + run: | |
| 53 | + cd qemu_runner && make xpack-elf-eest |
| 54 | +
|
| 55 | + - name: Run EEST blockchain tests |
| 56 | + id: run_tests |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + set +e |
| 60 | + cd qemu_runner |
| 61 | + make rerun_ctest 2>&1 | tee output.log |
| 62 | +
|
| 63 | + exit_code=${PIPESTATUS[0]} |
| 64 | +
|
| 65 | + # Parse test results |
| 66 | + if grep -q "tests passed" output.log; then |
| 67 | + result_line=$(grep "tests passed" output.log | tail -1) |
| 68 | + # Extract numbers: "X% tests passed, Y tests failed out of Z" |
| 69 | + passed=$(echo "$result_line" | grep -oP '\d+(?=% tests passed)') |
| 70 | + failed=$(echo "$result_line" | grep -oP '\d+(?= tests failed)') |
| 71 | + total=$(echo "$result_line" | grep -oP '(?<=out of )\d+') |
| 72 | + |
| 73 | + echo "passed_percent=$passed" >> $GITHUB_OUTPUT |
| 74 | + echo "failed=$failed" >> $GITHUB_OUTPUT |
| 75 | + echo "total=$total" >> $GITHUB_OUTPUT |
| 76 | + echo "exit_code=$exit_code" >> $GITHUB_OUTPUT |
| 77 | + else |
| 78 | + echo "passed_percent=0" >> $GITHUB_OUTPUT |
| 79 | + echo "failed=-1" >> $GITHUB_OUTPUT |
| 80 | + echo "total=0" >> $GITHUB_OUTPUT |
| 81 | + echo "exit_code=$exit_code" >> $GITHUB_OUTPUT |
| 82 | + fi |
| 83 | +
|
| 84 | + - name: Print test summary |
| 85 | + if: always() |
| 86 | + shell: bash |
| 87 | + run: | |
| 88 | + echo "========================================" |
| 89 | + echo " EEST TEST SUMMARY" |
| 90 | + echo "========================================" |
| 91 | + echo "" |
| 92 | + echo "Results: ${{ steps.run_tests.outputs.passed_percent }}% passed, ${{ steps.run_tests.outputs.failed }} failed out of ${{ steps.run_tests.outputs.total }}" |
| 93 | + echo "========================================" |
| 94 | +
|
| 95 | + - name: Upload test logs |
| 96 | + if: always() |
| 97 | + uses: actions/upload-artifact@v4 |
| 98 | + with: |
| 99 | + name: eest-test-logs |
| 100 | + path: | |
| 101 | + qemu_runner/output.log |
| 102 | + qemu_runner/build/Testing/Temporary/LastTest.log |
| 103 | + retention-days: 30 |
| 104 | + |
| 105 | + - name: Check failure threshold |
| 106 | + if: always() |
| 107 | + shell: bash |
| 108 | + run: | |
| 109 | + failed=${{ steps.run_tests.outputs.failed }} |
| 110 | + total=${{ steps.run_tests.outputs.total }} |
| 111 | + exit_code=${{ steps.run_tests.outputs.exit_code }} |
| 112 | +
|
| 113 | + if [[ "$failed" == "-1" ]]; then |
| 114 | + echo "ERROR: Could not parse test results" |
| 115 | + exit 1 |
| 116 | + fi |
| 117 | +
|
| 118 | + if (( failed > 5 )); then |
| 119 | + echo "Too many failures - ${failed} failed out of ${total}" |
| 120 | + echo "failed" > failed.log |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | +
|
| 124 | + if (( failed > 0 )); then |
| 125 | + echo "WARNING: ${failed} test(s) failed, but within acceptable threshold (<=5)" |
| 126 | + else |
| 127 | + echo "SUCCESS: All ${total} tests passed!" |
| 128 | + fi |
0 commit comments