Skip to content

Commit d308b68

Browse files
committed
[Test] Save images
Signed-off-by: Antón Casas <[email protected]>
1 parent 51a1f0a commit d308b68

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

.github/workflows/performance.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ jobs:
6464
needs: performance
6565

6666
steps:
67+
- name: Set branch name
68+
run: echo "BR=memory/performance" >> $GITHUB_ENV # Use this branch to store performance results
69+
6770
- name: Checkout
6871
uses: actions/checkout@v5
6972
with:
7073
fetch-depth: 0
71-
ref: memory/performance
74+
ref: ${{ env.BR }}
7275

7376
- name: Install Python and prerequisites
7477
shell: bash
@@ -92,8 +95,6 @@ jobs:
9295
git config user.name "github-actions"
9396
git config user.email "[email protected]"
9497
95-
BR="memory/performance" # Use this branch to store performance results
96-
9798
python3 ci/metrics/save_results.py \
9899
--input results/complete_profile.csv \
99100
--output ci/metrics/memory/complete_profile_timeseries.csv
@@ -115,7 +116,7 @@ jobs:
115116
116117
git add ci/metrics/memory/*_timeseries.csv
117118
git diff --cached --quiet || git commit -m "metrics: append run ${GITHUB_RUN_NUMBER} (${GITHUB_SHA::8})"
118-
git push origin "${BR}"
119+
git push origin "${{ env.BR }}"
119120
120121
- name: Generate plots
121122
shell: bash
@@ -126,61 +127,60 @@ jobs:
126127
127128
python3 ci/metrics/generate_plot.py \
128129
--input ci/metrics/memory/complete_profile_timeseries.csv \
129-
--output plots/complete_profile_plot.svg \
130+
--output ci/metrics/plots/complete_profile_plot.svg \
130131
--title "Complete Profile" \
131132
--ylabel "Bytes" \
132133
--last "$LAST_N"
133134
python3 ci/metrics/generate_plot.py \
134135
--input ci/metrics/memory/core_profile_timeseries.csv \
135-
--output plots/core_profile_plot.svg \
136+
--output ci/metrics/plots/core_profile_plot.svg \
136137
--title "Core Profile" \
137138
--ylabel "Bytes" \
138139
--last "$LAST_N"
139140
python3 ci/metrics/generate_plot.py \
140141
--input ci/metrics/memory/stack_timeseries.csv \
141-
--output plots/stack_plot.svg \
142+
--output ci/metrics/plots/stack_plot.svg \
142143
--title "Simple App Stack Usage" \
143144
--ylabel "Bytes" \
144145
--last "$LAST_N"
145146
python3 ci/metrics/generate_plot.py \
146147
--input ci/metrics/memory/profiles_bss_timeseries.csv \
147-
--output plots/profiles_bss_plot.svg \
148+
--output ci/metrics/plots/profiles_bss_plot.svg \
148149
--title "Increase of .bss memory by enabling profiles" \
149150
--ylabel "Bytes" \
150151
--last "$LAST_N"
151152
python3 ci/metrics/generate_plot.py \
152153
--input ci/metrics/memory/profiles_data_timeseries.csv \
153-
--output plots/profiles_data_plot.svg \
154+
--output ci/metrics/plots/profiles_data_plot.svg \
154155
--title "Increase of .data memory by enabling profiles" \
155156
--ylabel "Bytes" \
156157
--last "$LAST_N"
157158
python3 ci/metrics/generate_plot.py \
158159
--input ci/metrics/memory/profiles_text_timeseries.csv \
159-
--output plots/profiles_text_plot.svg \
160+
--output ci/metrics/plots/profiles_text_plot.svg \
160161
--title "Increase of .text memory by enabling profiles" \
161162
--ylabel "Bytes" \
162163
--last "$LAST_N"
163164
165+
git add ci/metrics/plots/*.svg
166+
git diff --cached --quiet || git commit -m "metrics: update plots (${GITHUB_RUN_NUMBER})"
167+
git push origin "${{ env.BR }}"
168+
164169
- name: Upload plots
165170
uses: actions/upload-artifact@v4
166171
with:
167172
name: performance-plots
168-
path: plots/*.svg
173+
path: ci/metrics/plots/*.svg
169174
if-no-files-found: warn
170175

171176
- name: Add plots to summary
172177
if: always()
173178
shell: bash
174179
run: |
175180
set -euo pipefail
176-
b64() { base64 --wrap=0 "$1" 2>/dev/null || base64 -w0 "$1"; }
177-
178-
CPP=$(b64 plots/complete_profile_plot.svg)
179-
CORE=$(b64 plots/core_profile_plot.svg)
180-
STACK=$(b64 plots/stack_plot.svg)
181-
BSS=$(b64 plots/profiles_bss_plot.svg)
182-
DATA=$(b64 plots/profiles_data_plot.svg)
183-
TEXT=$(b64 plots/profiles_text_plot.svg)
181+
182+
BASE="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/memory/performance/ci/metrics/plots"
183+
CB="?r=${GITHUB_RUN_NUMBER}"
184184
185185
{
186186
echo "## 📊 Performance Metrics (last 52 runs)"
@@ -191,20 +191,20 @@ jobs:
191191
echo "The \`memory/performance\` branch is unprotected and can be pushed to in case any manual modifications are needed."
192192
echo
193193
echo "### Complete Profile"
194-
echo "<img src=\"data:image/svg+xml;base64,${CPP}\" alt=\"Complete Profile\" width=\"700\"/>"
194+
echo "<img src=\"${BASE}/complete_profile_plot.svg${CB}\" alt=\"Complete Profile\" width=\"720\"/>"
195195
echo
196196
echo "### Core Profile"
197-
echo "<img src=\"data:image/svg+xml;base64,${CORE}\" alt=\"Core Profile\" width=\"700\"/>"
197+
echo "<img src=\"${BASE}/core_profile_plot.svg${CB}\" alt=\"Core Profile\" width=\"720\"/>"
198198
echo
199199
echo "### Simple App Stack Usage"
200-
echo "<img src=\"data:image/svg+xml;base64,${STACK}\" alt=\"Stack\" width=\"700\"/>"
200+
echo "<img src=\"${BASE}/stack_plot.svg${CB}\" alt=\"Stack\" width=\"720\"/>"
201201
echo
202202
echo "### Increase of .bss memory by enabling profiles"
203-
echo "<img src=\"data:image/svg+xml;base64,${BSS}\" alt=\"bss\" width=\"700\"/>"
203+
echo "<img src=\"${BASE}/profiles_bss_plot.svg${CB}\" alt=\"bss\" width=\"720\"/>"
204204
echo
205205
echo "### Increase of .data memory by enabling profiles"
206-
echo "<img src=\"data:image/svg+xml;base64,${DATA}\" alt=\"data\" width=\"700\"/>"
206+
echo "<img src=\"${BASE}/profiles_data_plot.svg${CB}\" alt=\"data\" width=\"720\"/>"
207207
echo
208208
echo "### Increase of .text memory by enabling profiles"
209-
echo "<img src=\"data:image/svg+xml;base64,${TEXT}\" alt=\"text\" width=\"700\"/>"
209+
echo "<img src=\"${BASE}/profiles_text_plot.svg${CB}\" alt=\"text\" width=\"720\"/>"
210210
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)