Skip to content

Commit 0dd94af

Browse files
committed
Add "smoke test" examples compilation CI workflow
On every push or pull request that affects library source or example files, and periodically, compile all example sketches for the specified boards. A report of the resulting change in memory usage of the examples will be commented to PR threads.
1 parent c9ecc44 commit 0dd94af

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Compile Examples
2+
3+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/compile-examples-private.ya?ml"
8+
- "library.properties"
9+
- "examples/**"
10+
- "src/**"
11+
pull_request:
12+
paths:
13+
- ".github/workflows/compile-examples-private.ya?ml"
14+
- "library.properties"
15+
- "examples/**"
16+
- "src/**"
17+
schedule:
18+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
19+
- cron: "0 8 * * TUE"
20+
workflow_dispatch:
21+
repository_dispatch:
22+
23+
env:
24+
SKETCHES_REPORTS_PATH: sketches-reports
25+
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
26+
27+
jobs:
28+
build:
29+
name: ${{ matrix.board.fqbn }}
30+
runs-on: ubuntu-latest
31+
32+
strategy:
33+
fail-fast: false
34+
35+
matrix:
36+
board:
37+
- fqbn: arduino:mbed_nano:nano33ble
38+
platforms: |
39+
- name: arduino:mbed_nano
40+
- fqbn: arduino:mbed_nano:nanorp2040connect
41+
platforms: |
42+
- name: arduino:mbed_nano
43+
- fqbn: arduino:mbed_portenta:envie_m4
44+
platforms: |
45+
- name: arduino:mbed_portenta
46+
- fqbn: arduino:mbed_portenta:envie_m7
47+
platforms: |
48+
- name: arduino:mbed_portenta
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v2
53+
54+
- name: Compile examples
55+
uses: arduino/compile-sketches@v1
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
fqbn: ${{ matrix.board.fqbn }}
59+
platforms: ${{ matrix.board.platforms }}
60+
libraries: |
61+
# Install the library from the local path.
62+
- source-path: ./
63+
# Additional library dependencies can be listed here.
64+
# See: https://github.com/arduino/compile-sketches#libraries
65+
sketch-paths: |
66+
- examples
67+
enable-deltas-report: true
68+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
69+
70+
- name: Save sketches report as workflow artifact
71+
uses: actions/upload-artifact@v2
72+
with:
73+
if-no-files-found: error
74+
path: ${{ env.SKETCHES_REPORTS_PATH }}
75+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
76+
77+
report-size-deltas:
78+
needs: build
79+
# Run even if some compilations failed.
80+
if: always() && github.event_name == 'pull_request'
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: Download sketches reports artifact
85+
id: download-artifact
86+
continue-on-error: true # If compilation failed for all boards then there are no artifacts
87+
uses: actions/download-artifact@v2
88+
with:
89+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
90+
path: ${{ env.SKETCHES_REPORTS_PATH }}
91+
92+
- name: Comment size deltas report to PR
93+
uses: arduino/report-size-deltas@v1
94+
# If actions/download-artifact failed, there are no artifacts to report from.
95+
if: steps.download-artifact.outcome == 'success'
96+
with:
97+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
======================
33

44
[![Check Arduino status](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/check-arduino.yml)
5+
[![Compile Examples status](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/compile-examples-private.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/compile-examples-private.yml)
56
[![Spell Check status](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_ThreadsafeIO/actions/workflows/spell-check.yml)

0 commit comments

Comments
 (0)