Skip to content

Commit fa02934

Browse files
authored
[draft]: gh action to check testhub status (#775)
* try gh action to check testhub status * rm error * fix print * switch to merge_group * [ci skip] make intro in docs more friendly * [ci skip] better intro * [ci skip] minor wording change * [ci skip] reference testsuite on the landing page * [ci skip] less wordy index docs page * [ci skip] less wordy intro * [ci skip] add html context * [ci skip] update copyright * [ci skip] limit github actions build tests. not run for draft PRs, only test 2 most recent sdks * [ci skip] remove merge group for now * fix url * add untested test count * [ci skip] rm checkout * [ci skip] add back checkout
1 parent da0b931 commit fa02934

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Check TestHub results
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
request_status:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Get branch name and latest commit SHA
12+
id: vars
13+
run: |
14+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
15+
# Replace "/" with "%2F" in branch name
16+
BRANCH_NAME="${BRANCH_NAME//\//%2F}"
17+
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
18+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
19+
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
20+
21+
- name: Fetch test results
22+
id: fetch_results
23+
run: |
24+
TEST_URL="https://testhub.mesastar.org/${{ env.BRANCH_NAME }}/commits/${{ env.COMMIT_SHA }}"
25+
echo "Fetching test results from: $TEST_URL"
26+
27+
RESPONSE=$(curl -s -o response.json -w "%{http_code}" "$TEST_URL")
28+
29+
if [[ "$RESPONSE" -ne 200 ]]; then
30+
echo "Test results not found or server error."
31+
exit 1
32+
fi
33+
34+
# cat response.json
35+
36+
PASS_COUNT=$(grep -B 1 "tests where all computers report passing." response.json | sed -n -E -e 's/<b>([0-9]+)<\/b>.*/\1/p')
37+
echo "Number of passing tests: $PASS_COUNT"
38+
39+
FAIL_COUNT=$(grep -B 1 "tests where all computers report failing." response.json | sed -n -E -e 's/<b>([0-9]+)<\/b>.*/\1/p')
40+
echo "Number of failing tests: $FAIL_COUNT"
41+
42+
MIXED_COUNT=$(grep -B 1 "tests where some computers report passing and others report failing." response.json | sed -n -E -e 's/<b>([0-9]+)<\/b>.*/\1/p')
43+
echo "Number of mixed tests: $MIXED_COUNT"
44+
45+
UNTESTED_COUNT=$(grep -B 1 "tests with no submission data." response.json | sed -n -E -e 's/<b>([0-9]+)<\/b>.*/\1/p')
46+
echo "Number of untested tests: $UNTESTED_COUNT"
47+
48+
echo ""
49+
50+
# Check that there are no failing or mixed tests
51+
if [[ "$FAIL_COUNT" -gt 0 || "$MIXED_COUNT" -gt 0 ]]; then
52+
echo "Some tests are failing or mixed!"
53+
exit 1
54+
fi
55+
# Check that there are at least 106 passing tests
56+
if [[ "$PASS_COUNT" -lt 106 ]]; then
57+
echo "Not enough passing tests!"
58+
exit 1
59+
else
60+
echo "All tests are passing!"
61+
fi
62+
63+
- name: Allow merge if tests pass
64+
if: success()
65+
run: echo "All tests passed. PR is good to merge!"

.github/workflows/test-mesa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
echo "platform: Linux" >> $MESA_TEST_YML
6363
echo "platform_version: Ubuntu" >> $MESA_TEST_YML
6464
shell: bash
65-
65+
6666
- name: Check Install
6767
env:
6868
OMP_NUM_THREADS: ${{env.OMP_NUM_THREADS}}

0 commit comments

Comments
 (0)