Skip to content

Compile Examples

Compile Examples #332

# This workflow compiles the example sketches for one of each distinct type of active official Arduino board.
#
# This requires the use of external components (e.g., libraries, boards platform, toolchain), so it is possible for
# compilations to be broken by bugs in the external components, even though the example itself is perfect.
#
# If this happens, the procedure is:
# - Report the bug to the appropriate issue tracker.
# - Adjust this workflow to remove the compilation for the specific board/sketch combination that is failing due to the
# bug.
# - Add a comment to the workflow providing the URL of the issue report.
# - Once the bug is fixed and the fix released, revert the commit that removed the failing compilation.
# - If the issue is closed as "wontfix", add a comment to the affected examples documenting the incompatibility and open
# an issue requesting that the associated tutorials be updated.
name: Compile Examples
on:
pull_request:
paths-ignore:
- "**"
- "!.github/workflows/compile-examples.ya?ml"
- "!examples/**"
- "**.adoc"
- "**.jpg"
- "**.md"
- "**.png"
- "**.txt"
push:
paths-ignore:
- "**"
- "!.github/workflows/compile-examples.ya?ml"
- "!examples/**"
- "**.adoc"
- "**.jpg"
- "**.md"
- "**.png"
- "**.txt"
# Scheduled trigger checks for breakage caused by changes to external resources (libraries, platforms)
schedule:
# run every Tuesday at 3 AM UTC
- cron: "0 3 * * 2"
# workflow_dispatch event allows the workflow to be triggered manually
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
# repository_dispatch event allows the workflow to be triggered via the GitHub API
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
repository_dispatch:
jobs:
build:
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest
env:
# Libraries to install for all boards
UNIVERSAL_LIBRARIES: |
- name: Servo
- name: LiquidCrystal
- name: CapacitiveSensor
# Sketch paths to compile (recursive) for all boards
UNIVERSAL_SKETCH_PATHS: |
- examples/01.Basics
- examples/02.Digital/BlinkWithoutDelay
- examples/02.Digital/Button
- examples/02.Digital/Debounce
- examples/02.Digital/DigitalInputPullup
- examples/02.Digital/StateChangeDetection
- examples/03.Analog
- examples/04.Communication/ASCIITable
- examples/04.Communication/Dimmer
- examples/04.Communication/Graph
- examples/04.Communication/Midi
- examples/04.Communication/PhysicalPixel
- examples/04.Communication/ReadASCIIString
- examples/04.Communication/SerialCallResponse
- examples/04.Communication/SerialCallResponseASCII
- examples/04.Communication/SerialEvent
- examples/04.Communication/VirtualColorMixer
- examples/05.Control
- examples/06.Sensors
- examples/07.Display
- examples/08.Strings/CharacterAnalysis
- examples/08.Strings/StringAdditionOperator
- examples/08.Strings/StringAppendOperator
- examples/08.Strings/StringCaseChanges
- examples/08.Strings/StringCharacters
- examples/08.Strings/StringConstructors
- examples/08.Strings/StringIndexOf
- examples/08.Strings/StringLength
- examples/08.Strings/StringLengthTrim
- examples/08.Strings/StringReplace
- examples/08.Strings/StringStartsWithEndsWith
- examples/08.Strings/StringSubstring
- examples/08.Strings/StringToInt
- examples/11.ArduinoISP
strategy:
fail-fast: false
matrix:
board:
# For testing the Starter Kit examples
- fqbn: arduino:avr:uno
usb: false
serial1: false
starter-kit: true
tone: true
a5: true
# Adding this in addition to the Uno because it has 1.5 kB less available flash
- fqbn: arduino:avr:nano
usb: false
serial1: false
starter-kit: false
tone: true
a5: true
- fqbn: arduino:avr:leonardo
usb: true
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:esp32:nano_nora
usb: false
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:megaavr:uno2018:mode=off
usb: false
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:renesas_uno:minima
usb: true
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:renesas_uno:unor4wifi
usb: true
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:renesas_portenta:portenta_c33
usb: true
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:samd:mkrzero
usb: true
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:mbed_giga:giga
usb: false
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:mbed_nano:nano33ble
usb: false
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:mbed_nano:nanorp2040connect
usb: false
serial1: true
starter-kit: false
tone: true
# WiFiNINA library is required to use pins A4-A7.
a5: false
- fqbn: arduino:mbed_portenta:envie_m7
usb: false
serial1: true
starter-kit: false
tone: true
a5: true
- fqbn: arduino:sam:arduino_due_x
usb: true
serial1: true
starter-kit: false
# Bug report: https://github.com/arduino/ArduinoCore-sam/issues/24
# Change the value to true once it is fixed.
tone: false
a5: true
# Make board type-specific customizations to the matrix jobs
include:
- board:
# Boards with Keyboard+Mouse library compatibility
usb: true
# Install these libraries in addition to the ones defined by env.UNIVERSAL_LIBRARIES
usb-libraries: |
- name: Keyboard
- name: Mouse
# Compile these sketches in addition to the ones defined by env.UNIVERSAL_SKETCH_PATHS
usb-sketch-paths: |
- examples/09.USB
- board:
usb: false
usb-libraries: ""
usb-sketch-paths: ""
- board:
# Boards with a Serial1 port
serial1: true
serial1-sketch-paths: |
- examples/04.Communication/MultiSerial
- examples/04.Communication/SerialPassthrough
- board:
serial1: false
serial1-sketch-paths: ""
- board:
starter-kit: true
starter-kit-sketch-paths: |
- examples/10.StarterKit_BasicKit
- board:
starter-kit: false
starter-kit-sketch-paths: ""
- board:
tone: true
tone-sketch-paths: |
- examples/02.Digital/toneKeyboard
- examples/02.Digital/toneMelody
- examples/02.Digital/toneMultiple
- examples/02.Digital/tonePitchFollower
- board:
tone: false
tone-sketch-paths: ""
- board:
a5: true
a5-sketch-paths: |
- examples/08.Strings/StringComparisonOperators
- board:
a5: false
tone-sketch-paths: ""
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
fqbn: ${{ matrix.board.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
${{ matrix.usb-libraries }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
${{ matrix.usb-sketch-paths }}
${{ matrix.serial1-sketch-paths }}
${{ matrix.starter-kit-sketch-paths }}
${{ matrix.tone-sketch-paths }}