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
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -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


jobs:
compile-test:
runs-on: ubuntu-latest

env:
# 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.

# sketch paths to compile (recursive) for all boards
UNIVERSAL_SKETCH_PATHS: |
- extras/examples
- libraries/Wire
- libraries/SPI
- libraries/SoftwareSerial
- libraries/EEPROM
- ~/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.


strategy:
fail-fast: false

matrix:
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.


steps:
- name: Checkout repository
uses: actions/checkout@v2

# The source files are in a subfolder of the ArduinoCore-API repository, so it's not possible to clone it directly to the final destination in the core
- name: Checkout ArduinoCore-API
uses: actions/checkout@v2
with:
repository: arduino/ArduinoCore-API
path: extras/ArduinoCore-API

- name: Install ArduinoCore-API
run: mv "$GITHUB_WORKSPACE/extras/ArduinoCore-API/api" "$GITHUB_WORKSPACE/cores/arduino"

- 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?


- name: Checkout Basic examples
uses: actions/checkout@v2
with:
repository: arduino/arduino-examples
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.

libraries: |
- name: Adafruit IO Arduino
- name: Adafruit MQTT Library
- name: ArduinoHttpClient
- name: Adafruit FONA Library
- name: MegunoLink
- name: Servo
- name: LiquidCrystal
- name: MFRC522
- name: Ethernet
- name: ArduinoBearSSL
- name: Arduino_LSM9DS1
- name: ArduinoHttpClient
- name: NTPClient
- name: TFT
- name: ArduinoMqttClient
- name: Arduino_CRC32
- name: Arduino_LSM6DS3
- name: Stepper
- name: SD
- 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: Arduino_DebugUtils
- name: Arduino_LPS22HB
- name: ArduinoIoTCloudBearSSL
- 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.

- 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.

platforms: |
# Use Board Manager to install the latest release of Arduino megaAVR Boards to get the toolchain
- name: "arduino:megaavr"
# Overwrite the Board Manager installation with the local platform
- source-path: "./"
name: "arduino:megaavr"
sketch-paths: "${{ env.UNIVERSAL_SKETCH_PATHS }}"
enable-size-deltas-report: 'true'
verbose: 'true'

- name: Save memory usage change report as artifact
uses: actions/upload-artifact@v1
with:
name: size-deltas-reports
path: size-deltas-reports
13 changes: 13 additions & 0 deletions .github/workflows/report-size-deltas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Report PR Size Deltas

on:
schedule:
- cron: '*/5 * * * *'

jobs:
report:
runs-on: ubuntu-latest

steps:
- name: Comment size deltas reports to PRs
uses: arduino/actions/libraries/report-size-deltas@master