-
-
Notifications
You must be signed in to change notification settings - Fork 411
269 lines (261 loc) · 9.13 KB
/
build.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: PlatformIO CI/CD
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
- 'README.md'
push:
branches:
- master
- build-workflow
paths-ignore:
- 'docs/**'
- 'mkdocs.yml'
- 'LICENSE'
- 'README.md'
schedule:
# do a build once a week at 06:07Z Sunday
- cron: '7 6 * * 0'
workflow_dispatch:
jobs:
build-for-all-boards:
name: Build code for all ESP32 boards
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
platformio-path: ~/.platformio
board:
[
generic.h,
ebox.h,
eboxtube.h,
ecopower.h,
heltec.h,
heltecv2.h,
heltecv21.h,
ttgov1.h,
ttgov2.h,
ttgov21old.h,
ttgov21new.h,
ttgofox.h,
ttgobeam.h,
ttgobeam10.h,
ttgotdisplay.h,
ttgotwristband.h,
fipy.h,
lopy.h,
lopy4.h,
lolin32litelora.h,
lolin32lora.h,
lolin32lite.h,
wemos32oled.h,
wemos32matrix.h,
octopus32.h,
tinypico.h,
tinypicomatrix.h,
m5core.h,
m5fire.h,
olimexpoeiso.h,
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ${{ matrix.platformio-path }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.13"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Copy of necessary files
run: |
cp platformio_orig.ini platformio.ini
cp shared/loraconf_sample.h shared/loraconf.h
cp shared/ota_sample.conf shared/ota.conf
cp shared/paxcounter_orig.conf shared/paxcounter.conf
- name: Clean
run: pio run -t clean -e ci
- name: Run PlatformIO CI for ${{ matrix.board }}
env:
CI_HALFILE: ${{ matrix.board }}
run: pio run -e ci
build-windows-macos:
name: Build code on platforms Windows and MAC
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
include:
- os: macos-latest
path: ~/Library/Caches/pip
platformio-path: ~/Library/Caches/platformio
- os: windows-latest
path: ~\AppData\Local\pip\Cache
platformio-path: ~\AppData\Local\platformio\Cache
board: [generic.h, ttgov21new.h]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ${{ matrix.platformio-path }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.13"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Copy of necessary files
run: |
cp platformio_orig.ini platformio.ini
cp shared/loraconf_sample.h shared/loraconf.h
cp shared/ota_sample.conf shared/ota.conf
cp shared/paxcounter_orig.conf shared/paxcounter.conf
- name: Clean
run: pio run -t clean -e ci
- name: Run PlatformIO CI for ${{ matrix.board }}
env:
CI_HALFILE: ${{ matrix.board }}
run: pio run -e ci
build-s3-usb-stick:
name: Build code for ESP32-S3 boards
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
platformio-path: ~/.platformio
- os: macos-latest
path: ~/Library/Caches/pip
platformio-path: ~/Library/Caches/platformio
- os: windows-latest
path: ~\AppData\Local\pip\Cache
platformio-path: ~\AppData\Local\platformio\Cache
board: [ttgotdongles3.h, ttgotdongledisplays3.h]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ${{ matrix.platformio-path }}
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.13"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Copy of necessary files
run: |
cp platformio_orig_s3.ini platformio.ini
cp shared/loraconf_sample.h shared/loraconf.h
cp shared/ota_sample.conf shared/ota.conf
cp shared/paxcounter_orig.conf shared/paxcounter.conf
- name: Clean
run: pio run -t clean -e ci
- name: Run PlatformIO CI for ${{ matrix.board }}
env:
CI_HALFILE: ${{ matrix.board }}
run: pio run -e ci
deploy-on-testboard:
name: Deploy code on testboard
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~\AppData\Local\platformio\Cache
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9.13"
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Prepare config files for test
run: |
cp platformio_orig.ini platformio.ini
cp shared/loraconf_sample.h shared/loraconf.h
cp shared/ota_sample.conf shared/ota.conf
cp shared/paxcounter_orig.conf shared/paxcounter.conf
# apply test credentials to loraconf.h
sed -i "s/APPEUI\[8\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPEUI }}/" "shared/loraconf.h"
sed -i "s/APPKEY\[16\] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};/${{ secrets.APPKEY }}/" "shared/loraconf.h"
# apply test credentials to ota.conf
sed -i "/OTA_WIFI_SSID/c OTA_WIFI_SSID = ${{ secrets.OTA_WIFI_SSID }}" "shared/ota.conf"
sed -i "/OTA_WIFI_PASS/c OTA_WIFI_PASS = ${{ secrets.OTA_WIFI_PASS }}" "shared/ota.conf"
sed -i "/PAXEXPRESS_USER/c PAXEXPRESS_USER = ${{ secrets.PAXEXPRESS_USER }}" "shared/ota.conf"
sed -i "/PAXEXPRESS_REPO/c PAXEXPRESS_REPO = ${{ secrets.PAXEXPRESS_REPO }}" "shared/ota.conf"
sed -i "/PAXEXPRESS_API_TOKEN/c PAXEXPRESS_API_TOKEN = ${{ secrets.PAXEXPRESS_API_TOKEN }}" "shared/ota.conf"
- name: Build and deploy for testboard
env:
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
run: pio remote -a prenzlpi run -t upload
- name: Wait 120 seconds
run: sleep 120s
shell: bash
- name: Query testboard
uses: cyberman54/[email protected]
id: ttn
with:
#Get latest decoded payload message seen last 120 seconds from testboard
url: 'https://eu1.cloud.thethings.network/api/v3/as/applications/paxcounter-cicd/packages/storage/uplink_message?f_port=1&order=-received_at&last=120s&limit=1&type=uplink_message&field_mask=up.uplink_message.decoded_payload'
method: 'GET'
bearer-token: ${{ secrets.BEARER_TOKEN }}
headers: '{"Accept": "text/event-stream"}'
log-response: false
- name: Check testboard response
run:
echo ${{ fromJson(steps.ttn.outputs.response).data.result.uplink_message.decoded_payload.pax }}