diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2aea49f..f0d4c24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,69 +4,73 @@ on: pull_request: workflow_dispatch: permissions: {} +env: + NDNPH_VERSION: develop + esp32platform: | + - name: esp32:esp32 + source-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json + esp32sketches: | + - examples/BlePingServer + - examples/NdncertClient + - examples/PingClient + - examples/PingServer + - examples/unittest + - examples/UnixTime jobs: build: - runs-on: ubuntu-22.04 strategy: matrix: include: - chip: ESP8266 - core-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json - core: esp8266:esp8266 fqbn: esp8266:esp8266:nodemcuv2 + platforms: | + - name: esp8266:esp8266 + source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json + sketches: | + - examples/PingClient + - examples/PingServer + - examples/unittest + - examples/UnixTime - chip: ESP32 - core-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json - core: esp32:esp32 fqbn: esp32:esp32:esp32wrover:PartitionScheme=noota_ffat - arduino-libs: NimBLE-Arduino + platforms: ${{ env.esp32platform }} + libraries: | + - name: NimBLE-Arduino + sketches: ${{ env.esp32sketches }} - chip: ESP32C3 - core-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json - core: esp32:esp32 fqbn: esp32:esp32:esp32c3:PartitionScheme=noota_ffat - arduino-libs: NimBLE-Arduino + platforms: ${{ env.esp32platform }} + sketches: ${{ env.esp32sketches }} + cli-compile-flags: | + - --build-property=build.defines=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1 - chip: nRF52 - core: adafruit:nrf52 fqbn: adafruit:nrf52:feather52832 - core-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json + platforms: | + - name: adafruit:nrf52 + source-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json pip-deps: adafruit-nrfutil + sketches: | + - examples/BlePingServer + - examples/unittest fail-fast: false name: ${{ matrix.chip }} + runs-on: ubuntu-22.04 steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.11' + - run: pip install --user ${{ matrix.pip-deps }} if: ${{ matrix.pip-deps }} - - uses: arduino/setup-arduino-cli@v1 - - id: cores - name: Refresh Arduino cores - run: | - arduino-cli version - arduino-cli update --additional-urls "${{ matrix.core-url }}" - echo d=$(sha256sum ~/.arduino15/package_*index.json | sha256sum | cut -d' ' -f1) >> $GITHUB_OUTPUT - - name: Cache Arduino cores - uses: actions/cache@v4 - with: - path: ~/.arduino15/staging/packages - key: cores-${{ steps.cores.outputs.d }} - - name: Install Arduino cores - run: | - arduino-cli core install ${{ matrix.core }} --additional-urls "${{ matrix.core-url }}" - echo ${{ matrix.pip-deps }} | xargs -r pip install - echo ArduinoUnit ${{ matrix.arduino-libs }} | xargs -rn1 arduino-cli lib install - uses: actions/checkout@v4 - - name: Prepare Arduino libraries - run: | - mkdir -p $HOME/Arduino/libraries - cd $HOME/Arduino/libraries - ln -s $GITHUB_WORKSPACE esp8266ndn - mkdir NDNph - curl -fsLS https://github.com/yoursunny/NDNph/archive/${NDNPH_VERSION}.tar.gz | tar -C NDNph -xz --strip-components=1 - ln -s $HOME/Arduino/libraries/NDNph $GITHUB_WORKSPACE/../NDNph # for Doxygen - env: - NDNPH_VERSION: develop - - name: Compile examples - run: | - mk/ci-list.sh ${{ matrix.chip }} ${{ matrix.fqbn }} | bash + - uses: arduino/compile-sketches@v1 + with: + fqbn: ${{ matrix.fqbn }} + platforms: ${{ matrix.platforms }} + libraries: | + - source-path: ./ + - source-url: https://github.com/yoursunny/NDNph.git + version: ${{ env.NDNPH_VERSION }} + - name: ArduinoUnit + ${{ matrix.libraries }} + sketch-paths: ${{ matrix.sketches }} + cli-compile-flags: ${{ matrix.cli-compile-flags }} publish: needs: [build] runs-on: ubuntu-22.04 diff --git a/examples/BlePingServer/.ci.json b/examples/BlePingServer/.ci.json deleted file mode 100644 index 2fd1f7a..0000000 --- a/examples/BlePingServer/.ci.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "ESP8266": [], - "ESP32": [ - "", - "--build-property=build.defines=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1" - ], - "ESP32C3": [ - "", - "--build-property=build.defines=-DDEMO_BLEPINGSERVER_DISABLE_NIMBLE=1" - ] -} diff --git a/examples/NdncertClient/.ci.json b/examples/NdncertClient/.ci.json deleted file mode 100644 index a26064f..0000000 --- a/examples/NdncertClient/.ci.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "ESP8266": [], - "nRF52": [] -} diff --git a/examples/PingClient/.ci.json b/examples/PingClient/.ci.json deleted file mode 100644 index dee9144..0000000 --- a/examples/PingClient/.ci.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nRF52": [] -} diff --git a/examples/PingServer/.ci.json b/examples/PingServer/.ci.json deleted file mode 100644 index dee9144..0000000 --- a/examples/PingServer/.ci.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nRF52": [] -} diff --git a/examples/UnixTime/.ci.json b/examples/UnixTime/.ci.json deleted file mode 100644 index dee9144..0000000 --- a/examples/UnixTime/.ci.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nRF52": [] -} diff --git a/mk/ci-list.sh b/mk/ci-list.sh deleted file mode 100755 index 3ca37a0..0000000 --- a/mk/ci-list.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -euo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")"/.. -CHIP=$1 -FQBN=$2 - -echo 'set -euo pipefail' -for E in $(find ./examples -name '*.ino' -printf '%h\n'); do - if [[ -f $E/.ci.json ]]; then - cat $E/.ci.json - else - echo '{}' - fi | jq -r --arg chip $CHIP --arg fqbn $FQBN --arg sketch $E ' - .[$chip] // [""] | .[] | - [ - "printf \"\\n----\\033[1;35m Build " + - ($sketch | sub(".*/"; "")) + " in " + $fqbn + - (if .!="" then " with " + . else "" end) + - " \\033[0m----\\n\"", - "arduino-cli compile -b " + $fqbn + " --warnings more " + $sketch + " " + . - ] | .[] - ' -done