Skip to content

Commit a296428

Browse files
authored
[CI] Update compile-examples and report-size-deltas for released libraries. (#32)
1 parent 856acf5 commit a296428

File tree

2 files changed

+57
-30
lines changed

2 files changed

+57
-30
lines changed
Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
11
name: Compile Examples
22

3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
34
on:
4-
- push
5-
- pull_request
6-
7-
env:
8-
# It's convenient to set variables for values used multiple times in the workflow.
9-
SKETCHES_REPORTS_PATH: sketches-reports
5+
push:
6+
paths:
7+
- ".github/workflows/compile-examples.yml"
8+
- "examples/**"
9+
- "src/**"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/compile-examples.yml"
13+
- "examples/**"
14+
- "src/**"
15+
schedule:
16+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
17+
- cron: "0 8 * * TUE"
18+
workflow_dispatch:
19+
repository_dispatch:
1020

1121
jobs:
12-
compile:
22+
build:
23+
name: ${{ matrix.board.fqbn }}
1324
runs-on: ubuntu-latest
1425

26+
env:
27+
SKETCHES_REPORTS_PATH: sketches-reports
28+
1529
strategy:
30+
fail-fast: false
31+
1632
matrix:
1733
board:
1834
- fqbn: arduino:mbed_opta:opta
1935
artifact-name-suffix: arduino-mbed_opta-opta
2036

2137
steps:
22-
- uses: actions/checkout@v4
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
2340

24-
- uses: arduino/compile-sketches@v1
41+
- name: Compile examples
42+
uses: arduino/compile-sketches@v1
2543
with:
2644
fqbn: ${{ matrix.board.fqbn }}
2745
platforms: ${{ matrix.board.platforms }}
2846
libraries: |
47+
# Install the library from the local path.
2948
- source-path: ./
3049
- name: Arduino_Opta_Blueprint
3150
- name: Arduino_SerialUpdater
3251
- name: Arduino_DebugUtils
3352
- name: ArduinoRS485
3453
- name: ArduinoModbus
54+
sketch-paths: |
55+
- examples
3556
enable-deltas-report: true
3657
github-token: ${{ secrets.GITHUB_TOKEN }}
3758
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
3859
cli-compile-flags: |
3960
- --build-property
4061
- compiler.cpp.extra_flags=-DUSE_MODBUS_SENSOR_MD02=1
4162
42-
# This step is needed to pass the size data to the report job.
43-
- name: Upload sketches report to workflow artifact
63+
- name: Save sketches report as workflow artifact
4464
uses: actions/upload-artifact@v4
4565
with:
46-
name: sketches-reports-${{ matrix.board.artifact-name-suffix }}
66+
if-no-files-found: error
4767
path: ${{ env.SKETCHES_REPORTS_PATH }}
48-
49-
# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
50-
report:
51-
needs: compile # Wait for the compile job to finish to get the data for the report
52-
if: github.event_name == 'pull_request' # Only run the job when the workflow is triggered by a pull request
53-
runs-on: ubuntu-latest
54-
55-
steps:
56-
# This step is needed to get the size data produced by the compile jobs
57-
- name: Download sketches reports artifacts
58-
uses: actions/download-artifact@v4
59-
with:
60-
# All workflow artifacts will be downloaded to this location.
61-
path: ${{ env.SKETCHES_REPORTS_PATH }}
62-
63-
- uses: arduino/report-size-deltas@v1
64-
with:
65-
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}
68+
name: sketches-report-${{ matrix.board.artifact-name-suffix }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Report Size Deltas
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/report-size-deltas.yml"
8+
schedule:
9+
# Run at the minimum interval allowed by GitHub Actions.
10+
# Note: GitHub Actions periodically has outages which result in workflow failures.
11+
# In this event, the workflows will start passing again once the service recovers.
12+
- cron: "*/5 * * * *"
13+
workflow_dispatch:
14+
repository_dispatch:
15+
16+
jobs:
17+
report:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Comment size deltas reports to PRs
21+
uses: arduino/report-size-deltas@v1
22+
with:
23+
# Regex matching the names of the workflow artifacts created by the "Compile Examples" workflow
24+
sketches-reports-source: ^sketches-report-.+

0 commit comments

Comments
 (0)