diff --git a/.github/workflows/eest-blockchain-tests.yml b/.github/workflows/eest-blockchain-tests.yml new file mode 100644 index 0000000..ba4bf89 --- /dev/null +++ b/.github/workflows/eest-blockchain-tests.yml @@ -0,0 +1,119 @@ +name: EEST Blockchain Tests + +on: + push: + branches: [master, main] + pull_request: + branches: [master, main] + workflow_dispatch: + +jobs: + eest-blockchain-tests: + name: Run EEST Blockchain Tests + 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 \ + g++-15 \ + cmake \ + ninja-build \ + git \ + git-lfs \ + python3 \ + python3-pip \ + pipx + pipx install conan + pipx ensurepath + + - name: Verify tool versions + run: | + gcc --version + 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: Run EEST blockchain tests + id: run_tests + shell: bash + run: | + set +e + make eest-blockchain-tests 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 + 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: | + output.log + build/eest/Testing/Temporary/LastTest.log + retention-days: 30 + + - name: Check failure threshold + 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 diff --git a/Makefile b/Makefile index 2e92ade..31a1f60 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ - -eest_blockchain_tests: +eest_blockchain_tests eest-blockchain-tests: cmake -B build/eest -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DTESTS_DIR=third_party/eest-fixtures/blockchain_tests cmake --build build/eest ctest --test-dir build/eest --parallel