-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (191 loc) · 7.13 KB
/
build-platformio.yml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# 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:
# 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
build_flags: -DIOTSA_WITH_HTTPS
board: nodemcuv2
- example: Led
build_flags: -DIOTSA_WITH_HTTPS
board: esp32thing
# Extra build: Led with COAP
- example: Led
build_flags: -DIOTSA_WITH_COAP
board: nodemcuv2
- example: Led
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@v2
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 }}" }'