|
| 1 | +name: Arduino Build Check |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - '**.ino' |
| 7 | + - '**.cpp' |
| 8 | + - '**.hpp' |
| 9 | + - '**.h' |
| 10 | + - '**.c' |
| 11 | + - 'library.properties' |
| 12 | + - '.github/workflows/Arduino-Build-Check.yml' |
| 13 | + pull_request: |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + name: examples (${{ matrix.board }}, M5Unified ${{ matrix.m5unified }}) |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + include: |
| 28 | + # Latest arduino-esp32 with the released libraries (what a user gets from the Library Manager) |
| 29 | + - board: esp32:esp32:esp32s3 |
| 30 | + esp32_version: 3.3.11 |
| 31 | + m5unified: release |
| 32 | + # Same core with the development branches of M5Unified / M5GFX: catches API changes before they are released |
| 33 | + - board: esp32:esp32:esp32s3 |
| 34 | + esp32_version: 3.3.11 |
| 35 | + m5unified: develop |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Install arduino-cli |
| 42 | + run: | |
| 43 | + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 1.1.1 |
| 44 | + echo "$PWD/bin" >> "$GITHUB_PATH" |
| 45 | +
|
| 46 | + - name: Install board package |
| 47 | + run: | |
| 48 | + arduino-cli config init |
| 49 | + arduino-cli config add board_manager.additional_urls https://espressif.github.io/arduino-esp32/package_esp32_index.json |
| 50 | + arduino-cli core update-index |
| 51 | + CORE=$(echo "${{ matrix.board }}" | cut -d: -f1,2) |
| 52 | + arduino-cli core install "${CORE}@${{ matrix.esp32_version }}" |
| 53 | +
|
| 54 | + - name: Install libraries |
| 55 | + run: | |
| 56 | + mkdir -p "$HOME/Arduino/libraries" |
| 57 | + ln -s "$GITHUB_WORKSPACE" "$HOME/Arduino/libraries/StackChan-BSP" |
| 58 | + arduino-cli lib update-index |
| 59 | + # dependencies of library.properties; M5Unit-NFC pulls in M5UnitUnified / M5HAL / M5Utility |
| 60 | + arduino-cli lib install IRremoteESP8266 M5Unit-NFC |
| 61 | + if [ "${{ matrix.m5unified }}" = "develop" ]; then |
| 62 | + git clone --depth 1 --branch develop https://github.com/m5stack/M5GFX.git "$HOME/Arduino/libraries/M5GFX" |
| 63 | + git clone --depth 1 --branch develop https://github.com/m5stack/M5Unified.git "$HOME/Arduino/libraries/M5Unified" |
| 64 | + else |
| 65 | + arduino-cli lib install M5Unified |
| 66 | + fi |
| 67 | + arduino-cli lib list |
| 68 | +
|
| 69 | + - name: Build examples |
| 70 | + run: | |
| 71 | + status=0 |
| 72 | + for ino in $(find examples -name '*.ino' | sort); do |
| 73 | + echo "::group::$ino" |
| 74 | + if arduino-cli compile --fqbn "${{ matrix.board }}" --warnings default "$ino"; then |
| 75 | + echo "OK $ino" |
| 76 | + else |
| 77 | + echo "FAIL $ino" |
| 78 | + status=1 |
| 79 | + fi |
| 80 | + echo "::endgroup::" |
| 81 | + done |
| 82 | + exit $status |
0 commit comments