Skip to content

Commit 2251c6c

Browse files
committed
Add pattern matching support for sketches report artifact names
Background ---------- The action was originally designed for a use case where there will only be a single sketches reports workflow artifact. At that time, this was possible even in cases where a job matrix was used to generate multiple parallel jobs to compile a set of sketches for an array of boards because the "actions/upload-artifact" GitHub Actions action allowed a single artifact to be uploaded to multiple times (one upload for the sketches report file of each of the matrix jobs). Uploading multiple times to a single artifact is prohibited starting from the recently released version 4.0.0 of the "actions/upload-artifact" action. It now becomes necessary for each of the sketch compilation jobs to produce a separate artifact, and for the "arduino/report-size-deltas" action to be able to consume the reports from multiple artifacts. Changes ------- Artifact Name Pattern Support ----------------------------- The most convenient way for the user to configure the action to identify the artifacts containing sketches reports is through an artifact name matching pattern. This will allow the user to avoid the need to maintain a list of explicit artifact names in the "arduino/report-size-deltas" workflow that can change over time as coverage for various boards is added to the sketch compilation workflow. The pattern is set via the action's `sketches-reports-source` input. NOTE: pattern support is only added for the use case where the action is ran from a scheduled workflow and the action's `sketches-reports-source` input is defining the artifact names to download. In the use case where the user is running the "arduino/report-size-deltas" action from the same workflow that does the sketch compilations, the action's `sketches-reports-source` input continues to be used to define the explicit path to the folder that contains the sketches report files. Pattern support was not added in this use case because there is no need for or benefit from such a feature. Recursive Sketches Reports Path Processing ------------------------------------------ In the use case where the user is running the "arduino/report-size-deltas" action from the same workflow that does the sketch compilations, the action's `sketches-reports-source` input is used to define the path to the folder that contains the sketches report files. In the common use pattern where workflow artifacts are used to transfer the sketches report files from a job matrix that compiles the sketches for multiple boards to the job with the `arduino/report-size-deltas` step, the "actions/download-artifact" action will be used to download the artifacts into the runner workspace, using that action's artifact name pattern matching capability. By default, the artifacts will each be downloaded to a dedicated folder under the folder specified via the "actions/download-artifact" action's `path` input. For this reason, it will be convenient for the "arduino/report-size-deltas" action to collect sketches reports recursively from each of the subfolders of the folder specified via the `sketches-reports-source` input. The "actions/download-artifact" action does provide a `merge-multiple` input that could be used to change that action's behavior to putting all the files in the root of the folder specified via its `path` input. However, requiring this of the "arduino/report-size-deltas" action users is less friendly, and is actually technically inferior in that it introduces the possibility of a filename collision in the event multiple artifacts contain a report file of the same name (as would occur if the sketch compilation job matrix was configured to use the same FQBN in multiple jobs). Backwards Compatibility ----------------------- Backwards compatibility for existing workflow is retained because the explicit artifact name in the `sketches-reports-source` input will also serve as a pattern to match the single artifact. If the user wants to update the "actions/upload-artifact" action in their sketch compilation workflow, and that workflow uploads multiple times to the same artifact, they will need to migrate the sketch compilation workflow to the new system, and might also update the "arduino/report-size-deltas" action's `sketches-reports-source` input to reflect that change, but that is a breaking change imposed by the "actions/upload-artifact" action bump, not by the "arduino/report-size-deltas" action bump.
1 parent 761a650 commit 2251c6c

File tree

32 files changed

+2707
-129
lines changed

32 files changed

+2707
-129
lines changed

.github/workflows/test-integration.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ jobs:
2828
permissions:
2929
pull-requests: write
3030

31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
test-data:
35+
- multiple-folders
36+
- single-folder
37+
3138
steps:
3239
- name: Checkout repository
3340
uses: actions/checkout@v4
@@ -46,7 +53,7 @@ jobs:
4653
github.triggering_actor == 'dependabot[bot]'
4754
}}
4855
with:
49-
sketches-reports-source: .github/workflows/testdata/sketches-reports
56+
sketches-reports-source: .github/workflows/testdata/local-source/${{ matrix.test-data }}
5057

5158
artifact-source:
5259
if: github.event_name != 'pull_request'
@@ -65,3 +72,5 @@ jobs:
6572
continue-on-error: ${{ github.triggering_actor == 'dependabot[bot]' }}
6673
# Use arduino/report-size-deltas action from local path
6774
uses: ./
75+
with:
76+
sketches-reports-source: ^sketches-report-.+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
{
2+
"commit_hash": "0123456789abcdef0123456789abcdef01234567",
3+
"commit_url": "https://github.com/per1234/generate-size-deltas-report/commit/651f05f4d4aca30ac359e972c01568f873112d43",
4+
"boards": [
5+
{
6+
"board": "arduino:avr:leonardo",
7+
"sketches": [
8+
{
9+
"name": "examples/MIDIUSB_clock",
10+
"compilation_success": true,
11+
"sizes": [
12+
{
13+
"name": "flash",
14+
"maximum": 28672,
15+
"current": {
16+
"absolute": 4792,
17+
"relative": 16.71
18+
},
19+
"previous": {
20+
"absolute": 4792,
21+
"relative": 16.71
22+
},
23+
"delta": {
24+
"absolute": 0,
25+
"relative": 0.0
26+
}
27+
},
28+
{
29+
"name": "RAM for global variables",
30+
"maximum": 2560,
31+
"current": {
32+
"absolute": 443,
33+
"relative": 17.3
34+
},
35+
"previous": {
36+
"absolute": 443,
37+
"relative": 17.3
38+
},
39+
"delta": {
40+
"absolute": 0,
41+
"relative": 0.0
42+
}
43+
}
44+
],
45+
"warnings": {
46+
"current": {
47+
"absolute": 2
48+
},
49+
"previous": {
50+
"absolute": 2
51+
},
52+
"delta": {
53+
"absolute": 0
54+
}
55+
}
56+
},
57+
{
58+
"name": "examples/MIDIUSB_loop",
59+
"compilation_success": true,
60+
"sizes": [
61+
{
62+
"name": "flash",
63+
"maximum": 28672,
64+
"current": {
65+
"absolute": 4870,
66+
"relative": 16.99
67+
},
68+
"previous": {
69+
"absolute": 4870,
70+
"relative": 16.99
71+
},
72+
"delta": {
73+
"absolute": 0,
74+
"relative": 0.0
75+
}
76+
},
77+
{
78+
"name": "RAM for global variables",
79+
"maximum": 2560,
80+
"current": {
81+
"absolute": 441,
82+
"relative": 17.23
83+
},
84+
"previous": {
85+
"absolute": 441,
86+
"relative": 17.23
87+
},
88+
"delta": {
89+
"absolute": 0,
90+
"relative": 0.0
91+
}
92+
}
93+
],
94+
"warnings": {
95+
"current": {
96+
"absolute": 3
97+
},
98+
"previous": {
99+
"absolute": 3
100+
},
101+
"delta": {
102+
"absolute": 0
103+
}
104+
}
105+
},
106+
{
107+
"name": "examples/MIDIUSB_read",
108+
"compilation_success": true,
109+
"sizes": [
110+
{
111+
"name": "flash",
112+
"maximum": 28672,
113+
"current": {
114+
"absolute": 4908,
115+
"relative": 17.12
116+
},
117+
"previous": {
118+
"absolute": 4908,
119+
"relative": 17.12
120+
},
121+
"delta": {
122+
"absolute": 0,
123+
"relative": 0.0
124+
}
125+
},
126+
{
127+
"name": "RAM for global variables",
128+
"maximum": 2560,
129+
"current": {
130+
"absolute": 457,
131+
"relative": 17.85
132+
},
133+
"previous": {
134+
"absolute": 457,
135+
"relative": 17.85
136+
},
137+
"delta": {
138+
"absolute": 0,
139+
"relative": 0.0
140+
}
141+
}
142+
],
143+
"warnings": {
144+
"current": {
145+
"absolute": 3
146+
},
147+
"previous": {
148+
"absolute": 3
149+
},
150+
"delta": {
151+
"absolute": 0
152+
}
153+
}
154+
},
155+
{
156+
"name": "examples/MIDIUSB_write",
157+
"compilation_success": true,
158+
"sizes": [
159+
{
160+
"name": "flash",
161+
"maximum": 28672,
162+
"current": {
163+
"absolute": 4524,
164+
"relative": 15.78
165+
},
166+
"previous": {
167+
"absolute": 4564,
168+
"relative": 15.92
169+
},
170+
"delta": {
171+
"absolute": -40,
172+
"relative": -0.14
173+
}
174+
},
175+
{
176+
"name": "RAM for global variables",
177+
"maximum": 2560,
178+
"current": {
179+
"absolute": 197,
180+
"relative": 7.7
181+
},
182+
"previous": {
183+
"absolute": 213,
184+
"relative": 8.32
185+
},
186+
"delta": {
187+
"absolute": -16,
188+
"relative": -0.62
189+
}
190+
}
191+
],
192+
"warnings": {
193+
"current": {
194+
"absolute": 3
195+
},
196+
"previous": {
197+
"absolute": 3
198+
},
199+
"delta": {
200+
"absolute": 0
201+
}
202+
}
203+
}
204+
],
205+
"sizes": [
206+
{
207+
"name": "flash",
208+
"maximum": 28672,
209+
"delta": {
210+
"absolute": {
211+
"minimum": -40,
212+
"maximum": 0
213+
},
214+
"relative": {
215+
"minimum": -0.14,
216+
"maximum": 0.0
217+
}
218+
}
219+
},
220+
{
221+
"name": "RAM for global variables",
222+
"maximum": 2560,
223+
"delta": {
224+
"absolute": {
225+
"minimum": -16,
226+
"maximum": 0
227+
},
228+
"relative": {
229+
"minimum": -0.62,
230+
"maximum": 0.0
231+
}
232+
}
233+
}
234+
],
235+
"warnings": {
236+
"delta": {
237+
"absolute": {
238+
"minimum": 0,
239+
"maximum": 0
240+
}
241+
}
242+
}
243+
}
244+
]
245+
}

0 commit comments

Comments
 (0)