Skip to content

Add CI workflows #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Sep 10, 2020
Merged

Add CI workflows #81

merged 19 commits into from
Sep 10, 2020

Conversation

giulcioffi
Copy link
Contributor

@giulcioffi giulcioffi commented Sep 7, 2020

The compile-examples workflow compiles:

  • internal core libraries + examples
  • some of the most used libraries + related examples
  • all the basic examples provided in the Arduino IDE which are compatible with the boards that use this core
    Memory usage information collection is always enabled and handled by the report-size-deltas workflow.

With the current version of the core, the compilation of the following libraries examples will fail:

  • ~/Arduino/libraries/MFRC522/examples
  • ~/Arduino/libraries/Adafruit_MQTT_Library/examples/mqtt_ethernet
    Their failure is due to issue F() Flash Macro No Longer Recognized #62 . Once the F macro will be fixed, the compilation of these examples will be successful.

@@ -0,0 +1,117 @@
name: Compile Examples

on: [pull_request, push]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
on: [pull_request, push]
on:
pull_request:
paths:
- ".github/workflows/compile-examples.yml"
- "cores/**"
- "libraries/**"
- "variants/**"
- "boards.txt"
- "platform.txt"
push:
paths:
- ".github/workflows/compile-examples.yml"
- "cores/**"
- "libraries/**"
- "variants/**"
- "boards.txt"
- "platform.txt"

This causes the workflow to only run when a file relevant to sketch compilation, or the workflow itself, is modified:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths

Comment on lines 10 to 11
# libraries to install for all boards
UNIVERSAL_LIBRARIES: '"MFRC522" "Servo" "LiquidCrystal"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# libraries to install for all boards
UNIVERSAL_LIBRARIES: '"MFRC522" "Servo" "LiquidCrystal"'

This environment variable is unused and these libraries are defined in the arduino/actions/libraries/compile-examples action's libraries input. So this can be removed to avoid confusion.

Comment on lines 19 to 26
- ~/Arduino/libraries/Servo/examples
- ~/Arduino/libraries/LiquidCrystal/examples
- ~/Arduino/libraries/MFRC522/examples
- ~/Arduino/libraries/Ethernet/examples
- ~/Arduino/libraries/Arduino_LSM9DS1/examples
- ~/Arduino/libraries/SD/examples
- ~/Arduino/libraries/Arduino_JSON/examples
- ~/Arduino/libraries/WiFi/examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, some of the libraries listed in the arduino/actions/libraries/compile-examples action's libraries input are not being used for anything because they aren't in this list and they aren't dependencies of anything in this list.

One option would be to just use the root of the libraries folder as the sketch path:

        - ~/Arduino/libraries

The only problem with that is that maybe you have library dependencies of libraries or sketches installed there and you don't want to compile the examples of those libraries.

Comment on lines 32 to 35
board: [
{"fqbn": "arduino:megaavr:uno2018", "type": "unoWiFiRev2"},
{"fqbn": "arduino:megaavr:nona4809", "type": "nanoEvery"}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
board: [
{"fqbn": "arduino:megaavr:uno2018", "type": "unoWiFiRev2"},
{"fqbn": "arduino:megaavr:nona4809", "type": "nanoEvery"}
]
fqbn:
- "arduino:megaavr:uno2018:mode=on"
- "arduino:megaavr:uno2018:mode=off"
- "arduino:megaavr:nona4809"

A few suggestions combined here:

  • The type keys were not being used, so I removed them.
  • I find the YAML-style list format to be easier to understand in the context of the style of the rest of the document.
  • Test the `"Registers emulation" board option.

Comment on lines 51 to 55
- name: Checkout Adafruit WiFiNINA
uses: actions/checkout@v2
with:
repository: adafruit/WiFiNINA
path: adafruit/WiFiNINA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this?

path: extras

- name: Delete incompatible examples
run: rm -r "$GITHUB_WORKSPACE/extras/examples/09.USB" && rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p11_CrystalBall" && rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp"
Copy link
Contributor

@per1234 per1234 Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: rm -r "$GITHUB_WORKSPACE/extras/examples/09.USB" && rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p11_CrystalBall" && rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp"
run: |
rm -r "$GITHUB_WORKSPACE/extras/examples/09.USB"
rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p11_CrystalBall"
rm -r "$GITHUB_WORKSPACE/extras/examples/10.StarterKit_BasicKit/p13_TouchSensorLamp"

I think this is a little easier to read and maintain. The GitHub Actions shell runs in errexit exit mode, so there is no functional difference.

I do have a question about the removal of the p11_CrystalBall example. This isn't really incompatible, is it? I know it was failing to compile due to a bug (arduino/Arduino#10025), but that bug has already been fixed (arduino/ArduinoCore-API@7f8de58). I just gave it a try with my Uno WiFi Rev2 and the updated ArduinoCore-API and it works fine for me.

I also have a suggestion about the p13_TouchSensorLamp sketch. I'm guessing in this case it's not about a fundamental incompatibility (such as the hardware incompatibility with the USB examples), but simply that nobody has gotten around to adding support for megaAVR to the CapacitiveSensor library. If so, I would recommend adding a comment to that effect (ideally referencing an issue used to track any progress on adding compatibility). That way, it will be clear that the line removing that example can be removed once the library finally does become compatible. This new one command per line format facilitates adding comments.

- name: Compile examples
uses: arduino/actions/libraries/compile-examples@master
with:
fqbn: ${{ matrix.board.fqbn }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fqbn: ${{ matrix.board.fqbn }}
fqbn: ${{ matrix.fqbn }}

This goes along with my matrix restructuring suggestion above.

- name: Arduino_JSON
- name: Arduino_HTS221
- name: Firmata
- name: ArduinoCloudThing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: ArduinoCloudThing

This library is obsolete.

- name: ArduinoDMX
- name: ArduinoRS485
- name: Arduino_OAuth
- name: WiFi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WiFi library is for use with the long retired Arduino WiFi Shield, which is probably not used by anyone any more. So I'm not sure it's worth testing the megaAVR boards platform against it.

On the other hand, I would suggest testing the WiFiNINA library's examples, which is not currently done by this workflow.

Comment on lines 101 to 102
- name: Bridge
- name: Temboo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm uncertain about the value of testing against these.

I'm sure you could put a Yun shield on an Uno WiFi Rev2, in which case the Bridge library would be needed, but it doesn't seem like it would be a common use case.

Although It should be possible to use the Temboo library with the WiFiNINA library (though you won't find any information about this anywhere in the Temboo documentation or wizards), the Temboo library example sketches are all written for the Yun.

@aentinger
Copy link
Contributor

Hi @giulcioffi and @per1234 👋 Thank you @giulcioffi for creating this PR as well as @per1234 for doing a in-detail review. May I ask you to stick your heads together to finish this PR up so we can merge it?

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @giulcioffi. I'm really excited for this being added to the ArduinoCore-megaavr repository!

@aentinger aentinger merged commit 9e6b35b into arduino:master Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants