Skip to content

Commit c7c38bb

Browse files
committed
Rename size-deltas-report-folder-name input to sketches-report-path
Now that the report is always generated and is used to transfer data to the reportsizetrends module, it's misleading for the input name to reference "deltas". The previous input name is still supported. It is now undocumented and a warning will be printed in the workflow log when it is used. Although no longer an accurate name, the previous default value is retained to avoid breaking workflows that use the default input value and then reference that path in the actions/upload-artifact step.
1 parent 79e6166 commit c7c38bb

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@ GitHub access token used to get information from the GitHub API. Only needed if
115115

116116
Name of the sketch used to compare memory usage change. Default `""`.
117117

118-
### `enable-size-deltas-report`
118+
### `sketches-report-path`
119119

120-
Set to `true` to cause the action to determine the change in memory usage for the [`size-reports-sketch`](#size-reports-sketch) between the pull request branch and the tip of the pull request's base branch. This may be used with the [`arduino/actions/libraries/report-size-deltas` action](https://github.com/arduino/actions/tree/master/libraries/report-size-deltas). Default `false`.
120+
Path in which to save a JSON formatted file containing data from the sketch compilations. Should be used only to store reports. Relative paths are relative to [`GITHUB_WORKSPACE`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables). The folder will be created if it doesn't already exist. This report is used by the `arduino/libraries/report-size-deltas` and `arduino/libraries/report-size-trends` actions. Default `"size-deltas-reports"`.
121121

122-
### `size-deltas-report-folder-name`
122+
### `enable-size-deltas-report`
123123

124+
Set to `true` to cause the action to determine the change in memory usage for the [`size-reports-sketch`](#size-reports-sketch) between the pull request branch and the tip of the pull request's base branch. This may be used with the [`arduino/actions/libraries/report-size-deltas` action](https://github.com/arduino/actions/tree/master/libraries/report-size-deltas). Default `false`.
124125

125126
### `enable-size-trends-report`
126127

@@ -176,7 +177,6 @@ The ID of the Google Sheets spreadsheet to write the memory usage trends data to
176177
### `size-trends-report-sheet-name`
177178

178179
The sheet name in the Google Sheets spreadsheet used for the memory usage trends report. Default `"Sheet1"`.
179-
Path in which to save a JSON formatted file containing data from the sketch compilations. Should be used only to store reports. Relative paths are relative to [`GITHUB_WORKSPACE`](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables). The folder will be created if it doesn't already exist. Default `"size-deltas-reports"`.
180180

181181
## Example usage
182182

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ inputs:
2525
size-report-sketch:
2626
description: 'Name of the sketch used to compare memory usage change'
2727
default: ''
28+
sketches-report-path:
29+
description: 'Path in which to save a JSON formatted file containing data from the sketch compilations'
30+
default: 'size-deltas-reports'
2831
enable-size-deltas-report:
2932
description: 'Set to true to cause the action to determine the change in memory usage for the size-reports-sketch'
3033
default: false
31-
size-deltas-report-folder-name:
32-
description: 'Folder to save the memory usage change report to'
33-
default: 'size-deltas-reports'
3434
enable-size-trends-report:
3535
description: 'Set to true to cause the action to record the memory usage of size-reports-sketch'
3636
default: false

compilesketches/compilesketches.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222

2323

2424
def main():
25+
if "INPUT_SIZE-DELTAS-REPORT-FOLDER-NAME" in os.environ:
26+
print("::warning::The size-deltas-report-folder-name input is deprecated. Use the equivalent input: "
27+
"sketches-report-path instead.")
28+
os.environ["INPUT_SKETCHES-REPORT-PATH"] = os.environ["INPUT_SIZE-DELTAS-REPORT-FOLDER-NAME"]
29+
2530
compile_sketches = CompileSketches(
2631
cli_version=os.environ["INPUT_CLI-VERSION"],
2732
fqbn_arg=os.environ["INPUT_FQBN"],
@@ -32,7 +37,7 @@ def main():
3237
github_token=os.environ["INPUT_GITHUB-TOKEN"],
3338
report_sketch=os.environ["INPUT_SIZE-REPORT-SKETCH"],
3439
enable_size_deltas_report=os.environ["INPUT_ENABLE-SIZE-DELTAS-REPORT"],
35-
sketches_report_path=os.environ["INPUT_SIZE-DELTAS-REPORT-FOLDER-NAME"],
40+
sketches_report_path=os.environ["INPUT_SKETCHES-REPORT-PATH"],
3641
enable_size_trends_report=os.environ["INPUT_ENABLE-SIZE-TRENDS-REPORT"],
3742
google_key_file=os.environ["INPUT_KEYFILE"],
3843
size_trends_report_spreadsheet_id=os.environ["INPUT_SIZE-TRENDS-REPORT-SPREADSHEET-ID"],

compilesketches/tests/test_compilesketches.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ def test_directories_are_same():
8080
) is False
8181

8282

83-
def test_main(monkeypatch, mocker):
83+
@pytest.mark.parametrize("use_size_deltas_report_folder_name, expected_sketches_report_path",
84+
[(True, "FooSizeDeltasReportFolderName"),
85+
(False, "FooSketchesReportPath")])
86+
def test_main(monkeypatch, mocker, use_size_deltas_report_folder_name, expected_sketches_report_path):
8487
cli_version = "1.0.0"
8588
fqbn_arg = "foo:bar:baz"
8689
platforms = "- name: FooVendor:BarArchitecture"
@@ -90,7 +93,8 @@ def test_main(monkeypatch, mocker):
9093
github_token = "FooGitHubToken"
9194
report_sketch = "FooReportSketch"
9295
enable_size_deltas_report = "true"
93-
sketches_report_path = "FooSizeDeltasReportFolderName"
96+
sketches_report_path = "FooSketchesReportPath"
97+
size_deltas_report_folder_name = "FooSizeDeltasReportFolderName"
9498
enable_size_trends_report = "true"
9599
google_key_file = "FooKeyfile"
96100
size_trends_report_spreadsheet_id = "FooSpreadsheetID"
@@ -109,7 +113,9 @@ def compile_sketches(self):
109113
monkeypatch.setenv("INPUT_VERBOSE", verbose)
110114
monkeypatch.setenv("INPUT_SIZE-REPORT-SKETCH", report_sketch)
111115
monkeypatch.setenv("INPUT_ENABLE-SIZE-DELTAS-REPORT", enable_size_deltas_report)
112-
monkeypatch.setenv("INPUT_SIZE-DELTAS-REPORT-FOLDER-NAME", sketches_report_path)
116+
monkeypatch.setenv("INPUT_SKETCHES-REPORT-PATH", sketches_report_path)
117+
if use_size_deltas_report_folder_name:
118+
monkeypatch.setenv("INPUT_SIZE-DELTAS-REPORT-FOLDER-NAME", size_deltas_report_folder_name)
113119
monkeypatch.setenv("INPUT_ENABLE-SIZE-TRENDS-REPORT", enable_size_trends_report)
114120
monkeypatch.setenv("INPUT_KEYFILE", google_key_file)
115121
monkeypatch.setenv("INPUT_SIZE-TRENDS-REPORT-SPREADSHEET-ID", size_trends_report_spreadsheet_id)
@@ -130,7 +136,7 @@ def compile_sketches(self):
130136
github_token=github_token,
131137
report_sketch=report_sketch,
132138
enable_size_deltas_report=enable_size_deltas_report,
133-
sketches_report_path=sketches_report_path,
139+
sketches_report_path=expected_sketches_report_path,
134140
enable_size_trends_report=enable_size_trends_report,
135141
google_key_file=google_key_file,
136142
size_trends_report_spreadsheet_id=size_trends_report_spreadsheet_id,

0 commit comments

Comments
 (0)