forked from sensorium/Mozzi
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (146 loc) · 6.02 KB
/
compile_examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Compile Examples
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
paths:
- ".github/workflows/**"
- "examples/**"
- "**.cpp"
- "**.h"
- "**.hpp"
pull_request:
paths:
- ".github/workflows/**"
- "examples/**"
- "**.cpp"
- "**.h"
- "**.hpp"
workflow_dispatch:
repository_dispatch:
jobs:
# debounce job to reduce duplicate compilations, taken from https://stackoverflow.com/questions/75714742/do-not-trigger-github-action-workflow-on-push-if-a-pr-is-open-on-the-branch
debounce:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
outputs:
abort: ${{ steps.debounce.outputs.abort }}
steps:
- name: Debounce
if: github.event_name == 'push'
id: debounce
run: |
pr_branches=$(gh pr list --repo $GITHUB_REPOSITORY -q '.[] | select(.isCrossRepository == false)' --json isCrossRepository --json headRefName)
this_branch=$(echo $GITHUB_REF | sed -e 's/refs\/heads\///')
if [[ $(echo "$pr_branches" | grep "$this_branch") ]]; then
echo "This push is associated with a pull request. Skipping the job."
echo "abort=true" >> "$GITHUB_OUTPUT"
fi
build:
name: ${{ matrix.board.fqbn }}
runs-on: ubuntu-latest
needs: debounce
if: needs.debounce.outputs.abort != 'true'
env:
SKETCHES_REPORTS_PATH: sketches-reports
strategy:
fail-fast: false
# Of course we'll want to add all supported arches. See https://github.com/arduino-libraries/ArduinoIoTCloud/blob/master/.github/workflows/compile-examples.yml for a complex multi-board setup
matrix:
board:
- fqbn: arduino:avr:uno
platforms: |
- name: arduino:avr
internalid: arduino_uno # This is just some unique id string we assign for use in the artifact name (fqbn does not qualify due to containing colons)
- fqbn: arduino:avr:mega
platforms: |
- name: arduino:avr
internalid: arduino_mega
- fqbn: esp8266:esp8266:huzzah
type: 8266
platforms: |
- name: esp8266:esp8266
source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
internalid: esp8266
- fqbn: STMicroelectronics:stm32:GenF1:pnum=BLUEPILL_F103C8
platforms: |
- name: STMicroelectronics:stm32
source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
internalid: stm32_official
- fqbn: arduino:mbed_giga:giga
platforms: |
- name: arduino:mbed_giga
internalid: arduino_giga
# SAMD boards. There is also an Adrafruit fork of this core, and the two seem to have diverged, considerably. I have no idea on the differences.
- fqbn: arduino:samd:adafruit_circuitplayground_m0
platforms: |
- name: arduino:samd
internalid: arduino_samd
- fqbn: rp2040:rp2040:rpipico
type: rp2040
platforms: |
- name: rp2040:rp2040
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
internalid: rp2040
- fqbn: arduino:renesas_uno:minima
platforms: |
- name: arduino:renesas_uno
internalid: arduino_unor4
- fqbn: teensy:avr:teensy36
platforms: |
- name: teensy:avr
source-url: https://www.pjrc.com/teensy/package_teensy_index.json
internalid: teensy36
- fqbn: teensy:avr:teensy41
platforms: |
- name: teensy:avr
source-url: https://www.pjrc.com/teensy/package_teensy_index.json
internalid: teensy41
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Add marker file for github run
run: echo "#define IN_GITHUB_RUNNER 1" > detect_github_runner.h
- name: Compile examples
uses: arduino/compile-sketches@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: ${{ matrix.board.fqbn }}
platforms: ${{ matrix.board.platforms }}
# limit to only some sketches for now, while figuring out the workflow
sketch-paths: |
- examples/01.Basics
- examples/02.Control
- examples/06.Synthesis
libraries: |
- source-path: ./
- name: PinChangeInterrupt
- name: MIDI Library
- name: Arduino_AdvancedAnalog
- name: FixMath
enable-deltas-report: true
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
enable-warnings-report: true
- 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-reports-artifact-${{ matrix.board.internalid }}
# When using a matrix to compile for multiple boards, it's necessary to use a separate job for the deltas report
report:
needs: build # 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
continue-on-error: true # Not the programmer's fault, if reporting fails
runs-on: ubuntu-latest
steps:
# This step is needed to get the size data produced by the compile jobs
- name: Download sketches reports artifact
uses: actions/download-artifact@v4
with:
pattern: sketches-reports-artifact-*
merge-multiple: true
path: ${{ env.SKETCHES_REPORTS_PATH }}
- uses: arduino/report-size-deltas@v1
with:
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}