Skip to content

Commit

Permalink
[CI] Update compile-examples and report-size-deltas for released libr…
Browse files Browse the repository at this point in the history
…aries. (#32)
  • Loading branch information
aentinger authored Oct 29, 2024
1 parent 856acf5 commit a296428
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 30 deletions.
63 changes: 33 additions & 30 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
name: Compile Examples

# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
- push
- pull_request

env:
# It's convenient to set variables for values used multiple times in the workflow.
SKETCHES_REPORTS_PATH: sketches-reports
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:
compile:
build:
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest

env:
SKETCHES_REPORTS_PATH: sketches-reports

strategy:
fail-fast: false

matrix:
board:
- fqbn: arduino:mbed_opta:opta
artifact-name-suffix: arduino-mbed_opta-opta

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4

- uses: arduino/compile-sketches@v1
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
fqbn: ${{ matrix.board.fqbn }}
platforms: ${{ matrix.board.platforms }}
libraries: |
# Install the library from the local path.
- source-path: ./
- name: Arduino_Opta_Blueprint
- name: Arduino_SerialUpdater
- name: Arduino_DebugUtils
- name: ArduinoRS485
- name: ArduinoModbus
sketch-paths: |
- examples
enable-deltas-report: true
github-token: ${{ secrets.GITHUB_TOKEN }}
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
cli-compile-flags: |
- --build-property
- compiler.cpp.extra_flags=-DUSE_MODBUS_SENSOR_MD02=1
# This step is needed to pass the size data to the report job.
- name: Upload sketches report to workflow artifact
- name: Save sketches report as workflow artifact
uses: actions/upload-artifact@v4
with:
name: sketches-reports-${{ matrix.board.artifact-name-suffix }}
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}

# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
report:
needs: compile # Wait for the compile job to finish to get the data for the report
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
runs-on: ubuntu-latest

steps:
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifacts
uses: actions/download-artifact@v4
with:
# All workflow artifacts will be downloaded to this location.
path: ${{ env.SKETCHES_REPORTS_PATH }}

- uses: arduino/report-size-deltas@v1
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
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 a296428

Please sign in to comment.