-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (135 loc) · 4.86 KB
/
ci.yml
File metadata and controls
155 lines (135 loc) · 4.86 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
host-tests:
name: Host tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Configure
run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON
- name: Build
run: cmake --build build --parallel
- name: Test
working-directory: build
run: ctest --output-on-failure
warnings:
name: Strict warnings (gcc + clang)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
steps:
- uses: actions/checkout@v4
- name: Configure
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
run: cmake -B build -DMIDI2CPP_BUILD_TESTS=ON
- name: Build with -Werror
run: cmake --build build --parallel -- CXXFLAGS=-Werror CFLAGS=-Werror
pico-sdk-example:
name: Pico SDK build (examples/rp2040-midi2)
runs-on: ubuntu-latest
needs: host-tests
steps:
- uses: actions/checkout@v4
- name: Install ARM toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-none-eabi cmake build-essential
- name: Clone Pico SDK (with submodules)
run: |
git clone --depth 1 -b 2.1.0 \
https://github.com/raspberrypi/pico-sdk.git "$HOME/pico-sdk"
cd "$HOME/pico-sdk"
git submodule update --init --depth 1
- name: Configure + build rp2040-midi2-showcase
env:
PICO_SDK_PATH: ${{ github.workspace }}/../pico-sdk
working-directory: examples/rp2040-midi2
run: |
export PICO_SDK_PATH="$HOME/pico-sdk"
cmake -B build
cmake --build build --target rp2040-midi2-showcase --parallel
- name: Verify UF2 produced
working-directory: examples/rp2040-midi2
run: |
ls -la build/rp2040-midi2-showcase.uf2
arm-none-eabi-size build/rp2040-midi2-showcase.elf
- name: Upload UF2 artifact
uses: actions/upload-artifact@v4
with:
name: rp2040-midi2-showcase-${{ github.sha }}
path: examples/rp2040-midi2/build/rp2040-midi2-showcase.uf2
retention-days: 14
arduino-compile:
name: Arduino compile (${{ matrix.fqbn }})
runs-on: ubuntu-latest
needs: host-tests
strategy:
fail-fast: false
matrix:
fqbn:
- rp2040:rp2040:rpipico
# Teensy and ESP32 cores require additional setup; enable when
# the boards manager URL + tool toolchain are stable in CI.
# - teensy:avr:teensy41
# - esp32:esp32:esp32s3
include:
- fqbn: rp2040:rp2040:rpipico
platform: rp2040:rp2040
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
steps:
- uses: actions/checkout@v4
- name: Setup arduino-cli
uses: arduino/setup-arduino-cli@v2
- name: Install board core
run: |
arduino-cli config init
arduino-cli config add board_manager.additional_urls ${{ matrix.url }}
arduino-cli core update-index
arduino-cli core install ${{ matrix.platform }}
- name: Symlink lib for arduino-cli sketch resolution
run: |
mkdir -p ~/Arduino/libraries
ln -s "$GITHUB_WORKSPACE" ~/Arduino/libraries/midi2cpp
- name: Install midi2 dependency from Library Manager
# midi2cpp depends on midi2 (>=0.3.4) but arduino-cli does not
# walk depends= entries automatically. Install it explicitly.
# Falls back to the GitHub git URL if the registry index has
# not propagated yet (Library Manager indexes within 24h of a
# registry merge).
run: |
arduino-cli lib update-index
arduino-cli lib install midi2 || \
(arduino-cli config set library.enable_unsafe_install true && \
arduino-cli lib install --git-url https://github.com/sauloverissimo/midi2.git#v0.3.4)
- name: Compile Arduino sketches (skip non-sketch dirs)
run: |
shopt -s nullglob
compiled=0
for sketch in examples/*/; do
name=$(basename "$sketch")
inos=("$sketch"*.ino)
if [ ${#inos[@]} -eq 0 ]; then
echo "Skip $name (no .ino files; not an Arduino sketch)"
continue
fi
echo "::group::Compile $name"
arduino-cli compile --fqbn ${{ matrix.fqbn }} --warnings all "$sketch" || exit 1
echo "::endgroup::"
compiled=$((compiled + 1))
done
echo "Compiled $compiled Arduino sketch(es)."