arduino / actions

Collection of custom Github actions
Other
34 stars 6 forks source link

libraries/compile-examples: move reportsizetrends code into separate action #53

Closed per1234 closed 4 years ago

per1234 commented 4 years ago

This makes maintenance of the compile-examples action a little easier and also makes the documentation more friendly to the users who don't have a need for the size trends report feature.

The sketches report file is used to pass the size data between the compile-examples and report-size-trends actions.


Now that the report is used to transfer data to the report-size-trends action, it's misleading for the report path input name to reference "deltas".

The previous input name (size-deltas-report-folder-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 (size-deltas-reports) is retained to avoid breaking workflows that use the default input value and then reference that path in an actions/upload-artifact step.


It is now the responsibility of the user to provide the logic regarding when the size trends report should be made. Previously, the action only submitted the size trends report on a push to the default branch. Allowing the user to determine when the report should be made makes the action more flexible.

If the default branch of the repository running the workflow is named master, the previous behavior may be achieved by adding this if conditional to the report-size-trends step of the workflow:

if: github.event_name == 'push' && github.ref == 'refs/heads/master'

Demonstration of the report-size-trends action

Existing ArduinoIoTCloud workflow running the version of the compile-examples action from this PR to show backwards compatibility

https://github.com/per1234/ArduinoIoTCloud/actions/runs/106831854


Although the compilation testing and report file creation will still work as usual, this is a breaking change for anyone using the size trends feature of the compile-examples action in that the workflow will no longer submit the size trends report. A warning is displayed in the log and on the Actions workflow page for workflows that use the compile-examples action's old size trends API:

::warning::The size trends report feature has been moved to a dedicated action. See the documentation at https://github.com/arduino/actions/tree/report-size-trends-action/libraries/report-size-trends

The compile-examples step of a workflow using the old API to create a size trends report might look like this:

- uses: arduino/actions/libraries/compile-examples@master
  with:
    size-report-sketch: Foobar
    enable-size-trends-report: true
    keyfile: ${{ secrets.GOOGLE_KEY_FILE }}
    size-trends-report-spreadsheet-id: 15WOp3vp-6AnTnWlNWaNWNl61Fe_j8UJhIKE0rVdV-7U
    size-trends-report-sheet-name: trends

The equivalent workflow steps after this change:

- uses: arduino/actions/libraries/compile-examples@master
  with:
    size-report-sketch: Foobar
- uses: arduino/actions/libraries/report-size-trends@master
  if: github.event_name == 'push' && github.ref == 'refs/heads/master'
  with:
    google-key-file: ${{ secrets.GOOGLE_KEY_FILE }}
    spreadsheet-id: 15WOp3vp-6AnTnWlNWaNWNl61Fe_j8UJhIKE0rVdV-7U
    sheet-name: trends