Skip to content

Commit 4440083

Browse files
authored
Merge pull request #4 from per1234/ci
Add Github Actions workflow to compile examples
2 parents 93a9146 + 12af024 commit 4440083

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Compile Examples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/workflows/compile-examples.yml"
7+
- "src/**"
8+
- "examples/**"
9+
push:
10+
paths:
11+
- ".github/workflows/compile-examples.yml"
12+
- "src/**"
13+
- "examples/**"
14+
# Scheduled trigger checks for breakage caused by changes to external resources (libraries, platforms)
15+
schedule:
16+
# run every Tuesday at 3 AM UTC
17+
- cron: "0 3 * * 2"
18+
# workflow_dispatch event allows the workflow to be triggered manually
19+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
20+
workflow_dispatch:
21+
# repository_dispatch event allows the workflow to be triggered via the GitHub API
22+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
23+
repository_dispatch:
24+
25+
env:
26+
SKETCHES_REPORTS_PATH: sketches-reports
27+
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
28+
29+
jobs:
30+
compile-examples:
31+
runs-on: ubuntu-latest
32+
33+
env:
34+
ARDUINOCORE_MBED_STAGING_PATH: extras/ArduinoCore-mbed
35+
ARDUINOCORE_API_STAGING_PATH: extras/ArduinoCore-API
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v2
40+
41+
# It's necessary to checkout the platform before installing it so that the ArduinoCore-API dependency can be added
42+
- name: Checkout ArduinoCore-mbed
43+
uses: actions/checkout@v2
44+
with:
45+
repository: arduino/ArduinoCore-mbed
46+
# The arduino/actions/libraries/compile-examples action will install the platform from this path
47+
path: ${{ env.ARDUINOCORE_MBED_STAGING_PATH }}
48+
49+
- name: Remove ArduinoCore-API symlink from Arduino mbed-Enabled Boards platform
50+
run: rm "${{ env.ARDUINOCORE_MBED_STAGING_PATH }}/cores/arduino/api"
51+
52+
- name: Checkout ArduinoCore-API
53+
uses: actions/checkout@v2
54+
with:
55+
repository: arduino/ArduinoCore-API
56+
# As specified at https://github.com/arduino/ArduinoCore-mbed/blob/master/README.md#installation
57+
ref: namespace_arduino
58+
path: ${{ env.ARDUINOCORE_API_STAGING_PATH }}
59+
60+
- name: Install ArduinoCore-API
61+
run: |
62+
mv "${{ env.ARDUINOCORE_API_STAGING_PATH }}/api" "${{ env.ARDUINOCORE_MBED_STAGING_PATH }}/cores/arduino"
63+
64+
- name: Compile example sketches
65+
uses: arduino/compile-sketches@main
66+
with:
67+
fqbn: arduino-beta:mbed:envie_m7
68+
platforms: |
69+
# Install Arduino mbed-Enabled Boards via Boards Manager for the toolchain
70+
- name: arduino-beta:mbed
71+
# Overwrite the Arduino mbed-Enabled Boards release version with version from the tip of the master branch (located in local path because of the need to first install ArduinoCore-API)
72+
- source-path: extras/ArduinoCore-mbed
73+
name: arduino-beta:mbed
74+
enable-deltas-report: true
75+
enable-warnings-report: true
76+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
77+
github-token: ${{ secrets.GITHUB_TOKEN }}
78+
79+
- name: Save memory usage change report as artifact
80+
uses: actions/upload-artifact@v2
81+
with:
82+
path: ${{ env.SKETCHES_REPORTS_PATH }}
83+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
84+
85+
report:
86+
needs: compile-examples
87+
# Only run the job when the workflow is triggered by a pull request from this repository (because arduino/report-size-deltas requires write permissions)
88+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Download sketches reports artifact
92+
uses: actions/download-artifact@v2
93+
with:
94+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
95+
path: ${{ env.SKETCHES_REPORTS_PATH }}
96+
97+
- uses: arduino/report-size-deltas@main
98+
with:
99+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

0 commit comments

Comments
 (0)