|
| 1 | +name: Arduino CLI CI build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + tags: [ "v*" ] |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build ${{ matrix.board.name }} - ${{ matrix.sketch }} |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + sketch: |
| 19 | + - ml_audio_test |
| 20 | + - ml_midi_monitor |
| 21 | + |
| 22 | + board: |
| 23 | + |
| 24 | + # ESP32 |
| 25 | + - name: "ESP32 Dev Module" |
| 26 | + fname: "esp32" |
| 27 | + fqbn: "esp32:esp32:esp32" |
| 28 | + core: "esp32:esp32@3.2.1" |
| 29 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 30 | + family: "ESP32" |
| 31 | + extra_libs: "" |
| 32 | + options: "" |
| 33 | + |
| 34 | + - name: "ESP32S2 Dev Module" |
| 35 | + fname: "esp32s2" |
| 36 | + fqbn: "esp32:esp32:esp32s2" |
| 37 | + core: "esp32:esp32@3.2.1" |
| 38 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 39 | + family: "ESP32" |
| 40 | + extra_libs: "" |
| 41 | + options: "" |
| 42 | + |
| 43 | + - name: "LOLIN S2 Mini" |
| 44 | + fname: "lolin_s2_mini" |
| 45 | + fqbn: "esp32:esp32:lolin_s2_mini" |
| 46 | + core: "esp32:esp32@3.2.1" |
| 47 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 48 | + family: "ESP32" |
| 49 | + extra_libs: "" |
| 50 | + options: "" |
| 51 | + |
| 52 | + - name: "ESP32S3 Dev Module" |
| 53 | + fname: "esp32s3" |
| 54 | + fqbn: "esp32:esp32:esp32s3" |
| 55 | + core: "esp32:esp32@3.2.1" |
| 56 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 57 | + family: "ESP32" |
| 58 | + extra_libs: "" |
| 59 | + options: "" |
| 60 | + |
| 61 | + - name: "ESP32C3 Dev Module" |
| 62 | + fname: "esp32c3" |
| 63 | + fqbn: "esp32:esp32:esp32c3" |
| 64 | + core: "esp32:esp32@3.2.1" |
| 65 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 66 | + family: "ESP32" |
| 67 | + extra_libs: "" |
| 68 | + options: "" |
| 69 | + |
| 70 | + - name: "XIAO_ESP32C3" |
| 71 | + fname: "xiao_esp32c3" |
| 72 | + fqbn: "esp32:esp32:XIAO_ESP32C3" |
| 73 | + core: "esp32:esp32@3.2.1" |
| 74 | + urls: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" |
| 75 | + extra_libs: "" |
| 76 | + options: "" |
| 77 | + |
| 78 | + # ESP8266 |
| 79 | + - name: "Generic ESP8266 Module" |
| 80 | + fname: "esp8266" |
| 81 | + fqbn: "esp8266:esp8266:generic" |
| 82 | + core: "esp8266:esp8266@3.1.2" |
| 83 | + urls: "http://arduino.esp8266.com/stable/package_esp8266com_index.json" |
| 84 | + family: "ESP8266" |
| 85 | + extra_libs: "" |
| 86 | + options: "" |
| 87 | + |
| 88 | + # RP2040 |
| 89 | + - name: "Raspberry Pi Pico" |
| 90 | + fname: "pico_rp2040" |
| 91 | + fqbn: "rp2040:rp2040:rpipico" |
| 92 | + family: "rp2040" |
| 93 | + arduino_board: "Raspberry Pi Pico/RP2040/RP2350" |
| 94 | + core: "rp2040:rp2040" |
| 95 | + urls: "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" |
| 96 | + extra_libs: "'MIDI Library@5.0.2'" |
| 97 | + options: "usbstack=tinyusb" |
| 98 | + |
| 99 | + - name: "Raspberry Pi Pico 2" |
| 100 | + fname: "pico2_rp2350" |
| 101 | + fqbn: "rp2040:rp2040:rpipico2" |
| 102 | + family: "rp2350-arm-s --abs-block" |
| 103 | + arduino_board: "Raspberry Pi Pico/RP2040/RP2350" |
| 104 | + core: "rp2040:rp2040" |
| 105 | + urls: "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" |
| 106 | + extra_libs: "'MIDI Library@5.0.2'" |
| 107 | + options: "usbstack=tinyusb" |
| 108 | + |
| 109 | + - name: "Pimoroni PicoPlus2" |
| 110 | + fname: "pimoroni_pico_plus2" |
| 111 | + fqbn: "rp2040:rp2040:pimoroni_pico_plus_2" |
| 112 | + family: "rp2350-arm-s --abs-block" |
| 113 | + arduino_board: "Raspberry Pi Pico/RP2040/RP2350" |
| 114 | + core: "rp2040:rp2040" |
| 115 | + urls: "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" |
| 116 | + extra_libs: "'MIDI Library@5.0.2'" |
| 117 | + options: "usbstack=tinyusb" |
| 118 | + |
| 119 | + # Seeeduino |
| 120 | + - name: "Seeeduino XIAO (SAMD21)" |
| 121 | + fname: "xiao_samd21" |
| 122 | + fqbn: "Seeeduino:samd:seeed_XIAO_m0" |
| 123 | + family: "SAMD21" |
| 124 | + arduino_board: "Seeed SAMD Boards" |
| 125 | + core: "Seeeduino:samd@1.8.5" |
| 126 | + urls: "https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" |
| 127 | + extra_libs: "" |
| 128 | + options: "" |
| 129 | + |
| 130 | + # STM32 |
| 131 | + - name: "Generic STM32F4 Series - BlackPill F411CE" |
| 132 | + fname: "genf4_blackpill_stm32f411ce" |
| 133 | + fqbn: "STMicroelectronics:stm32:GenF4:pnum=BLACKPILL_F411CE" |
| 134 | + core: "STMicroelectronics:stm32" |
| 135 | + urls: "https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json" |
| 136 | + family: "STM32" |
| 137 | + extra_libs: "" |
| 138 | + options: "" |
| 139 | + |
| 140 | + - name: "Generic STM32H7 Series - Daisy Seed" |
| 141 | + fname: "genh7_daisy_seed" |
| 142 | + fqbn: "STMicroelectronics:stm32:GenH7:pnum=DAISY_SEED" |
| 143 | + core: "STMicroelectronics:stm32" |
| 144 | + urls: "https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json" |
| 145 | + family: "STM32H7" |
| 146 | + extra_libs: "DaisyDuino@1.7.0" |
| 147 | + options: "" |
| 148 | + |
| 149 | + # Teensy |
| 150 | + - name: "Teensy 4.1" |
| 151 | + fname: "teensy41" |
| 152 | + fqbn: "teensy:avr:teensy41" |
| 153 | + core: "teensy:avr" |
| 154 | + urls: "https://www.pjrc.com/teensy/package_teensy_index.json" |
| 155 | + family: "Teensy" |
| 156 | + extra_libs: "" |
| 157 | + options: "" |
| 158 | + |
| 159 | + exclude: |
| 160 | + - board: |
| 161 | + name: "XIAO_ESP32C3" |
| 162 | + sketch: ml_audio_test |
| 163 | + |
| 164 | + - board: |
| 165 | + name: "ESP32C3 Dev Module" |
| 166 | + sketch: ml_audio_test |
| 167 | + |
| 168 | + - board: |
| 169 | + name: "Generic STM32F4 Series - BlackPill F411CE" |
| 170 | + sketch: ml_audio_test |
| 171 | + |
| 172 | + steps: |
| 173 | + - uses: actions/checkout@v4 |
| 174 | + with: |
| 175 | + submodules: true |
| 176 | + |
| 177 | + - name: Install Arduino CLI |
| 178 | + uses: arduino/setup-arduino-cli@v1 |
| 179 | + |
| 180 | + - name: Install core |
| 181 | + run: | |
| 182 | + arduino-cli core update-index --additional-urls ${{ matrix.board.urls }} |
| 183 | + arduino-cli core install ${{ matrix.board.core }} --additional-urls ${{ matrix.board.urls }} |
| 184 | +
|
| 185 | + - name: Install libraries |
| 186 | + run: | |
| 187 | + arduino-cli lib install \ |
| 188 | + "Adafruit GFX Library@1.10.10" \ |
| 189 | + "Adafruit SSD1306@2.4.5" \ |
| 190 | + "Adafruit BusIO@1.14.1" |
| 191 | +
|
| 192 | + if [ ! -z "${{ matrix.board.extra_libs }}" ]; then |
| 193 | + arduino-cli lib install ${{ matrix.board.extra_libs }} |
| 194 | + fi |
| 195 | +
|
| 196 | + - name: Install Custom Libraries |
| 197 | + run: | |
| 198 | + mkdir -p ~/Arduino/libraries |
| 199 | +
|
| 200 | + git clone --depth 1 https://github.com/marcel-licence/ML_SynthTools.git \ |
| 201 | + ~/Arduino/libraries/ML_SynthTools |
| 202 | +
|
| 203 | + git clone --depth 1 https://github.com/marcel-licence/ML_SynthTools_Lib.git \ |
| 204 | + ~/Arduino/libraries/ML_SynthTools_Lib |
| 205 | +
|
| 206 | + - name: Compile Sketch |
| 207 | + run: | |
| 208 | + FULL_FQBN="${{ matrix.board.fqbn }}" |
| 209 | + if [ ! -z "${{ matrix.board.options }}" ]; then |
| 210 | + FULL_FQBN="${FULL_FQBN}:${{ matrix.board.options }}" |
| 211 | + fi |
| 212 | +
|
| 213 | + arduino-cli compile \ |
| 214 | + --fqbn "$FULL_FQBN" \ |
| 215 | + --output-dir build/${{ matrix.board.fname }}-${{ matrix.sketch }} \ |
| 216 | + examples/${{ matrix.sketch }} |
| 217 | +
|
| 218 | + - name: Generate UF2 (SAMD21) |
| 219 | + if: matrix.board.family == 'SAMD21' |
| 220 | + run: | |
| 221 | + BIN_FILE=$(find build -name "*.bin" | head -n 1) |
| 222 | + curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2conv.py -o uf2conv.py |
| 223 | + curl -L https://raw.githubusercontent.com/microsoft/uf2/master/utils/uf2families.json -o uf2families.json |
| 224 | + python3 uf2conv.py "$BIN_FILE" --family ${{ matrix.board.family }} --convert --output build/firmware.uf2 |
| 225 | +
|
| 226 | + - name: Rename UF2 (RP2xxx) |
| 227 | + if: contains(matrix.board.family, 'rp2') |
| 228 | + run: mv build/*.uf2 build/firmware.uf2 || true |
| 229 | + |
| 230 | + - name: Upload Artifact |
| 231 | + uses: actions/upload-artifact@v4 |
| 232 | + with: |
| 233 | + name: firmware-${{ matrix.board.fname }}-${{ matrix.sketch }} |
| 234 | + path: build/${{ matrix.board.fname }}-${{ matrix.sketch }} |
| 235 | + |
| 236 | + - name: Create Release |
| 237 | + if: startsWith(github.ref, 'refs/tags/') |
| 238 | + uses: softprops/action-gh-release@v2 |
| 239 | + with: |
| 240 | + files: | |
| 241 | + build/**/*.bin |
| 242 | + build/**/*.uf2 |
| 243 | + build/**/*.hex |
| 244 | + env: |
| 245 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments