Skip to content

Commit e54fb9e

Browse files
authored
ci(tests): Fix conclusion status and badge pushing (#10013)
* ci(badge): Push only when changes happened to badge * ci(tests): Fix conclusion status
1 parent f396889 commit e54fb9e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/workflows/tests_results.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,18 @@ jobs:
4040
original_action=$(cat ./artifacts/parent-artifacts/action.txt)
4141
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
4242
original_ref=$(cat ./artifacts/parent-artifacts/ref.txt)
43+
original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt)
4344
echo "original_event=$original_event" >> $GITHUB_ENV
4445
echo "original_action=$original_action" >> $GITHUB_ENV
4546
echo "original_sha=$original_sha" >> $GITHUB_ENV
4647
echo "original_ref=$original_ref" >> $GITHUB_ENV
48+
echo "original_conclusion=$original_conclusion" >> $GITHUB_ENV
4749
4850
echo "original_event = $original_event"
4951
echo "original_action = $original_action"
5052
echo "original_sha = $original_sha"
5153
echo "original_ref = $original_ref"
54+
echo "original_conclusion = $original_conclusion"
5255
5356
- name: Publish Unit Test Results
5457
uses: EnricoMi/publish-unit-test-result-action@v2
@@ -59,6 +62,10 @@ jobs:
5962
files: ./artifacts/**/*.xml
6063
action_fail: true
6164

65+
- name: Fail if tests failed
66+
if: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}
67+
run: exit 1
68+
6269
- name: Clean up caches
6370
if: always()
6471
uses: actions/github-script@v7
@@ -120,7 +127,7 @@ jobs:
120127
121128
- name: Generate badge
122129
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
123-
uses: jaywcjlove/generated-badges@main
130+
uses: jaywcjlove/generated-badges@v1.0.13
124131
with:
125132
label: Runtime Tests
126133
status: ${{ job.status }}
@@ -132,6 +139,8 @@ jobs:
132139
run: |
133140
git config user.name "github-actions[bot]"
134141
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
135-
git add --all
136-
git commit -m "Updated runtime tests badge"
137-
git push origin HEAD:gh-pages
142+
if [[ `git status --porcelain` ]]; then
143+
git add --all
144+
git commit -m "Updated runtime tests badge"
145+
git push origin HEAD:gh-pages
146+
fi

.github/workflows/tests_wokwi.yml

+5
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ jobs:
9292
exit 1
9393
fi
9494
95+
conclusion="${{ github.event.workflow_run.conclusion }}"
96+
printf "$conclusion" >> artifacts/conclusion.txt
97+
printf "\nConclusion = "
98+
cat artifacts/conclusion.txt
99+
95100
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
96101
echo "ref=$ref" >> $GITHUB_OUTPUT
97102

0 commit comments

Comments
 (0)