compile-sketches icon indicating copy to clipboard operation
compile-sketches copied to clipboard

Automatic Library Installation from `depends` field in `library.properties`

Open aliphys opened this issue 2 years ago โ€ข 4 comments
trafficstars

This PR addresses the limitation described by @per1234 in https://github.com/arduino-libraries/Arduino_UnifiedStorage/pull/30#pullrequestreview-1737436096

The addition of such a capability, where the action parses the library.properties file and then automatically installs the libraries found there, has been proposed but the feature was not implemented so far.

Currently, the compile-sketches action is unable to read dependancies from the depends field. I have documented this issue in https://github.com/arduino/compile-sketches/issues/204 .

  • ๐Ÿ” Identify if library.properties is included in the sketch directory
  • โ›๏ธ Extract the library names from the depends key using re (limitation: only with ',' deliminator)
  • ๐Ÿ”ง Modified install_libraries_from_library_manager() function to install identified libraries
  • ๐ŸŽ‰ With this PR, there should be no need to seperately specify libraries in the workflow .yml file cc @sebromero

aliphys avatar Nov 18 '23 12:11 aliphys

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (0e82bd5) 99.81% compared to head (1ec0bae) 99.75%.

Files Patch % Lines
compilesketches/compilesketches.py 94.44% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
- Coverage   99.81%   99.75%   -0.06%     
==========================================
  Files           2        2              
  Lines        1608     1665      +57     
==========================================
+ Hits         1605     1661      +56     
- Misses          3        4       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Nov 18 '23 12:11 codecov-commenter

@per1234 Can you approve this PR?

aliphys avatar Dec 06 '23 09:12 aliphys

  • ๐Ÿงช Added unit tests
    • For get_dependencies_from_properties_file -> test_get_dependencies_from_properties_file_with_dependencies, test_get_dependencies_from_properties_file_without_dependencies and test_get_dependencies_from_properties_file_no_depends_key
    • For get_library_dependencies -> test_get_library_dependencies_with_properties_file and test_get_library_dependencies_without_properties_file
  • โœ… Linter and Formatting Approved by workflow

aliphys avatar Feb 06 '24 13:02 aliphys

There is an error in one workflow, which I don't think is related to this PR.

[2024-02-06T13:41:02.366Z] ['error'] There was an error running the uploader: Error uploading to [https://codecov.io:](https://codecov.io/) Error: There was an error fetching the storage URL during POST: 503 - upstream connect error or disconnect/reset before headers. reset reason: connection failure
Error: Codecov: Failed to properly upload: The process '/home/runner/work/_actions/codecov/codecov-action/v3/dist/codecov' failed with exit code 255

aliphys avatar Feb 06 '24 13:02 aliphys