Skip to content

Commit 6efef4a

Browse files
4ntnEugenioCollado
authored andcommitted
Migrate CI from Jenkins to Github
Signed-off-by: Antón Casas <antoncasas@eprosima.com> Plot all columns Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add PR trigger for testing Signed-off-by: Antón Casas <antoncasas@eprosima.com> Single file approach Signed-off-by: Antón Casas <antoncasas@eprosima.com> Move python code to file Signed-off-by: Antón Casas <antoncasas@eprosima.com> Move into a two jobs paradigm Signed-off-by: Antón Casas <antoncasas@eprosima.com> Fix results path Signed-off-by: Antón Casas <antoncasas@eprosima.com> Fix dependencies Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add all csv Signed-off-by: Antón Casas <antoncasas@eprosima.com> Fix details up to save results into memory Signed-off-by: Antón Casas <antoncasas@eprosima.com> Move plot python code to file Signed-off-by: Antón Casas <antoncasas@eprosima.com> Remove python code Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add plots to summary Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add summary brief Signed-off-by: Antón Casas <antoncasas@eprosima.com> Switch to svg Signed-off-by: Antón Casas <antoncasas@eprosima.com> Save images Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add analysis of last two runs Signed-off-by: Antón Casas <antoncasas@eprosima.com> [Test] Fake memory difference This reverts commit 35b0b7e. Signed-off-by: Antón Casas <antoncasas@eprosima.com> Revert "[Test] Fake memory difference" This reverts commit b986669. Signed-off-by: Antón Casas <antoncasas@eprosima.com> Add summary introduction Signed-off-by: Antón Casas <antoncasas@eprosima.com> Final tweaks Signed-off-by: Antón Casas <antoncasas@eprosima.com>
1 parent 7781613 commit 6efef4a

2 files changed

Lines changed: 240 additions & 1 deletion

File tree

.github/workflows/performance.yml

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
name: Weekly Performance
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
workflow_dispatch:
8+
inputs:
9+
name:
10+
description: "Manual trigger"
11+
schedule:
12+
- cron: '12 13 * * 0'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
performance:
19+
name: Performance
20+
runs-on: ubuntu-24.04
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
ref: ${{ github.ref }}
28+
29+
- name: Install CMake and prerequisites
30+
shell: bash
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y build-essential curl python3-pip valgrind
34+
python3 -m pip install --upgrade pip
35+
python3 -m pip install msparser
36+
37+
# CMake 3.31.8
38+
CMAKE_VER=3.31.8
39+
curl -L "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz" -o cmake-${CMAKE_VER}.tgz
40+
sudo tar -C /opt -xzf cmake-${CMAKE_VER}.tgz
41+
echo "/opt/cmake-${CMAKE_VER}-linux-x86_64/bin" >> "$GITHUB_PATH"
42+
43+
- name: Run tests
44+
shell: bash
45+
run: |
46+
./test/memory/memory_test.sh
47+
48+
- name: Upload artifacts
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: performance-results
52+
path: |
53+
build/complete_profile.csv
54+
build/core_profile.csv
55+
build/stack.csv
56+
build/profiles_bss.csv
57+
build/profiles_data.csv
58+
build/profiles_text.csv
59+
if-no-files-found: error
60+
61+
save-metrics-and-plots:
62+
name: Save Metrics and Generate Plots
63+
runs-on: ubuntu-24.04
64+
needs: performance
65+
66+
steps:
67+
- name: Set branch name
68+
run: echo "BR=memory/performance" >> $GITHUB_ENV # Use this branch to store performance results
69+
70+
- name: Checkout
71+
uses: actions/checkout@v5
72+
with:
73+
fetch-depth: 0
74+
ref: ${{ env.BR }}
75+
76+
- name: Install Python and prerequisites
77+
shell: bash
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y python3-pip
81+
python3 -m pip install --upgrade pip
82+
python3 -m pip install matplotlib
83+
84+
- name: Download artifacts
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: performance-results
88+
path: results
89+
90+
- name: Save results into memory
91+
shell: bash
92+
run: |
93+
set -euxo pipefail
94+
95+
git config user.name "github-actions"
96+
git config user.email "github-actions@github.com"
97+
98+
python3 ci/metrics/save_results.py \
99+
--input results/complete_profile.csv \
100+
--output ci/metrics/memory/complete_profile_timeseries.csv
101+
python3 ci/metrics/save_results.py \
102+
--input results/core_profile.csv \
103+
--output ci/metrics/memory/core_profile_timeseries.csv
104+
python3 ci/metrics/save_results.py \
105+
--input results/stack.csv \
106+
--output ci/metrics/memory/stack_timeseries.csv
107+
python3 ci/metrics/save_results.py \
108+
--input results/profiles_bss.csv \
109+
--output ci/metrics/memory/profiles_bss_timeseries.csv
110+
python3 ci/metrics/save_results.py \
111+
--input results/profiles_data.csv \
112+
--output ci/metrics/memory/profiles_data_timeseries.csv
113+
python3 ci/metrics/save_results.py \
114+
--input results/profiles_text.csv \
115+
--output ci/metrics/memory/profiles_text_timeseries.csv
116+
117+
git add ci/metrics/memory/*_timeseries.csv
118+
git diff --cached --quiet || git commit -m "metrics: append run ${GITHUB_RUN_NUMBER} (${GITHUB_SHA::8})"
119+
git push origin "${{ env.BR }}"
120+
121+
- name: Generate plots
122+
shell: bash
123+
run: |
124+
set -euxo pipefail
125+
126+
LAST_N=52
127+
128+
python3 ci/metrics/generate_plot.py \
129+
--input ci/metrics/memory/complete_profile_timeseries.csv \
130+
--output ci/metrics/plots/complete_profile_plot.svg \
131+
--title "Complete Profile" \
132+
--ylabel "Bytes" \
133+
--last "$LAST_N"
134+
python3 ci/metrics/generate_plot.py \
135+
--input ci/metrics/memory/core_profile_timeseries.csv \
136+
--output ci/metrics/plots/core_profile_plot.svg \
137+
--title "Core Profile" \
138+
--ylabel "Bytes" \
139+
--last "$LAST_N"
140+
python3 ci/metrics/generate_plot.py \
141+
--input ci/metrics/memory/stack_timeseries.csv \
142+
--output ci/metrics/plots/stack_plot.svg \
143+
--title "Simple App Stack Usage" \
144+
--ylabel "Bytes" \
145+
--last "$LAST_N"
146+
python3 ci/metrics/generate_plot.py \
147+
--input ci/metrics/memory/profiles_bss_timeseries.csv \
148+
--output ci/metrics/plots/profiles_bss_plot.svg \
149+
--title "Increase of .bss memory by enabling profiles" \
150+
--ylabel "Bytes" \
151+
--last "$LAST_N"
152+
python3 ci/metrics/generate_plot.py \
153+
--input ci/metrics/memory/profiles_data_timeseries.csv \
154+
--output ci/metrics/plots/profiles_data_plot.svg \
155+
--title "Increase of .data memory by enabling profiles" \
156+
--ylabel "Bytes" \
157+
--last "$LAST_N"
158+
python3 ci/metrics/generate_plot.py \
159+
--input ci/metrics/memory/profiles_text_timeseries.csv \
160+
--output ci/metrics/plots/profiles_text_plot.svg \
161+
--title "Increase of .text memory by enabling profiles" \
162+
--ylabel "Bytes" \
163+
--last "$LAST_N"
164+
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+
169+
- name: Upload plots
170+
uses: actions/upload-artifact@v4
171+
with:
172+
name: performance-plots
173+
path: ci/metrics/plots/*.svg
174+
if-no-files-found: warn
175+
176+
- name: Add plots to summary
177+
if: always()
178+
shell: bash
179+
run: |
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+
185+
{
186+
echo "## 📊 Performance Metrics (last 52 runs)"
187+
echo
188+
echo "The workflow triggering this run can be found in the default branch."
189+
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."
190+
echo "The scripts and data can be modified without affecting develop nor master branches."
191+
echo "The \`memory/performance\` branch is unprotected and can be pushed to in case any manual modifications are needed."
192+
echo
193+
echo "### Complete Profile"
194+
echo "<img src=\"${BASE}/complete_profile_plot.svg${CB}\" alt=\"Complete Profile\" width=\"720\"/>"
195+
echo
196+
echo "### Core Profile"
197+
echo "<img src=\"${BASE}/core_profile_plot.svg${CB}\" alt=\"Core Profile\" width=\"720\"/>"
198+
echo
199+
echo "### Simple App Stack Usage"
200+
echo "<img src=\"${BASE}/stack_plot.svg${CB}\" alt=\"Stack\" width=\"720\"/>"
201+
echo
202+
echo "### Increase of .bss memory by enabling profiles"
203+
echo "<img src=\"${BASE}/profiles_bss_plot.svg${CB}\" alt=\"bss\" width=\"720\"/>"
204+
echo
205+
echo "### Increase of .data memory by enabling profiles"
206+
echo "<img src=\"${BASE}/profiles_data_plot.svg${CB}\" alt=\"data\" width=\"720\"/>"
207+
echo
208+
echo "### Increase of .text memory by enabling profiles"
209+
echo "<img src=\"${BASE}/profiles_text_plot.svg${CB}\" alt=\"text\" width=\"720\"/>"
210+
} >> "$GITHUB_STEP_SUMMARY"
211+
212+
analyze-metrics:
213+
name: Analyze Metrics
214+
runs-on: ubuntu-24.04
215+
needs: save-metrics-and-plots
216+
217+
steps:
218+
- name: Checkout
219+
uses: actions/checkout@v5
220+
with:
221+
fetch-depth: 0
222+
ref: memory/performance
223+
224+
- name: Analyze results
225+
shell: bash
226+
run: |
227+
set -euo pipefail
228+
229+
{
230+
echo "## Analyze Memory Metrics"
231+
echo
232+
echo "⚠️ Failure of this job should be treated as a warning. It can be safely ignored if there are intentional changes that affect memory usage."
233+
} >> "$GITHUB_STEP_SUMMARY"
234+
235+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/complete_profile_timeseries.csv
236+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/core_profile_timeseries.csv
237+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/stack_timeseries.csv
238+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_bss_timeseries.csv
239+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_data_timeseries.csv
240+
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_text_timeseries.csv

test/memory/consumption/stack_analysis.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@
1212
csv_writer = csv.writer(csv_file, delimiter=',', quoting=csv.QUOTE_ALL)
1313
csv_writer.writerow(['stack'])
1414
csv_writer.writerow([max(stack)])
15-

0 commit comments

Comments
 (0)