arduino-libraries / ArduinoMqttClient

ArduinoMqttClient Library for Arduino
GNU Lesser General Public License v2.1
187 stars 73 forks source link

Adding all WiFi enabled boards as CI build target. #32

Closed aentinger closed 4 years ago

aentinger commented 4 years ago

Adding MKR1000, NANO 33 IOT and ESP8266 as CI build targets

aentinger commented 4 years ago

@per1234 Do you see a way to either exclude building the examples for MKR NB/GSM/WAN or a way to upgrade the examples so that they can be used meaningful with at least MKR NB and GSM?

per1234 commented 4 years ago

Do you see a way to either exclude building the examples for MKR NB/GSM/WAN

Do you mean you want to only build certain examples for those boards, and only the WiFi examples for the WiFi boards?

a way to upgrade the examples so that they can be used meaningful with at least MKR NB and GSM?

I'd guess it could be done with some heavy use of preprocessor conditionals but that could end up making the examples pretty unfriendly to beginners.

aentinger commented 4 years ago

Do you mean you want to only build certain examples for boards, and only the WiFi examples for the WiFi boards?

What this PR is doing right now is just to build for WiFi boards. But I'd like to build at least the library for all boards (so one yet to be designed sketch for all boards) and all the WiFi examples to be built for WiFi boards only.

I'd guess it could be done with some heavy use of preprocessor conditionals but that could end up making the examples pretty unfriendly to beginners.

I'm afraid so too. Let's just not do that.

per1234 commented 4 years ago

The only way I can think with the existing compile-examples action is to use an alternate entrypoint to delete the examples you don't want to compile in each step:

     - name: Compile universal examples for official Arduino boards
       if: startsWith(matrix.fqbn, '"esp8266:esp8266') != true
       uses: arduino/actions/libraries/compile-examples@master
       with:
         fqbn: ${{ matrix.fqbn }}
         libraries: ${{ env.LIBRARIES }}
         entrypoint: /github/workspace/.github/workflows/wrapper-script-that-deletes-wifi-examples.sh
     - name: Compile WiFi examples for official Arduino WiFi boards
       if: startsWith(matrix.fqbn, '"esp8266:esp8266') != true && (matrix.fqbn == 'arduino:samd:mkr1000' || matrix.fqbn == 'arduino:samd:mkrwifi1010' || matrix.fqbn == 'arduino:samd:nano_33_iot' || matrix.fqbn == 'arduino:megaavr:uno2018')
       uses: arduino/actions/libraries/compile-examples@master
       with:
         fqbn: ${{ matrix.fqbn }}
         libraries: ${{ env.LIBRARIES }}
         entrypoint: /github/workspace/.github/workflows/wrapper-script-that-deletes-universal-examples.sh
     - name: compile-examples for ESP8266 boards
       if: startsWith(matrix.fqbn, '"esp8266:esp8266')
       uses: arduino/actions/libraries/compile-examples@master
       with:
         fqbn: ${{ matrix.fqbn }}
         entrypoint: /github/workspace/.github/workflows/install-python-wrapper.sh

I might be slightly off in my syntax, but you get the idea.

This seems like an issue we're going to be running into a lot with the compile-examples action. It would probably be a good idea to try to figure out a way to make it more flexible in this respect so we don't have to make the workflow configuration so messy with these hacky workarounds.

aentinger commented 4 years ago

Thank you for your suggestion. Can I ask to look into a generalised solution for this situation when you have time (this is rather low-prio from my point of view). I'll go ahead and limit this PR to WiFi boards.

per1234 commented 4 years ago

OK, will do.

aentinger commented 4 years ago

Thank you :+1: ... if the PR is otherwise good with you I'd merge it in?