arduino-libraries / Arduino_UnifiedStorage

Read and write files to flash, USB mass storage and SD cards in a unified way.
GNU Lesser General Public License v2.1
11 stars 3 forks source link

[AE-181] Add `check-release-version.yml` workflow #28

Closed aliphys closed 7 months ago

aliphys commented 7 months ago

This PR adds a new GitHub workflow to check the releases:

github-actions[bot] commented 7 months ago

Memory usage change @ 64d2ef014fa02f9acef8ab8974813a85802872fe

Board flash % RAM for global variables %
arduino:mbed_opta:opta 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|`extras/tests/TestExisting`
flash|%|`extras/tests/TestExisting`
RAM for global variables|%|`extras/tests/TestFileOperations`
flash|%|`extras/tests/TestFileOperations`
RAM for global variables|%|`extras/tests/TestFolderOperations`
flash|%|`extras/tests/TestFolderOperations`
RAM for global variables|%|`extras/tests/TestRepeatedFormatMount`
flash|%|`extras/tests/TestRepeatedFormatMount`
RAM for global variables|%|`examples/SimpleStorageWriteRead`
flash|%|`examples/SimpleStorageWriteRead`
RAM for global variables|%|`examples/AdvancedUSBInternalOperations`
flash|%|`examples/AdvancedUSBInternalOperations`
RAM for global variables|%|`examples/BackupInternalPartitions`
flash|%|`examples/BackupInternalPartitions`
RAM for global variables|% -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- `arduino:mbed_opta:opta`|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_portenta:envie_m7`|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A `arduino:renesas_portenta:portenta_c33`|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0
Click for full report CSV ``` Board,extras/tests/TestExisting
flash,%,extras/tests/TestExisting
RAM for global variables,%,extras/tests/TestFileOperations
flash,%,extras/tests/TestFileOperations
RAM for global variables,%,extras/tests/TestFolderOperations
flash,%,extras/tests/TestFolderOperations
RAM for global variables,%,extras/tests/TestRepeatedFormatMount
flash,%,extras/tests/TestRepeatedFormatMount
RAM for global variables,%,examples/SimpleStorageWriteRead
flash,%,examples/SimpleStorageWriteRead
RAM for global variables,%,examples/AdvancedUSBInternalOperations
flash,%,examples/AdvancedUSBInternalOperations
RAM for global variables,%,examples/BackupInternalPartitions
flash,%,examples/BackupInternalPartitions
RAM for global variables,% arduino:mbed_opta:opta,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A arduino:renesas_portenta:portenta_c33,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 ```
sebromero commented 7 months ago

Really good feedback @per1234 ! About the documentation part, we're working on a guideline on library development that comes with a chapter about release. @aliphys Can you take a look at Per's suggestions? I agree with his comments. Also, what if we create 3 manual GH actions that bump the version number in the properties file and creates a tag based on that version. One action for a major release, one for minor, one for patch. @per1234 Do you agree that this could be useful?

sebromero commented 7 months ago

I was thinking a bit and maybe it might be better to check the tags and not the releases because eventually the releases are based on the tags. So on each push we could retrieve the "latest" tag (need to figure out how) and then check the version in the library.properties file for the commit which was tagged with said version. If there is a mismatch, fail the build. This would be independent of releases and would fail, whenever someone tags a commit without bumping the number in the properties file.

per1234 commented 7 months ago

what if we create 3 manual GH actions that bump the version number in the properties file and creates a tag based on that version. One action for a major release, one for minor, one for patch. @per1234 Do you agree that this could be useful?

I think the idea of a GitHub Actions workflow that is manually triggered to take all actions required to produce a perfect release is a good idea.

I would recommend starting from a single workflow and then only split it into multiple workflows if you find that there is a significant amount of completely divergent code for each release type and overhead for switching between them.

You can use the inputs feature of the workflow_dispatch trigger event to allow the maintainer to provide inputs when triggering a run of the workflow:

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#providing-inputs

So you could add a radio button for which release type to make and an optional text field for specifying a commit hash for the tag (in case some of the staged work is not yet ready for release). That would allow a single workflow to be used for any type of release.

it might be better to check the tags and not the releases because eventually the releases are based on the tags

Definitely. It is common for maintainers to push a tag without ever creating a GitHub release to go with it. The Library Manager engine works exclusively from tags, so it will attempt to index a new tag even if the maintainer didn't create a GitHub release for the tag.

we could retrieve the "latest" tag (need to figure out how)

GitHub Actions provides it via github.ref_name (meaning it isn't even necessary to do an API request):

https://docs.github.com/en/actions/learn-github-actions/contexts#github-context:~:text=The%20short%20ref%20name%20of%20the%20branch%20or%20tag%20that%20triggered%20the%20workflow%20run

github-actions[bot] commented 7 months ago

Memory usage change @ 748693f48005df202eab6eb351aa10c3ab3804d2

Board flash % RAM for global variables %
arduino:mbed_opta:opta 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 0 - 0 0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|`extras/tests/TestExisting`
flash|%|`extras/tests/TestExisting`
RAM for global variables|%|`extras/tests/TestFileOperations`
flash|%|`extras/tests/TestFileOperations`
RAM for global variables|%|`extras/tests/TestFolderOperations`
flash|%|`extras/tests/TestFolderOperations`
RAM for global variables|%|`extras/tests/TestRepeatedFormatMount`
flash|%|`extras/tests/TestRepeatedFormatMount`
RAM for global variables|%|`examples/SimpleStorageWriteRead`
flash|%|`examples/SimpleStorageWriteRead`
RAM for global variables|%|`examples/AdvancedUSBInternalOperations`
flash|%|`examples/AdvancedUSBInternalOperations`
RAM for global variables|%|`examples/BackupInternalPartitions`
flash|%|`examples/BackupInternalPartitions`
RAM for global variables|% -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- `arduino:mbed_opta:opta`|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_portenta:envie_m7`|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A `arduino:renesas_portenta:portenta_c33`|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0
Click for full report CSV ``` Board,extras/tests/TestExisting
flash,%,extras/tests/TestExisting
RAM for global variables,%,extras/tests/TestFileOperations
flash,%,extras/tests/TestFileOperations
RAM for global variables,%,extras/tests/TestFolderOperations
flash,%,extras/tests/TestFolderOperations
RAM for global variables,%,extras/tests/TestRepeatedFormatMount
flash,%,extras/tests/TestRepeatedFormatMount
RAM for global variables,%,examples/SimpleStorageWriteRead
flash,%,examples/SimpleStorageWriteRead
RAM for global variables,%,examples/AdvancedUSBInternalOperations
flash,%,examples/AdvancedUSBInternalOperations
RAM for global variables,%,examples/BackupInternalPartitions
flash,%,examples/BackupInternalPartitions
RAM for global variables,% arduino:mbed_opta:opta,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A arduino:renesas_portenta:portenta_c33,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 ```
aliphys commented 7 months ago

I will close this PR for the following reasons:

An alternative solution is to check to see if the version key corresponds to the latest tagged release or later. This would cause subsequent builds to fail until a re-release(/re-tag) is made.