Skip to content
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

Add CI workflows (to be used with ArduinoCore-API integration) #567

Merged
merged 28 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cc557a4
Add compile example for CI
giulcioffi Sep 1, 2020
2691b30
Use branch namespaced_api_Hardware of ArduinoCore-API
giulcioffi Sep 2, 2020
64f2aee
Disable size-delta-report and use arduino path for compile example step
giulcioffi Sep 2, 2020
3139e35
Use official branch of ArduinoCore-API
giulcioffi Oct 15, 2020
f7c8d00
Add MKRGSM, MKRNB, MKRWAN, WiFi101
giulcioffi Sep 2, 2020
e9e9e8b
Compile all the libraries + WiFi101 from namespaced_api branch
giulcioffi Sep 2, 2020
1a6ef45
Install ArduinoIoTCloud + dependencies from the repository instead of…
giulcioffi Sep 3, 2020
7d18af8
Install Arduino_ConnectionHandler from the repository instead of Boar…
giulcioffi Sep 3, 2020
0ed98c2
Compile LoRa library
giulcioffi Sep 3, 2020
4f861fd
Remove intallation of libraries which are dependencies of ArduinoIoTC…
giulcioffi Sep 4, 2020
c3f8a97
Compile only when a relevant file is modified
giulcioffi Sep 10, 2020
c8693a3
Remove examples from extras and add step to download them
giulcioffi Sep 10, 2020
0bff8ae
Use list mode for sketches
giulcioffi Sep 10, 2020
00dca72
Remove universal libraries entry
giulcioffi Sep 10, 2020
f2dd55a
Remove WiFiNINA step and compile its examples
giulcioffi Sep 10, 2020
2990e4c
Assign a unique type to mkrwifi1010, nano33IoT, mkrwan1310 and mkrNB1500
giulcioffi Sep 10, 2020
6db378e
Remove comments
giulcioffi Sep 10, 2020
d7d471b
Add report-size-delta action + step to upload artifact
giulcioffi Oct 15, 2020
01f3e74
Update names and paths for compile-sketches and report-size-deltas ac…
giulcioffi Oct 16, 2020
b47b2af
Add VidorPeripherals to tesk sketches for MKR Vidor
giulcioffi Nov 23, 2020
da63a92
Use master branch of library WiFi101
giulcioffi Nov 23, 2020
dbf2e79
Use new mkrgsm1400-sketch-paths for MKR GSM1400
giulcioffi Nov 23, 2020
857c994
Update inputs for upload-artifact entries
giulcioffi Nov 23, 2020
0dc7e00
Add WAN attribute to compile also examples from MKRWAN library for MK…
giulcioffi Nov 23, 2020
fb59c13
Remove redundant matrix entry for MKRNB1500
giulcioffi Nov 23, 2020
50d5867
Use release version of Keyboard library
giulcioffi Nov 23, 2020
6769704
Fix wrong core name in a comment
giulcioffi Nov 23, 2020
e62bb96
Mv ArduinoCore-API only if included inplatform
giulcioffi Nov 24, 2020
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
265 changes: 265 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
name: Compile Examples

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"

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

env:
# sketch paths to compile (recursive) for all boards
UNIVERSAL_SKETCH_PATHS: |
- extras/examples
- libraries/Wire
- libraries/USBHost
- libraries/SPI
- libraries/SFU/examples/SFU_LoadBinary
- libraries/SAMD_AnalogCorrection
- ~/Arduino/libraries/Keyboard/examples/Serial
- ~/Arduino/libraries/Servo/examples
- ~/Arduino/libraries/LiquidCrystal/examples
- ~/Arduino/libraries/Ethernet/examples
- ~/Arduino/libraries/SD/examples
- ~/Arduino/libraries/WiFi/examples
- ~/Arduino/libraries/Arduino_LSM9DS1/examples
- ~/Arduino/libraries/Arduino_JSON/examples
- ~/Arduino/libraries/MFRC522/examples/ChangeUID
- ~/Arduino/libraries/MFRC522/examples/DumpInfo
- ~/Arduino/libraries/MFRC522/examples/FixBrickedUID
- ~/Arduino/libraries/MFRC522/examples/MifareClassicValueBlock
- ~/Arduino/libraries/MFRC522/examples/MinimalInterrupt
- ~/Arduino/libraries/MFRC522/examples/Ntag216_AUTH
- ~/Arduino/libraries/MFRC522/examples/RFID-Cloner
- ~/Arduino/libraries/MFRC522/examples/ReadAndWrite
- ~/Arduino/libraries/MFRC522/examples/ReadNUID
- ~/Arduino/libraries/MFRC522/examples/ReadUidMultiReader
- ~/Arduino/libraries/MFRC522/examples/firmware_check
- ~/Arduino/libraries/MFRC522/examples/rfid_default_keys
- ~/Arduino/libraries/MFRC522/examples/rfid_read_personal_data
- ~/Arduino/libraries/MFRC522/examples/rfid_write_personal_data
- ~/Arduino/libraries/WiFi101/examples

strategy:
fail-fast: false

matrix:
board: [
{"fqbn": "arduino:samd:arduino_zero_edbg", "type": "usb"},
{"fqbn": "arduino:samd:arduino_zero_native", "type": "usb"},
{"fqbn": "arduino:samd:mkr1000", "type": "usb"},
{"fqbn": "arduino:samd:mkrzero", "type": "usb"},
{"fqbn": "arduino:samd:mkrwifi1010", "type": "mkrWiFi1010"},
{"fqbn": "arduino:samd:nano_33_iot", "type": "nano33IoT"},
{"fqbn": "arduino:samd:mkrfox1200", "type": "usb"},
{"fqbn": "arduino:samd:mkrwan1300", "type": "usb"},
{"fqbn": "arduino:samd:mkrwan1310", "type": "mkrwan1310"},
{"fqbn": "arduino:samd:mkrgsm1400", "type": "usb"},
{"fqbn": "arduino:samd:mkrnb1500", "type": "mkrNB1500"},
{"fqbn": "arduino:samd:mkrvidor4000", "type": "vidor"},
{"fqbn": "arduino:samd:adafruit_circuitplayground_m0", "type": "adafruit_playg"},
{"fqbn": "arduino:samd:mzero_pro_bl_dbg", "type": "mzero"},
{"fqbn": "arduino:samd:mzero_pro_bl", "type": "mzero"},
{"fqbn": "arduino:samd:mzero_bl", "type": "mzero"},
{"fqbn": "arduino:samd:tian", "type": "tian"}
]

# make board type-specific customizations to the matrix jobs
include:
# Normal USB boards with all the general libraries
- board:
type: "usb"
additional-sketch-paths: |
- ~/Arduino/libraries/Firmata/examples/StandardFirmataPlus
- ~/Arduino/libraries/Firmata/examples/StandardFirmataEthernet
- ~/Arduino/libraries/Firmata/examples/StandardFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleDigitalFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleAnalogFirmata
- ~/Arduino/libraries/Firmata/examples/ServoFirmata
- ~/Arduino/libraries/Firmata/examples/EchoString
- ~/Arduino/libraries/Firmata/examples/AnalogFirmata
- ~/Arduino/libraries/Firmata/examples/AllInputsFirmata
- libraries/I2S/examples
- libraries/SDU/examples
# Vidor board
- board:
type: "vidor"
additional-sketch-paths: |
- libraries/SAMD_BootloaderUpdater/examples
- libraries/I2S/examples
# mkrwifi1010
- board:
type: "mkrWiFi1010"
additional-sketch-paths: |
- libraries/I2S/examples
- libraries/SDU/examples
- ~/Arduino/libraries/WiFiNINA/examples
# mkrnb1500 boards
- board:
type: "mkrNB1500"
additional-sketch-paths: |
- libraries/I2S/examples
- libraries/SDU/examples
# nano_33_iot
- board:
type: "nano33IoT"
additional-sketch-paths: |
- libraries/I2S/examples
- ~/Arduino/libraries/WiFiNINA/examples
# mkrwan1310
- board:
type: "mkrwan1310"
additional-sketch-paths: |
- libraries/I2S/examples
# adafruit_cicrcuitplayground board
- board:
type: "adafruit_playg"
additional-sketch-paths: |
- libraries/SDU/examples
# mzero boards
- board:
type: "mzero"
additional-sketch-paths: |
- ~/Arduino/libraries/Firmata/examples/StandardFirmataPlus
- ~/Arduino/libraries/Firmata/examples/StandardFirmataEthernet
- ~/Arduino/libraries/Firmata/examples/StandardFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleDigitalFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleAnalogFirmata
- ~/Arduino/libraries/Firmata/examples/ServoFirmata
- ~/Arduino/libraries/Firmata/examples/EchoString
- ~/Arduino/libraries/Firmata/examples/AnalogFirmata
- ~/Arduino/libraries/Firmata/examples/AllInputsFirmata
- libraries/SDU/examples
# tian board
- board:
type: "tian"
additional-sketch-paths: |
- ~/Arduino/libraries/Firmata/examples/StandardFirmataPlus
- ~/Arduino/libraries/Firmata/examples/StandardFirmataEthernet
- ~/Arduino/libraries/Firmata/examples/StandardFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleDigitalFirmata
- ~/Arduino/libraries/Firmata/examples/SimpleAnalogFirmata
- ~/Arduino/libraries/Firmata/examples/ServoFirmata
- ~/Arduino/libraries/Firmata/examples/EchoString
- ~/Arduino/libraries/Firmata/examples/AnalogFirmata
- ~/Arduino/libraries/Firmata/examples/AllInputsFirmata
# MKRGSM1400 board
- board:
fqbn: "arduino:samd:mkrgsm1400"
additional-sketch-paths: |
Copy link
Contributor

@per1234 per1234 Nov 23, 2020

Choose a reason for hiding this comment

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

Since you set matrix.board.type to usb for this board, I suspect you intended for the paths under matrix.include[].board.type.usb to be compiled for it, but what is happening is the value of the matrix.board.additional-sketch-paths key is being overwritten. So it only ends up containing the single path ~/Arduino/libraries/MKRGSM/examples, as you can see from this workflow log;
https://github.com/giulcioffi/ArduinoCore-samd/runs/1263161053?#step:7:16602

You can fix this by using a dedicated key for each, like matrix.board.additional-usb-sketch-paths and matrix.board.additional-sketch-paths . You can see an example of that here:
https://github.com/arduino/arduino-examples/blob/main/.github/workflows/compile-examples.yml

- ~/Arduino/libraries/MKRGSM/examples
# MKRNB1500 board
- board:
fqbn: "arduino:samd:mkrnb1500"
additional-sketch-paths: |
- ~/Arduino/libraries/MKRNB/examples
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue as I described above for arduino:samd:mkrgsm1400 of overwriting the previous value of additional-sketch-paths.

# MKRWAN board
- board:
fqbn: '"arduino:samd:mkrwan1300" "arduino:samd:mkrwan1310"'
Copy link
Contributor

Choose a reason for hiding this comment

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

Since none of the existing matrix items match the matrix.include filter, this creates a new matrix element.
https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#example-including-new-combinations
You can see the fqbn: '"arduino:samd:mkrwan1300" "arduino:samd:mkrwan1310"' job here;
https://github.com/giulcioffi/ArduinoCore-samd/runs/1263161214
and the jobs for the fqbn: arduino:samd:mkrwan1300 and fqbn: arduino:samd:mkrwan1310 matrix elements:
https://github.com/giulcioffi/ArduinoCore-samd/runs/1263161020
https://github.com/giulcioffi/ArduinoCore-samd/runs/1263161034

Apparently the arduino/compile-sketches action accepts the input fqbn: "arduino:samd:mkrwan1300" "arduino:samd:mkrwan1310"and ends up just compiling only for the MKR WAN 1300.

You could add a general "WAN" attribute property to the matrix, something like what I did in this workflow:
https://github.com/arduino/arduino-examples/blob/main/.github/workflows/compile-examples.yml
The only problem is that, as you see here, when no matrix element matches the filter, one is created, which is why I had to define those properties for all the boards in the matrix, rather than only for the boards the property applied to.

You could also just add a separate matrix.include filter for each of the MKR WAN boards board.fqbn values.


This also has the same issue as I described above for arduino:samd:mkrgsm1400 of overwriting the previous value of additional-sketch-paths for arduino:samd:mkrwan1300.

additional-sketch-paths: |
- ~/Arduino/libraries/MKRWAN/examples

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

- name: Compile examples
uses: arduino/actions/libraries/compile-examples@master
giulcioffi marked this conversation as resolved.
Show resolved Hide resolved
with:
fqbn: ${{ matrix.board.fqbn }}
libraries: |
- source-url: https://github.com/giulcioffi/WiFi101.git
version: namespaced_api
- name: MFRC522
- name: Arduino_MKRMEM
- name: FlashStorage
- source-url: https://github.com/arduino-libraries/Keyboard.git
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 guess that the use of the development version of the Keyboard library is because that version has an example sketch added:
arduino-libraries/Keyboard@a587425

but that example sketch is just a copy/paste of the KeyboardSerial example in the built-in examples:
https://github.com/arduino/arduino-examples/blob/main/examples/09.USB/Keyboard/KeyboardSerial/KeyboardSerial.ino
which the workflow is already configured to compile.

So there would be no loss of coverage from using the release version of the library and removing the ~/Arduino/libraries/Keyboard/examples/Serial path from env.UNIVERSAL_SKETCH_PATHS

- name: Mouse
- name: Servo
- name: LiquidCrystal
- name: CapacitiveSensor
- name: Ethernet
- name: ArduinoBearSSL
- name: Arduino_APDS9960
- 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: ArduinoMotorCarrier
- name: ArduinoCloudThing
- name: Arduino_DebugUtils
- name: WiFi Link
- name: Arduino_LPS22HB
- name: CTC GO MOTIONS
- name: ArduinoModbus
- name: ArduinoIoTCloudBearSSL
- name: ArduinoDMX
- name: ArduinoRS485
- name: Arduino_OAuth
- name: CTC GO CORE
- name: WiFi
- name: Bridge
- name: Temboo
- name: ArduinoIoTCloud
- name: Madgwick
- name: MKRGSM
- name: MKRNB
- name: LoRa
- name: MKRWAN
- name: WiFiNINA
platforms: |
# Use Board Manager to install the latest release of Arduino megaAVR Boards to get the toolchain
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
# Use Board Manager to install the latest release of Arduino megaAVR Boards to get the toolchain
# Use Board Manager to install the latest release of Arduino SAMD Boards to get the toolchain

- name: "arduino:samd"
# Overwrite the Board Manager installation with the local platform
- source-path: "./"
name: "arduino:samd"
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.additional-sketch-paths }}
enable-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
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: size-deltas-reports
path: size-deltas-reports
name: sketches-reports
path: sketches-reports

The default sketches report path of the arduino/compile-sketches action and the default workflow artifact name of the arduino/report-size-deltas action were changed by arduino/compile-sketches#7, so this change must accompany the actions name changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I see I forgot about this and made a duplicate suggestion for the same change in my newer review below:
#567 (comment)

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
giulcioffi marked this conversation as resolved.
Show resolved Hide resolved