Skip to content

Commit 4b585df

Browse files
committed
Add EEST workflow
1 parent 65142f9 commit 4b585df

File tree

2 files changed

+122
-2
lines changed

2 files changed

+122
-2
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: EEST Blockchain Tests
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
eest-blockchain-tests:
12+
name: Run EEST Blockchain Tests
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
lfs: true
21+
22+
- name: Install system dependencies
23+
env:
24+
DEBIAN_FRONTEND: noninteractive
25+
TZ: Etc/UTC
26+
run: |
27+
apt update
28+
apt install -y \
29+
build-essential \
30+
g++ \
31+
cmake \
32+
ninja-build \
33+
git \
34+
git-lfs \
35+
python3 \
36+
python3-pip \
37+
pipx
38+
pipx install conan
39+
pipx ensurepath
40+
41+
42+
- name: Verify tool versions
43+
run: |
44+
gcc --version
45+
g++ --version
46+
cmake --version
47+
ninja --version
48+
git --version
49+
git lfs version
50+
python3 --version
51+
ctest --version
52+
53+
- name: Run EEST blockchain tests
54+
id: run_tests
55+
run: |
56+
set +e
57+
make eest-blockchain-tests 2>&1 | tee output.log
58+
exit_code=${PIPESTATUS[0]}
59+
60+
# Parse test results
61+
if grep -q "tests passed" output.log; then
62+
result_line=$(grep "tests passed" output.log | tail -1)
63+
# Extract numbers: "X% tests passed, Y tests failed out of Z"
64+
passed=$(echo "$result_line" | grep -oP '\d+(?=% tests passed)')
65+
failed=$(echo "$result_line" | grep -oP '\d+(?= tests failed)')
66+
total=$(echo "$result_line" | grep -oP '(?<=out of )\d+')
67+
68+
echo "passed_percent=$passed" >> $GITHUB_OUTPUT
69+
echo "failed=$failed" >> $GITHUB_OUTPUT
70+
echo "total=$total" >> $GITHUB_OUTPUT
71+
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
72+
else
73+
echo "passed_percent=0" >> $GITHUB_OUTPUT
74+
echo "failed=-1" >> $GITHUB_OUTPUT
75+
echo "total=0" >> $GITHUB_OUTPUT
76+
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
77+
fi
78+
79+
- name: Print test summary
80+
run: |
81+
echo "========================================"
82+
echo " EEST TEST SUMMARY"
83+
echo "========================================"
84+
echo ""
85+
echo "Results: ${{ steps.run_tests.outputs.passed_percent }}% passed, ${{ steps.run_tests.outputs.failed }} failed out of ${{ steps.run_tests.outputs.total }}"
86+
echo "========================================"
87+
88+
- name: Upload test logs
89+
if: always()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: eest-test-logs
93+
path: |
94+
output.log
95+
test_summary.log
96+
build/eest/Testing/Temporary/LastTest.log
97+
retention-days: 30
98+
99+
- name: Check failure threshold
100+
run: |
101+
failed=${{ steps.run_tests.outputs.failed }}
102+
total=${{ steps.run_tests.outputs.total }}
103+
exit_code=${{ steps.run_tests.outputs.exit_code }}
104+
105+
if [[ "$failed" == "-1" ]]; then
106+
echo "ERROR: Could not parse test results"
107+
exit 1
108+
fi
109+
110+
if (( failed > 5 )); then
111+
echo "Too many failures - ${failed} failed out of ${total}"
112+
echo "failed" > failed.log
113+
exit 1
114+
fi
115+
116+
if (( failed > 0 )); then
117+
echo "WARNING: ${failed} test(s) failed, but within acceptable threshold (<=5)"
118+
else
119+
echo "SUCCESS: All ${total} tests passed!"
120+
fi
121+

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

2-
3-
eest_blockchain_tests:
2+
eest_blockchain_tests eest-blockchain-tests:
43
cmake -B build/eest -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DTESTS_DIR=third_party/eest-fixtures/blockchain_tests
54
cmake --build build/eest
65
ctest --test-dir build/eest --parallel

0 commit comments

Comments
 (0)