Skip to content

Commit c32864d

Browse files
authored
Merge pull request #2 from arduino-libraries/aliphys/CompileWorkflowTest
[AE-170] Ensure that the `compile-sketches.yml` workflow works for sketches
2 parents bf3c61e + 9cc0baa commit c32864d

File tree

2 files changed

+64
-44
lines changed

2 files changed

+64
-44
lines changed
Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,96 @@
1+
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/compile-examples-private.md
12
name: Compile Examples
23

3-
on:
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
46
push:
5-
branches: [main]
7+
paths:
8+
- ".github/workflows/compile-examples-private.ya?ml"
9+
- "library.properties"
10+
- "examples/**"
11+
- "src/**"
612
pull_request:
7-
branches: [main]
8-
# Scheduled trigger checks for breakage caused by changes to external resources (libraries, platforms)
13+
paths:
14+
- ".github/workflows/compile-examples-private.ya?ml"
15+
- "library.properties"
16+
- "examples/**"
17+
- "src/**"
918
schedule:
10-
# run every Tuesday at 3 AM UTC
11-
- cron: "0 3 * * 2"
12-
# workflow_dispatch event allows the workflow to be triggered manually
13-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
19+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
20+
- cron: "0 8 * * TUE"
1421
workflow_dispatch:
15-
# repository_dispatch event allows the workflow to be triggered via the GitHub API
16-
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
1722
repository_dispatch:
1823

1924
env:
2025
SKETCHES_REPORTS_PATH: sketches-reports
2126
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
2227

2328
jobs:
24-
compile-examples:
29+
build:
30+
name: ${{ matrix.board.fqbn }}
2531
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
pull-requests: read
35+
36+
strategy:
37+
fail-fast: false
38+
39+
matrix:
40+
board:
41+
- fqbn: arduino:mbed_portenta:envie_m7
42+
type: arduino:mbed_portenta
43+
- fqbn: arduino:renesas_portenta:portenta_c33
44+
type: renesas_portenta
2645

2746
steps:
2847
- name: Checkout repository
2948
uses: actions/checkout@v3
3049

31-
- name: Compile example sketches
50+
- name: Compile examples
3251
uses: arduino/compile-sketches@v1
3352
with:
34-
fqbn: arduino:mbed_portenta:envie_m7
35-
platforms: |
36-
- name: arduino:mbed_portenta
53+
github-token: ${{ secrets.GITHUB_TOKEN }}
54+
fqbn: ${{ matrix.board.fqbn }}
55+
platforms: ${{ matrix.board.platforms }}
3756
libraries: |
57+
# Install the library from the local path.
3858
- source-path: ./
39-
- name: Arduino_POSIXStorage
59+
- name: Arduino_USBHostMbed5
60+
# Additional library dependencies can be listed here.
61+
# See: https://github.com/arduino/compile-sketches#libraries
4062
sketch-paths: |
41-
- examples
63+
- examples
4264
enable-deltas-report: true
43-
enable-warnings-report: true
4465
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
45-
github-token: ${{ secrets.GITHUB_TOKEN }}
4666

47-
- name: Save memory usage change report as artifact
67+
- name: Save sketches report as workflow artifact
4868
uses: actions/upload-artifact@v3
4969
with:
5070
if-no-files-found: error
5171
path: ${{ env.SKETCHES_REPORTS_PATH }}
5272
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
73+
74+
report-size-deltas:
75+
needs: build
76+
# Run even if some compilations failed.
77+
if: always() && github.event_name == 'pull_request'
78+
runs-on: ubuntu-latest
79+
permissions:
80+
pull-requests: write
81+
82+
steps:
83+
- name: Download sketches reports artifact
84+
id: download-artifact
85+
continue-on-error: true # If compilation failed for all boards then there are no artifacts
86+
uses: actions/download-artifact@v3
87+
with:
88+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
89+
path: ${{ env.SKETCHES_REPORTS_PATH }}
90+
91+
- name: Comment size deltas report to PR
92+
uses: arduino/report-size-deltas@v1
93+
# If actions/download-artifact failed, there are no artifacts to report from.
94+
if: steps.download-artifact.outcome == 'success'
95+
with:
96+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

.github/workflows/report-size-deltas.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)