Skip to content

Commit 2add5ee

Browse files
committed
Save images
Signed-off-by: Antón Casas <antoncasas@eprosima.com>
1 parent f9ace95 commit 2add5ee

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

.github/workflows/performance.yml

Lines changed: 28 additions & 20 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 "github-actions@github.com"
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,77 +127,84 @@ 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: |
175-
b64() { base64 --wrap=0 "$1" 2>/dev/null || base64 -w0 "$1"; }
176-
CPP=$(b64 plots/complete_profile_plot.svg)
180+
set -euo pipefail
181+
182+
BASE="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/memory/performance/ci/metrics/plots"
183+
CB="?r=${GITHUB_RUN_NUMBER}"
184+
177185
{
178186
echo "## 📊 Performance Metrics (last 52 runs)"
179187
echo
180188
echo "The workflow triggering this run can be found in the default branch."
181189
echo "The python scripts and the data used to generate these plots can be found in the [memory/performance](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/memory/performance) branch."
182190
echo "The scripts and data can be modified without affecting develop nor master branches."
183-
echo "memory/performance branch is unprotected and can be pushed to in case any manual modifications are needed."
191+
echo "The \`memory/performance\` branch is unprotected and can be pushed to in case any manual modifications are needed."
184192
echo
185193
echo "### Complete Profile"
186-
echo "![Complete Profile](data:image/svg;base64,${CPP})"
194+
echo "<img src=\"${BASE}/complete_profile_plot.svg${CB}\" alt=\"Complete Profile\" width=\"720\"/>"
187195
echo
188196
echo "### Core Profile"
189-
echo "![Core Profile](./plots/core_profile_plot.svg)"
197+
echo "<img src=\"${BASE}/core_profile_plot.svg${CB}\" alt=\"Core Profile\" width=\"720\"/>"
190198
echo
191199
echo "### Simple App Stack Usage"
192-
echo "![Stack](./plots/stack_plot.svg)"
200+
echo "<img src=\"${BASE}/stack_plot.svg${CB}\" alt=\"Stack\" width=\"720\"/>"
193201
echo
194202
echo "### Increase of .bss memory by enabling profiles"
195-
echo "![.bss Profiles](./plots/profiles_bss_plot.svg)"
203+
echo "<img src=\"${BASE}/profiles_bss_plot.svg${CB}\" alt=\"bss\" width=\"720\"/>"
196204
echo
197205
echo "### Increase of .data memory by enabling profiles"
198-
echo "![.data Profiles](./plots/profiles_data_plot.svg)"
206+
echo "<img src=\"${BASE}/profiles_data_plot.svg${CB}\" alt=\"data\" width=\"720\"/>"
199207
echo
200208
echo "### Increase of .text memory by enabling profiles"
201-
echo "![.text Profiles](./plots/profiles_text_plot.svg)"
209+
echo "<img src=\"${BASE}/profiles_text_plot.svg${CB}\" alt=\"text\" width=\"720\"/>"
202210
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)