Skip to content

Commit 17dd5d9

Browse files
per1234aentinger
authored andcommitted
Improve board-specific configuration system in compile-examples CI workflow (#124)
Use the matrix.include key to customize the compile-examples CI workflow's matrix jobs with board type-specific configurations. This GitHub Actions feature allows defining additional properties for matrix jobs that match the filter. The previous approach for doing this was to use generated environment variable names, which worked but seemed likely to be confusing for anyone trying to decipher the workflow. I think the new approach is a little easier to understand and less hacky. I had hoped this would allow me to do away with the board.type system, but supplying lists of values to the filter keys isn't supported, you can't reference the env key from matrix, and YAML anchors aren't supported. So the board.type system remains the only way I can see to avoid redefining the configuration options for each board of the same type.
1 parent c000159 commit 17dd5d9

File tree

1 file changed

+40
-24
lines changed

1 file changed

+40
-24
lines changed

.github/workflows/compile-examples.yml

+40-24
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,53 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
env:
20-
# libraries to install
21-
UNIVERSAL_LIBRARIES: '"ArduinoCloudThing" "Arduino_ConnectionHandler" "Arduino_DebugUtils" "ArduinoMqttClient" "Arduino_CRC32"'
22-
# board-specific libraries
23-
WIFI_LIBRARIES: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "WiFi101" "WiFiNINA" "Arduino_MKRMEM"'
24-
WAN_LIBRARIES: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRWAN"'
25-
GSM_LIBRARIES: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRGSM" "Arduino_MKRMEM"'
26-
NB_LIBRARIES: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRNB" "Arduino_MKRMEM"'
27-
ESP8266_LIBRARIES: ''
28-
# sketch paths to compile (recursive)
20+
# libraries to install for all boards
21+
UNIVERSAL_LIBRARIES: '"ArduinoCloudThing" "Arduino_ConnectionHandler" "Arduino_DebugUtils" "ArduinoMqttClient"'
22+
# sketch paths to compile (recursive) for all boards
2923
UNIVERSAL_SKETCH_PATHS: '"examples/ArduinoIoTCloud-Advanced" "examples/ArduinoIoTCloud-Basic" "examples/utility/ArduinoIoTCloud_Travis_CI"'
30-
# board-specific sketches
31-
WIFI_SKETCH_PATHS: '"examples/utility/Provisioning" "examples/utility/WiFi_Cloud_Blink"'
32-
WAN_SKETCH_PATHS: ''
33-
GSM_SKETCH_PATHS: '"examples/utility/Provisioning" "examples/utility/GSM_Cloud_Blink"'
34-
NB_SKETCH_PATHS: '"examples/utility/Provisioning" "examples/utility/NB_Cloud_Blink"'
35-
ESP8266_SKETCH_PATHS: '"examples/utility/WiFi_Cloud_Blink_with_security_credentials"'
3624

3725
strategy:
3826
fail-fast: false
3927

4028
matrix:
4129
board: [
42-
{"fqbn": "arduino:samd:mkr1000", "type": "WIFI"},
43-
{"fqbn": "arduino:samd:mkrwifi1010", "type": "WIFI"},
44-
{"fqbn": "arduino:samd:nano_33_iot", "type": "WIFI"},
45-
{"fqbn": "arduino:samd:mkrwan1300", "type": "WAN"},
46-
{"fqbn": "arduino:samd:mkrgsm1400", "type": "GSM"},
47-
{"fqbn": "arduino:samd:mkrnb1500", "type": "NB"},
48-
{"fqbn": '"esp8266:esp8266:huzzah" "https://arduino.esp8266.com/stable/package_esp8266com_index.json"', "type": "ESP8266"}
30+
{"fqbn": "arduino:samd:mkr1000", "type": "wifi"},
31+
{"fqbn": "arduino:samd:mkrwifi1010", "type": "wifi"},
32+
{"fqbn": "arduino:samd:nano_33_iot", "type": "wifi"},
33+
{"fqbn": "arduino:samd:mkrwan1300", "type": "wan"},
34+
{"fqbn": "arduino:samd:mkrgsm1400", "type": "gsm"},
35+
{"fqbn": "arduino:samd:mkrnb1500", "type": "nb"},
36+
{"fqbn": '"esp8266:esp8266:huzzah" "https://arduino.esp8266.com/stable/package_esp8266com_index.json"', "type": "esp8266"}
4937
]
5038

39+
# make board type-specific customizations to the matrix jobs
40+
include:
41+
# WiFi boards
42+
- board:
43+
type: "wifi"
44+
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "WiFi101" "WiFiNINA"'
45+
sketch-paths: '"examples/utility/Provisioning" "examples/utility/WiFi_Cloud_Blink"'
46+
# LoRaWAN boards
47+
- board:
48+
type: "wan"
49+
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRWAN"'
50+
sketch-paths:
51+
# GSM boards
52+
- board:
53+
type: "gsm"
54+
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRGSM"'
55+
sketch-paths: '"examples/utility/Provisioning" "examples/utility/GSM_Cloud_Blink"'
56+
# NB boards
57+
- board:
58+
type: "nb"
59+
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRNB"'
60+
sketch-paths: '"examples/utility/Provisioning" "examples/utility/NB_Cloud_Blink"'
61+
# ESP8266 boards
62+
- board:
63+
type: "esp8266"
64+
libraries:
65+
sketch-paths: '"examples/utility/WiFi_Cloud_Blink_with_security_credentials"'
66+
5167
steps:
5268
- name: Checkout
5369
uses: actions/checkout@v2
@@ -56,8 +72,8 @@ jobs:
5672
uses: arduino/actions/libraries/compile-examples@master
5773
with:
5874
fqbn: ${{ matrix.board.fqbn }}
59-
libraries: "${{ env.UNIVERSAL_LIBRARIES }} ${{ env[format('{0}{1}', matrix.board.type, '_LIBRARIES')] }}"
60-
sketch-paths: "${{ env.UNIVERSAL_SKETCH_PATHS }} ${{ env[format('{0}{1}', matrix.board.type, '_SKETCH_PATHS')] }}"
75+
libraries: "${{ env.UNIVERSAL_LIBRARIES }} ${{ matrix.libraries }}"
76+
sketch-paths: "${{ env.UNIVERSAL_SKETCH_PATHS }} ${{ matrix.sketch-paths }}"
6177
size-report-sketch: 'ArduinoIoTCloud_Travis_CI'
6278
enable-size-deltas-report: 'true'
6379

0 commit comments

Comments
 (0)