Skip to content

Commit

Permalink
CI: Add arduino/report-size-deltas action. (#354)
Browse files Browse the repository at this point in the history
This action comments on the pull request with a report on the resulting change in memory usage of the Arduino sketches compiled by the arduino/compile-sketches action.
  • Loading branch information
aentinger authored Mar 19, 2024
1 parent d965fa2 commit 4a85fec
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 13 deletions.
83 changes: 70 additions & 13 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,86 @@
name: Compile Examples

# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
- push
- pull_request
push:
paths:
- ".github/workflows/compile-examples.yml"
- "examples/**"
- "src/**"
pull_request:
paths:
- ".github/workflows/compile-examples.yml"
- "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:

jobs:
build:
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest

env:
SKETCHES_REPORTS_PATH: sketches-reports

strategy:
fail-fast: false

matrix:
fqbn:
- arduino:samd:mkrwifi1010
- arduino:samd:nano_33_iot
- arduino:megaavr:uno2018:mode=on
- arduino:mbed:nano33ble
- arduino:mbed_nano:nanorp2040connect
- arduino:renesas_uno:unor4wifi
board:
- fqbn: arduino:samd:mkrwifi1010
platforms: |
- name: arduino:samd
artifact-name-suffix: arduino-samd-mkrwifi1010
- fqbn: arduino:samd:nano_33_iot
platforms: |
- name: arduino:samd
artifact-name-suffix: arduino-samd-nano_33_iot
- fqbn: arduino:megaavr:uno2018:mode=on
platforms: |
- name: arduino:megaavr
artifact-name-suffix: arduino-megaavr-uno2018
- fqbn: arduino:mbed_nano:nano33ble
platforms: |
- name: arduino:mbed_nano
artifact-name-suffix: arduino-mbed_nano-nano33ble
- fqbn: arduino:mbed_nano:nanorp2040connect
platforms: |
- name: arduino:mbed_nano
artifact-name-suffix: arduino-mbed_nano-nanorp2040connect
- fqbn: arduino:renesas_uno:unor4wifi
platforms: |
- name: arduino:renesas_uno
artifact-name-suffix: arduino-renesas_uno-unor4wifi

steps:
- uses: actions/checkout@v4
- uses: arduino/compile-sketches@v1
- name: Checkout repository
uses: actions/checkout@v4

- name: Compile examples
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: ${{ matrix.fqbn }}

fqbn: ${{ matrix.board.fqbn }}
platforms: ${{ matrix.board.platforms }}
libraries: |
# Install the library from the local path.
- source-path: ./
sketch-paths: |
- examples
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Save sketches report as workflow artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}

build-for-esp32:
runs-on: ubuntu-latest

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/report-size-deltas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Report Size Deltas

# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/report-size-deltas.yml"
schedule:
# Run at the minimum interval allowed by GitHub Actions.
# Note: GitHub Actions periodically has outages which result in workflow failures.
# In this event, the workflows will start passing again once the service recovers.
- cron: "*/5 * * * *"
workflow_dispatch:
repository_dispatch:

jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Comment size deltas reports to PRs
uses: arduino/report-size-deltas@v1
with:
# Regex matching the names of the workflow artifacts created by the "Compile Examples" workflow
sketches-reports-source: ^sketches-report-.+

0 comments on commit 4a85fec

Please sign in to comment.