Skip to content

Commit 876365e

Browse files
committed
ci: add platformio ci script
1 parent a51df7b commit 876365e

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: PlatformIO CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*.*.*"]
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/cache@v3
18+
with:
19+
path: |
20+
~/.cache/pip
21+
~/.platformio/.cache
22+
key: ${{ runner.os }}-pio
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.11"
26+
27+
- name: Install PlatformIO Core
28+
run: pip install --upgrade platformio
29+
30+
- name: Build PlatformIO Project
31+
run: pio run -d senseBox-bike-atrai-v2
32+
33+
- name: Create OTA update file
34+
run: |
35+
git clone https://github.com/arduino-libraries/ArduinoIoTCloud.git
36+
37+
pip install crccheck
38+
39+
cd ArduinoIoTCloud/extras/tools
40+
41+
python3 lzss.py --encode ${{ github.workspace }}/senseBox-bike-atrai-v2/.pio/build/sensebox_mcu_esp32s2/firmware.bin ${{ runner.temp }}/firmware.bin.lzss
42+
python3 bin2ota.py ESP32 $${{ runner.temp }}/firmware.bin.lzss ${{ runner.temp }}/firmware.ota
43+
mv ${{ runner.temp }}/firmware.ino.ota ${{ github.workspace }}/senseBox-bike-atrai-v2/.pio/build/sensebox_mcu_esp32s2/senseBox-bike-atrai-v2.bin.ota
44+
mv ${{ github.workspace }}/senseBox-bike-atrai-v2/.pio/build/sensebox_mcu_esp32s2/firmware.bin ${{ github.workspace }}/senseBox-bike-atrai-v2/.pio/build/sensebox_mcu_esp32s2/senseBox-bike-atrai-v2.bin
45+
46+
- name: Export binaries as artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: senseBox-bike-atrai-v2-artifacts
50+
path: ${{ github.workspace }}
51+
52+
release:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Download Firmware Files
57+
uses: actions/download-artifact@v4
58+
with:
59+
path: release
60+
- name: Release Firmware
61+
uses: ncipollo/release-action@v1
62+
if: startsWith(github.ref, 'refs/tags/')
63+
with:
64+
artifacts: "release/**/*.bin, release/**/*.ota"
65+
allowUpdates: true
66+
omitBodyDuringUpdate: true
67+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/compile-sketches.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
platforms: |
3333
- name: esp32:esp32
3434
source-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
35+
version: 2.0.17
3536
sketch-paths: |
3637
- ./senseBox-bike-atrai
3738
- ./senseBox-bike-mcus2
@@ -43,7 +44,7 @@ jobs:
4344
uses: actions/checkout@v4
4445

4546
# For more information: https://github.com/arduino/compile-sketches#readme
46-
- name: Compile sketch
47+
- name: "[Arduino CLI] Compile sketch"
4748
uses: arduino/compile-sketches@v1
4849
with:
4950
fqbn: ${{ matrix.board.fqbn }}

0 commit comments

Comments
 (0)