Skip to content

Commit 52a0ab5

Browse files
committed
Add GitHub Actions workflow to compile examples sketches
This workflow compiles all compatible built-in example sketches for one board of each distinct type from the latest release of each active official boards platform using the latest version of Arduino CLI. The Starter Kit sketches are only compiled for the Uno because that is the board those sketches are designed to be used with. This workflow is triggered on: - pull request (to validate PRs) - push (to validate commits when preparing to submit a PR) - schedule (to check for breakage caused by changes to boards platforms and libraries - manual trigger of the workflow by either the GitHub web interface or the GitHub API
1 parent 91cf100 commit 52a0ab5

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed
+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Compile Examples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/compile-examples.yml"
7+
- "examples/**"
8+
push:
9+
paths:
10+
- ".github/workflows/compile-examples.yml"
11+
- "examples/**"
12+
# Scheduled trigger checks for breakage caused by changes to external resources (libraries, platforms)
13+
schedule:
14+
# run every Tuesday at 3 AM UTC
15+
- cron: "0 3 * * 2"
16+
# workflow_dispatch event allows the workflow to be triggered manually
17+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
18+
workflow_dispatch:
19+
# repository_dispatch event allows the workflow to be triggered via the GitHub API
20+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
21+
repository_dispatch:
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
27+
env:
28+
# Libraries to install for all boards
29+
UNIVERSAL_LIBRARIES: |
30+
- name: Servo
31+
- name: LiquidCrystal
32+
- name: CapacitiveSensor
33+
34+
# Sketch paths to compile (recursive) for all boards
35+
UNIVERSAL_SKETCH_PATHS: >-
36+
"examples/01.Basics"
37+
"examples/02.Digital"
38+
"examples/03.Analog"
39+
"examples/04.Communication/ASCIITable"
40+
"examples/04.Communication/Dimmer"
41+
"examples/04.Communication/Graph"
42+
"examples/04.Communication/Midi"
43+
"examples/04.Communication/PhysicalPixel"
44+
"examples/04.Communication/ReadASCIIString"
45+
"examples/04.Communication/SerialCallResponse"
46+
"examples/04.Communication/SerialCallResponseASCII"
47+
"examples/04.Communication/SerialEvent"
48+
"examples/04.Communication/VirtualColorMixer"
49+
"examples/05.Control"
50+
"examples/06.Sensors"
51+
"examples/07.Display"
52+
"examples/08.Strings"
53+
"examples/11.ArduinoISP"
54+
55+
strategy:
56+
fail-fast: false
57+
58+
matrix:
59+
board:
60+
# For testing the Starter Kit examples
61+
- fqbn: arduino:avr:uno
62+
usb: false
63+
serial1: false
64+
starter-kit: true
65+
# Adding this in addition to the Uno because it has 1.5 kB less available flash
66+
- fqbn: arduino:avr:nano
67+
usb: false
68+
serial1: false
69+
starter-kit: false
70+
- fqbn: arduino:avr:leonardo
71+
usb: true
72+
serial1: true
73+
starter-kit: false
74+
- fqbn: arduino:megaavr:uno2018:mode=off
75+
usb: false
76+
serial1: true
77+
starter-kit: false
78+
- fqbn: arduino:samd:mkrzero
79+
usb: true
80+
serial1: true
81+
starter-kit: false
82+
- fqbn: arduino:mbed:nano33ble
83+
usb: false
84+
serial1: true
85+
starter-kit: false
86+
# Change this to arduino:mbed:envie_m7 once there is a production release of the Arduino Mbed OS Boards platform
87+
- fqbn: arduino-beta:mbed:envie_m7
88+
usb: false
89+
serial1: true
90+
starter-kit: false
91+
- fqbn: arduino:sam:arduino_due_x
92+
usb: true
93+
serial1: true
94+
starter-kit: false
95+
96+
# Make board type-specific customizations to the matrix jobs
97+
include:
98+
- board:
99+
# Boards with Keyboard+Mouse library compatibility
100+
usb: true
101+
# Install these libraries in addition to the ones defined by env.UNIVERSAL_LIBRARIES
102+
usb-libraries: |
103+
- name: Keyboard
104+
- name: Mouse
105+
# Compile these sketches in addition to the ones defined by env.UNIVERSAL_SKETCH_PATHS
106+
usb-sketch-paths: >-
107+
"examples/09.USB"
108+
- board:
109+
usb: false
110+
usb-libraries: ""
111+
usb-sketch-paths: ""
112+
- board:
113+
# Boards with a Serial1 port
114+
serial1: true
115+
serial1-sketch-paths: >-
116+
"examples/04.Communication/MultiSerial"
117+
"examples/04.Communication/SerialPassthrough"
118+
- board:
119+
serial1: false
120+
serial1-sketch-paths: ""
121+
- board:
122+
starter-kit: true
123+
starter-kit-sketch-paths: >-
124+
"examples/10.StarterKit_BasicKit"
125+
- board:
126+
starter-kit: false
127+
starter-kit-sketch-paths: ""
128+
129+
steps:
130+
- name: Checkout
131+
uses: actions/checkout@v2
132+
133+
- name: Compile examples
134+
uses: arduino/actions/libraries/compile-examples@master
135+
with:
136+
fqbn: ${{ matrix.board.fqbn }}
137+
libraries: |
138+
${{ env.UNIVERSAL_LIBRARIES }}
139+
${{ matrix.usb-libraries }}
140+
sketch-paths: '${{ env.UNIVERSAL_SKETCH_PATHS }} ${{ matrix.usb-sketch-paths }} ${{ matrix.serial1-sketch-paths }} ${{ matrix.starter-kit-sketch-paths }}'

README.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
= Built-in Examples =
22

3+
image:https://github.com/arduino/arduino-examples/workflows/Compile%20Examples/badge.svg["Compile Examples Status", link="https://github.com/arduino/arduino-examples/actions?workflow=Compile+Examples"]
4+
35
These are the example Arduino sketches built in to the Arduino IDE.
46

57
They were originally hosted at `https://github.com/arduino/Arduino/tree/master/build/shared`

0 commit comments

Comments
 (0)