arduino / compile-sketches

GitHub Actions action that checks whether Arduino sketches compile and produces a report of data from the compilations
GNU General Public License v3.0
69 stars 13 forks source link

Could not access include Directiory #330

Closed hasenradball closed 22 hours ago

hasenradball commented 22 hours ago

Describe the problem

Hi dear Arduino Team,

I want to add a include directory for a arduino compile sketch workflow file. workflow file

I want to make the include directory available for the search path for includes to be able to use #include ”wifi_secrets.h”

How can I add this in the workflow file?

To reproduce

see workflow which is linked.

Expected behavior

the include directory include can be used.

'arduino/compile-sketches' version

latest

Additional context

No response

Issue checklist

per1234 commented 22 hours ago

Hi @hasenradball. You were somewhat close to getting it at one point (https://github.com/hasenradball/ESP32-C3-Examples/commit/8164f1044a9efb99df567c07ce57af38a89be517). You will find it more productive to study the documentation for the action instead of inventing syntax at random.

As you maybe guessed at one point during your development of the workflow, you can accomplish your goal by using the action's cli-compile-flags input. I submitted the necessary change here:

https://github.com/hasenradball/ESP32-C3-Examples/pull/1

--- a/.github/workflows/compile_examples.yml
+++ b/.github/workflows/compile_examples.yml
@@ -39,5 +39,6 @@ jobs:
             ./examples/wifiTest/wifiTest.ino
             ./examples/readAM2302-Sensor/readAM2302-Sensor.ino
             ./examples/timerInterrupt/timerInterrupt.ino
-          build-property: |
-            build.extra_flags="-I ${{ github.workspace }}/include"
+          cli-compile-flags: |
+            - --library
+            - "${{ github.workspace }}/include"

However, I think you should consider whether this is the correct approach. If you intend this project to be useful to the Arduino community, consider how much difficulty they might have getting those sketches to compile. Do you think every one of them should have to compile the sketches using Arduino CLI with a special flag? Or do you only intend for the project to be used with PlatformIO? If so, you would be better off using PlatformIO in your workflow instead of this action.

hasenradball commented 21 hours ago

Hi @per1234 Thanks si much for your comment. This is actually used for PIO, so thats a good point you mentioned. Did you have a example for a pio workflow in mind. Haven‘ t seen actually one for PIO.

Thank you for your Support!