Compile Examples #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/compile-examples-private.md | |
name: Compile Examples | |
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows | |
on: | |
push: | |
paths: | |
- ".github/workflows/compile-examples.ya?ml" | |
- "library.properties" | |
- "examples/**" | |
- "src/**" | |
pull_request: | |
paths: | |
- ".github/workflows/compile-examples.ya?ml" | |
- "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: | |
build: | |
name: ${{ matrix.board.fqbn }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: read | |
strategy: | |
fail-fast: false | |
matrix: | |
board: | |
- fqbn: arduino:mbed_portenta:envie_m7 | |
- fqbn: arduino:mbed_nano:nanorp2040connect | |
- fqbn: arduino:mbed_nicla:nicla_vision | |
- fqbn: arduino:mbed_nicla:nicla_sense | |
- fqbn: arduino:mbed_nano:nano33ble | |
- fqbn: arduino:renesas_portenta:portenta_c33 | |
- fqbn: arduino:renesas_uno:unor4wifi | |
- fqbn: arduino:samd:mkrwifi1010 | |
- fqbn: arduino:esp32:nano_nora | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Compile examples | |
uses: arduino/compile-sketches@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
fqbn: ${{ matrix.board.fqbn }} | |
platforms: ${{ matrix.board.platforms }} | |
enable-deltas-report: true | |
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} | |
- name: Save sketches report as workflow artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
path: ${{ env.SKETCHES_REPORTS_PATH }} | |
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} | |
report-size-deltas: | |
needs: build | |
# Run even if some compilations failed. | |
if: always() && github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Download sketches reports artifact | |
id: download-artifact | |
continue-on-error: true # If compilation failed for all boards then there are no artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} | |
path: ${{ env.SKETCHES_REPORTS_PATH }} | |
- name: Comment size deltas report to PR | |
uses: arduino/report-size-deltas@v1 | |
# If actions/download-artifact failed, there are no artifacts to report from. | |
if: steps.download-artifact.outcome == 'success' | |
with: | |
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} |