Skip to content

Also pin NimbleArduino version in library.json. #310

Also pin NimbleArduino version in library.json.

Also pin NimbleArduino version in library.json. #310

# Created this action based on information found in:
# - <https://docs.platformio.org/en/latest/integration/ci/github-actions.html>
# - <https://docs.github.com/en/free-pro-team@latest/actions/quickstart>
name: build-platformio
on:
push:
paths-ignore:
- '.github/workflows/build-arduino.yml'
- 'docs/**'
pull_request:
workflow_dispatch:
inputs:
iotsa_ref:
description: 'iotsa branch, ref or sha'
required: true
detault: develop
jobs:
#
# Job#1 - Build all examples for all platforms, upload binaries as artifacts
#
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board:
- nodemcuv2
- esp32thing
- esp32-c3-devkitm-1
example:
- Hello
- HelloApi
- HelloCpp
- HelloPasswd
- HelloRights
- HelloToken
- HelloUser
- Led
- Light
- Log
- Skeleton
- Button
- Ringer
- BLELed
- Temperature
- DateTime
variant: [""]
build_flags: [""]
# Exclude the "normal" Temperature matrix entries: it needs extra libraries specified.
exclude:
- example: Temperature
# Extra matrix entries:
include:
- board: esp32thing
pio_extra_args: --project-option="board_build.partitions=min_spiffs.csv"
# Add esp32c3 build flags
- board: esp32-c3-devkitm-1
board_build_flags: -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1
# pio_extra_args: --project-option="lib_ignore=madhephaestus/ESP32Encoder"
# Add Temperature with the right options for including the library
- example: Temperature
board: nodemcuv2
build_flags:
pio_extra_args: --project-option="lib_deps=adafruit/DHT sensor library"
- example: Temperature
board: esp32thing
build_flags:
pio_extra_args: --project-option="lib_deps=adafruit/DHT sensor library"
# Extra build: Led with HTTPS
- example: Led
variant: withhttps-
build_flags: -DIOTSA_WITH_HTTPS
board: nodemcuv2
- example: Led
variant: withhttps-
build_flags: -DIOTSA_WITH_HTTPS
board: esp32thing
# Extra build: Led with COAP
- example: Led
variant: withcoap-
build_flags: -DIOTSA_WITH_COAP
board: nodemcuv2
- example: Led
variant: withcoap-
build_flags: -DIOTSA_WITH_COAP
board: esp32thing
# Extra build: Led with only COAP support (no web, no rest, no http/s)
- example: Led
variant: onlycoap-
build_flags: -DIOTSA_WITH_COAP -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITH_PLACEHOLDERS
board: nodemcuv2
- example: Led
variant: onlycoap-
build_flags: -DIOTSA_WITH_COAP -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITH_PLACEHOLDERS
board: esp32thing
# Extra build: BLELed with BLE added
- example: BLELed
variant: withble-
board: esp32thing
build_flags: -DIOTSA_WITH_BLE
pio_extra_args: --project-option="board_build.partitions=min_spiffs.csv"
- example: BLELed
variant: withble-
board: esp32-c3-devkitm-1
build_flags: -DIOTSA_WITH_BLE
pio_extra_args: --project-option="board_build.partitions=min_spiffs.csv"
# # Extra build: BLELed with only BLE (no web, http/s, rest, wifi)
# # Does not build currently: info/getHandler/putHandler have nothing to override.
# - example: BLELed
# variant: onlyble-
# board: esp32thing
# build_flags: -DIOTSA_WITH_BLE -DIOTSA_WITHOUT_COAP -DIOTSA_WITHOUT_WEB -DIOTSA_WITHOUT_API -DIOTSA_WITHOUT_REST -DIOTSA_WITHOUT_HTTP -DIOTSA_WITHOUT_HTTPS -DIOTSA_WITH_PLACEHOLDERS
# pio_extra_args: --project-option="board_build.partitions=min_spiffs.csv"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles','**/platformio.ini') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Install PlatformIO dependencies
run: |
pio pkg install
- name: Run PlatformIO
run: |
rm -rf /tmp/pio-build
pio ci --lib="." --project-option="lib_ldf_mode=deep+" --project-option="lib_compat_mode=strict" ${{ matrix.pio_extra_args }} --board=${{ matrix.board }} --keep-build-dir --build-dir /tmp/pio-build
env:
PLATFORMIO_CI_SRC: examples/${{ matrix.example }}
PLATFORMIO_BUILD_FLAGS: ${{ matrix.build_flags }} ${{ matrix.board_build_flags }}
IOTSA_CONFIG_PROGRAM_NAME: ${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}
# For some reason the program name change isn't picked up by pio ci.
- name: Copy build output
run: |
cp /tmp/pio-build/.pio/build/${{ matrix.board }}/firmware.bin ${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}.bin
# cp /tmp/pio-build/.pio/build/${{ matrix.board }}/${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}.bin ${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}.bin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}.bin
path: ${{ matrix.example }}-${{ matrix.variant }}${{ matrix.board }}.bin
#
# Job#2 - dispatch build event to dependent repositories
#
dispatch:
if: ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/') ) }}
needs: build
strategy:
matrix:
repo:
- cwi-dis/iotsa433
- cwi-dis/iotsaBLELed
- cwi-dis/iotsaDMXLedstrip
- cwi-dis/iotsaDMXSensor
- cwi-dis/iotsaDisplayServer
- cwi-dis/iotsaDoorOpener
- cwi-dis/iotsaDoorbellButton
- cwi-dis/iotsaDoorbellRinger
- cwi-dis/iotsaGPIO
- cwi-dis/iotsaMotorServer
- cwi-dis/iotsaNeoClock
- cwi-dis/iotsaOLED
- cwi-dis/iotsaRGBWSensor
- cwi-dis/iotsaResponseTime
- cwi-dis/iotsaSensor
- cwi-dis/iotsaSmartMeter
- cwi-dis/lissabon
runs-on: ubuntu-latest
env:
iotsa_ref: ${{ github.sha }}
steps:
- name: Set iotsa_ref
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
echo "iotsa_ref=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: ${{ matrix.repo }}
event-type: rebuild
# Note this always uses the SHA. It may be better to use github.ref if it is refs/tags/xxxxxx
client-payload: '{"iotsa_ref" : "${{ env.iotsa_ref }}" }'