Unverified Commit e54fb9e3 authored by Lucas Saavedra Vaz's avatar Lucas Saavedra Vaz Committed by GitHub

ci(tests): Fix conclusion status and badge pushing (#10013)

* ci(badge): Push only when changes happened to badge

* ci(tests): Fix conclusion status
parent f3968897
...@@ -40,15 +40,18 @@ jobs: ...@@ -40,15 +40,18 @@ jobs:
original_action=$(cat ./artifacts/parent-artifacts/action.txt) original_action=$(cat ./artifacts/parent-artifacts/action.txt)
original_sha=$(cat ./artifacts/parent-artifacts/sha.txt) original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
original_ref=$(cat ./artifacts/parent-artifacts/ref.txt) original_ref=$(cat ./artifacts/parent-artifacts/ref.txt)
original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt)
echo "original_event=$original_event" >> $GITHUB_ENV echo "original_event=$original_event" >> $GITHUB_ENV
echo "original_action=$original_action" >> $GITHUB_ENV echo "original_action=$original_action" >> $GITHUB_ENV
echo "original_sha=$original_sha" >> $GITHUB_ENV echo "original_sha=$original_sha" >> $GITHUB_ENV
echo "original_ref=$original_ref" >> $GITHUB_ENV echo "original_ref=$original_ref" >> $GITHUB_ENV
echo "original_conclusion=$original_conclusion" >> $GITHUB_ENV
echo "original_event = $original_event" echo "original_event = $original_event"
echo "original_action = $original_action" echo "original_action = $original_action"
echo "original_sha = $original_sha" echo "original_sha = $original_sha"
echo "original_ref = $original_ref" echo "original_ref = $original_ref"
echo "original_conclusion = $original_conclusion"
- name: Publish Unit Test Results - name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2 uses: EnricoMi/publish-unit-test-result-action@v2
...@@ -59,6 +62,10 @@ jobs: ...@@ -59,6 +62,10 @@ jobs:
files: ./artifacts/**/*.xml files: ./artifacts/**/*.xml
action_fail: true action_fail: true
- name: Fail if tests failed
if: ${{ env.original_conclusion == 'failure' || env.original_conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' }}
run: exit 1
- name: Clean up caches - name: Clean up caches
if: always() if: always()
uses: actions/github-script@v7 uses: actions/github-script@v7
...@@ -120,7 +127,7 @@ jobs: ...@@ -120,7 +127,7 @@ jobs:
- name: Generate badge - name: Generate badge
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }} if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
uses: jaywcjlove/generated-badges@main uses: jaywcjlove/generated-badges@v1.0.13
with: with:
label: Runtime Tests label: Runtime Tests
status: ${{ job.status }} status: ${{ job.status }}
...@@ -132,6 +139,8 @@ jobs: ...@@ -132,6 +139,8 @@ jobs:
run: | run: |
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ `git status --porcelain` ]]; then
git add --all git add --all
git commit -m "Updated runtime tests badge" git commit -m "Updated runtime tests badge"
git push origin HEAD:gh-pages git push origin HEAD:gh-pages
fi
...@@ -92,6 +92,11 @@ jobs: ...@@ -92,6 +92,11 @@ jobs:
exit 1 exit 1
fi fi
conclusion="${{ github.event.workflow_run.conclusion }}"
printf "$conclusion" >> artifacts/conclusion.txt
printf "\nConclusion = "
cat artifacts/conclusion.txt
echo "pr_num=$pr_num" >> $GITHUB_OUTPUT echo "pr_num=$pr_num" >> $GITHUB_OUTPUT
echo "ref=$ref" >> $GITHUB_OUTPUT echo "ref=$ref" >> $GITHUB_OUTPUT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment