Skip to content

Compile Examples

Compile Examples #339

name: Compile Examples
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
pull_request:
paths:
- ".github/workflows/compile-examples.yml"
- "library.properties"
- "examples/**"
- "src/**"
push:
paths:
- ".github/workflows/compile-examples.yml"
- "library.properties"
- "examples/**"
- "src/**"
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:
env:
SKETCHES_REPORTS_PATH: sketches-reports
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
jobs:
compile-test:
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest
env:
# libraries to install for all boards
UNIVERSAL_LIBRARIES: |
# Install the Arduino_Threads library from the repository
- source-path: ./
# sketch paths to compile (recursive) for all boards
UNIVERSAL_SKETCH_PATHS: |
- examples
ARDUINOCORE_MBED_STAGING_PATH: extras/ArduinoCore-mbed
ARDUINOCORE_API_STAGING_PATH: extras/ArduinoCore-API
strategy:
fail-fast: false
matrix:
board:
- fqbn: arduino:mbed_nano:nano33ble
platforms: |
- name: arduino:mbed_nano
- fqbn: arduino:mbed_nano:nanorp2040connect
platforms: |
- name: arduino:mbed_nano
- fqbn: arduino:mbed_portenta:envie_m7:target_core=cm4
platforms: |
- name: arduino:mbed_portenta
- fqbn: arduino:mbed_portenta:envie_m7:target_core=cm7
platforms: |
- name: arduino:mbed_portenta
steps:
- name: Checkout
uses: actions/checkout@v4
# it's necessary to checkout the platform before installing it so that the ArduinoCore-API dependency can be added
- name: Checkout ArduinoCore-mbed
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
uses: actions/checkout@v4
with:
repository: arduino/ArduinoCore-mbed
# the arduino/actions/libraries/compile-examples action will install the platform from this path
path: ${{ env.ARDUINOCORE_MBED_STAGING_PATH }}
- name: Checkout ArduinoCore-API
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
uses: actions/checkout@v4
with:
repository: arduino/ArduinoCore-API
path: ${{ env.ARDUINOCORE_API_STAGING_PATH }}
- name: Install ArduinoCore-API
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
run: |
mv "${{ env.ARDUINOCORE_API_STAGING_PATH }}/api" "${{ env.ARDUINOCORE_MBED_STAGING_PATH }}/cores/arduino"
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
cli-version: 'arduino_threads'
fqbn: ${{ matrix.board.fqbn }}
libraries: |
${{ env.UNIVERSAL_LIBRARIES }}
platforms: ${{ matrix.board.platforms }}
sketch-paths: |
${{ env.UNIVERSAL_SKETCH_PATHS }}
enable-deltas-report: 'true'
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
github-token: ${{ secrets.GITHUB_TOKEN }}
verbose: 'true'
- name: Save memory usage change report as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}