Skip to content

Commit 1923f82

Browse files
authored
docs(badge): Generate runtime tests badge (#9979)
1 parent 874e2a1 commit 1923f82

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

Diff for: .github/workflows/tests_results.yml

+30-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ jobs:
2222
statuses: write
2323
checks: write
2424
pull-requests: write
25+
contents: write
2526
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
ref: gh-pages
30+
2631
- name: Download and Extract Artifacts
2732
uses: dawidd6/action-download-artifact@v6
2833
with:
@@ -102,7 +107,31 @@ jobs:
102107
repo: repo,
103108
sha: sha,
104109
state: '${{ job.status }}',
105-
description: '${{ job.status }}' ? 'Runtime tests successful' : 'Runtime tests failed',
110+
description: '${{ job.status }}' == 'success' ? 'Runtime tests successful' : 'Runtime tests failed',
106111
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
107112
})).data;
108113
core.info(`${name} is ${state}`);
114+
115+
- name: Create output folder
116+
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
117+
run: |
118+
rm -rf artifacts
119+
mkdir -p runtime-tests-results
120+
121+
- name: Generate badge
122+
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
123+
uses: jaywcjlove/generated-badges@main
124+
with:
125+
label: Runtime Tests
126+
status: ${{ job.status }}
127+
output: runtime-tests-results/badge.svg
128+
color: ${{ job.status == 'success' && 'green' || 'red' }}
129+
130+
- name: Push badge
131+
if: ${{ !cancelled() && (env.original_event == 'schedule' || env.original_event == 'workflow_dispatch') }}
132+
run: |
133+
git config user.name "github-actions[bot]"
134+
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

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Arduino core for the ESP32, ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2
22

3-
![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md) [![Hardware Tests](https://github.com/espressif/arduino-esp32/actions/workflows/tests.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/actions/workflows/tests.yml?query=event%3Aschedule)
3+
![Build Status](https://github.com/espressif/arduino-esp32/workflows/ESP32%20Arduino%20CI/badge.svg) [![External Libraries Test](https://github.com/espressif/arduino-esp32/actions/workflows/lib.yml/badge.svg?branch=master&event=schedule)](https://github.com/espressif/arduino-esp32/blob/gh-pages/LIBRARIES_TEST.md) [![Hardware Tests](https://github.com/espressif/arduino-esp32/blob/gh-pages/runtime-tests-results/badge.svg)](https://github.com/espressif/arduino-esp32/actions/workflows/tests_results.yml)
44

55
### Need help or have a question? Join the chat at [Gitter](https://gitter.im/espressif/arduino-esp32) or [open a new Discussion](https://github.com/espressif/arduino-esp32/discussions)
66

0 commit comments

Comments
 (0)