Skip to content

Any filesystem (SD/SPIFFS/LittleFS/SD_MMC) #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a6cd6aa
Brought spiffs into the scope of this library
tobozo Feb 13, 2021
eb5d6e9
synching
tobozo Sep 9, 2022
787c539
tuan-karma's compiler warning fix (#a0e9e5c)
tobozo Sep 9, 2022
cb9500c
LittleFS/SD/SD_MMC/SPIFFS (any FS) support
tobozo Sep 9, 2022
089a7d6
LittleFS/SD/SD_MMC/SPIFFS (any FS) support
tobozo Sep 9, 2022
800d9a4
auto assign filesystem when applicable
tobozo Sep 9, 2022
404fdb8
Added SPIFFS/LittleFS to execOTA()
tobozo Sep 11, 2022
e7aeb78
Added progress handler
tobozo Sep 11, 2022
484e1de
bugfixes and fixtures (#3)
tobozo Sep 11, 2022
47803c4
test suite
tobozo Sep 12, 2022
b03cfd9
test suite
tobozo Sep 12, 2022
23f103d
test suite
tobozo Sep 12, 2022
3633ab3
test suite
tobozo Sep 12, 2022
2c20a59
test suite
tobozo Sep 12, 2022
9001fc9
Added workflow_dispatch to allow manual triggering
tobozo Sep 12, 2022
bc2ccb6
test suite
tobozo Sep 12, 2022
41d1931
cleanup test suite
tobozo Sep 13, 2022
3e1f16a
Implements esp32fota.setExtraHTTPHeader( name, value )
tobozo Sep 13, 2022
c6f670e
Gen test suite (#6)
tobozo Sep 14, 2022
48022b1
Update genTestSuite.yml
tobozo Sep 14, 2022
0a77ad6
Update genTestSuite.yml
tobozo Sep 14, 2022
215bee6
Update genTestSuite.yml
tobozo Sep 14, 2022
58a8268
Update genTestSuite.yml
tobozo Sep 14, 2022
3b3d618
Update genTestSuite.yml
tobozo Sep 14, 2022
35a288b
Update genTestSuite.yml
tobozo Sep 14, 2022
eb9eceb
github is utterly f****d up 😡 😠
tobozo Sep 14, 2022
df50e0b
Create gen-test-suite.yml
tobozo Sep 14, 2022
db99fd0
Update gen-test-suite.yml
tobozo Sep 14, 2022
e03a311
Update gen-test-suite.yml
tobozo Sep 14, 2022
c85a379
Update gen-test-suite.yml
tobozo Sep 14, 2022
62f95dc
Update gen-test-suite.yml
tobozo Sep 14, 2022
166aade
Update 5.final-stage.ino
tobozo Sep 14, 2022
580153b
Update 5.final-stage.ino
tobozo Sep 14, 2022
4755344
Update gen-test-suite.yml
tobozo Sep 14, 2022
995f2c8
Update gen-test-suite.yml
tobozo Sep 14, 2022
1e45c94
Update gen-test-suite.yml
tobozo Sep 14, 2022
7c0e7ce
Update gen-test-suite.yml
tobozo Sep 14, 2022
8ce7e63
Update gen-test-suite.yml
tobozo Sep 14, 2022
56be299
Update gen-test-suite.yml
tobozo Sep 14, 2022
585606b
Update gen-test-suite.yml
tobozo Sep 14, 2022
9ebaeff
Update gen-test-suite.yml
tobozo Sep 14, 2022
b0af696
Update gen-test-suite.yml
tobozo Sep 14, 2022
a460f50
Update gen-test-suite.yml
tobozo Sep 14, 2022
93a94c2
Update firmware.test-suite.json
tobozo Sep 14, 2022
557031b
Update gen-test-suite.yml
tobozo Sep 14, 2022
afc6be7
Update gen-test-suite.yml
tobozo Sep 14, 2022
0068f16
Update 3.cert-in-progmem.ino
tobozo Sep 14, 2022
8833b83
Create root_ca.h
tobozo Sep 14, 2022
cd5d746
Update gen-test-suite.yml
tobozo Sep 14, 2022
deb4dba
Update gen-test-suite.yml
tobozo Sep 14, 2022
0294cbe
update test suite
tobozo Sep 14, 2022
aab04a4
improving flow with manifest
tobozo Sep 14, 2022
337a2dc
C++11 compliance
tobozo Sep 14, 2022
2afd39f
Credits update
tobozo Sep 14, 2022
1f091b2
bump version
tobozo Sep 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/templates/firmware.test-suite.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[{
"type": "FIRMWARE_TYPE",
"version": 1,
"host": "FIRMWARE_HOST",
"port": FIRMWARE_PORT,
"bin": "FIRMWARE_PATH/1.nosecurity.ino.bin?raw=true"
},
{
"type": "FIRMWARE_TYPE",
"version": 2,
"host": "FIRMWARE_HOST",
"port": FIRMWARE_PORT,
"bin": "FIRMWARE_PATH/2.cert-in-spiffs.ino.bin?raw=true",
"spiffs": "FIRMWARE_PATH/2.cert-in-spiffs.spiffs.bin?raw=true"
},
{
"type": "FIRMWARE_TYPE",
"version": 3,
"host": "FIRMWARE_HOST",
"port": FIRMWARE_PORT,
"bin": "FIRMWARE_PATH/3.cert-in-progmem.ino.bin?raw=true"
},
{
"type": "FIRMWARE_TYPE",
"version": 4,
"host": "FIRMWARE_HOST",
"port": FIRMWARE_PORT,
"bin": "FIRMWARE_PATH/4.cert-in-littlefs.ino.bin?raw=true",
"littlefs": "FIRMWARE_PATH/4.cert-in-littlefs.littlefs.bin?raw=true"
},
{
"type": "FIRMWARE_TYPE",
"version": 5,
"host": "FIRMWARE_HOST",
"port": FIRMWARE_PORT,
"bin": "FIRMWARE_PATH/5.final-stage.ino.bin?raw=true"
}]

186 changes: 186 additions & 0 deletions .github/workflows/gen-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Dispatchable build
on:
workflow_dispatch:
inputs:
firmware_type:
description: 'Firmware Type'
default: 'esp32-fota-http'
required: true
type: string
manifest_url:
description: 'Complete URL (where the JSON Manifest will be hosted)'
required: true
default: 'https://github.com/[user]/[repo]/raw/[branch]/[path to manifest]/firmware.json'
type: string
manifest_host:
description: 'Hostname (where the binaries will be hosted)'
required: true
default: 'github.com'
type: string
manifest_port:
description: 'Port (e.g 80 or 443)'
required: true
default: '443'
type: string
manifest_bin_path:
description: 'Path (no trailing slash)'
required: true
default: '/[user]/[repo]/blob/[branch]/[path to binaries]'
type: string
board_fqbn:
description: 'Board FQBN (for arduino-cli)'
required: true
default: 'esp32:esp32:esp32'
type: string
partition_scheme:
description: 'Partition scheme'
required: true
type: choice
options:
- default
- min_spiffs
- large_spiffs
default: 'default'

jobs:

matrix_build:

name: ${{ matrix.sketch }}
runs-on: ubuntu-latest

strategy:
matrix:

sketch:
- 1.nosecurity.ino
- 2.cert-in-spiffs.ino
- 3.cert-in-progmem.ino
- 4.cert-in-littlefs.ino
- 5.final-stage.ino

steps:

- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Inject Manifest URL
run: |
full_ino_path=`find /home/runner/work/ | grep "${{ matrix.sketch }}"`
echo -e "#define FOTA_URL \"${{ inputs.manifest_url }}\"\n$(cat $full_ino_path)" > $full_ino_path


- name: Inject TLS Cert if applicable
if: (inputs.manifest_port == '443' || inputs.manifest_port == '4433')
run: |
full_rootca_path=`find /home/runner/work/ | grep "progmem/root_ca.h"`
ssl_host="${{ inputs.manifest_host }}"
prefix="const char* root_ca =\\"
suffix="\"\";"
echo $prefix > $full_rootca_path
openssl s_client -showcerts -connect $ssl_host:${{ inputs.manifest_port }} </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | awk '{print "\"" $0 "\\n\"\\"}' >> $full_rootca_path
echo $suffix >> $full_rootca_path
cat $full_rootca_path


- name: ${{ matrix.sketch }}
uses: ArminJo/arduino-test-compile@v3
with:
platform-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
arduino-board-fqbn: ${{ inputs.board_fqbn }}:PartitionScheme=${{inputs.partition_scheme}}
required-libraries: ArduinoJson
extra-arduino-lib-install-args: --no-deps
extra-arduino-cli-args: "--warnings default " # see https://github.com/ArminJo/arduino-test-compile/issues/28
sketch-names: ${{ matrix.sketch }}
set-build-path: true
# build-properties: ${{ toJson(matrix.build-properties) }}
# arduino-platform: esp32:esp32@${{ matrix.sdk-version }}
# extra-arduino-cli-args: ${{ matrix.extra-arduino-cli-args }}
# debug-install: true

- name: Save compiled binaries
run: |
mkdir -p /home/runner/builds
ls /home/runner/builds -la
cd /home/runner/work/
full_ino_bin_path=`find . | grep "build/${{ matrix.sketch }}.bin"`
echo "Bin path: $full_ino_bin_path"
cp "$full_ino_bin_path" /home/runner/builds/${{ matrix.sketch }}.bin

- name: Prepare data folder if applicable
if: (inputs.manifest_port == '443' || inputs.manifest_port == '4433')
run: |
full_rootca_path=`find /home/runner/work/ | grep "anyFS/data/root_ca.pem"`
ssl_host="${{ inputs.manifest_host }}"
openssl s_client -showcerts -connect $ssl_host:${{ inputs.manifest_port }} </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > $full_rootca_path
cat $full_rootca_path

- name: Create filesystem images
run: |
# ooh that's dirty :-)
default_size=0x170000
large_spiffs_size=0x6F0000
min_spiffs_size=0x30000

mkspiffs_esp32=~/.arduino15/packages/esp32*/tools/mkspiffs/*/mkspiffs
mklittlefs_esp32=~/.arduino15/packages/esp32*/tools/mklittlefs/*/mklittlefs
echo "mkspiffs path: $mkspiffs_esp32"
echo "mklittlefs path: $mklittlefs_esp32"
$mkspiffs_esp32 -c examples/anyFS/data/ -p 256 -b 4096 -s $${{inputs.partition_scheme}}_size /home/runner/builds/2.cert-in-spiffs.spiffs.bin
$mklittlefs_esp32 -c examples/anyFS/data/ -p 256 -b 4096 -s $${{inputs.partition_scheme}}_size /home/runner/builds/4.cert-in-littlefs.littlefs.bin
ls /home/runner/builds -la

- name: Upload artifact for Stage ${{ matrix.test-stage }}
uses: actions/upload-artifact@v2
with:
name: TestSuite
path: |
/home/runner/builds/**


post_build:
name: Gather Artefacts
runs-on: ubuntu-latest
# wait until matrix jobs are all finished
needs: matrix_build
steps:

- name: Checkout
uses: actions/checkout@v2

- name: Create artifacts dir
run: mkdir -p /home/runner/builds

#- name: Download artifacts
#uses: actions/download-artifact@v2
#with:
#path: /home/runner/builds

- name: Polulate JSON Manifest
run: |
firmware_json_path=/home/runner/builds/firmware.json
cp .github/templates/firmware.test-suite.json $firmware_json_path
sed -i -e 's/FIRMWARE_TYPE/${{ inputs.firmware_type }}/g' $firmware_json_path
sed -i -e 's/FIRMWARE_HOST/${{ inputs.manifest_host }}/g' $firmware_json_path
sed -i -e 's/FIRMWARE_PORT/${{ inputs.manifest_port }}/g' $firmware_json_path
sed -i -e 's~FIRMWARE_PATH~${{ inputs.manifest_bin_path }}~g' $firmware_json_path
cat $firmware_json_path

- name: Update artifacts with new JSON Manifest
uses: actions/upload-artifact@v2
with:
name: TestSuite
path: |
/home/runner/builds/**


- name: Release check
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
/home/runner/builds/**


3 changes: 2 additions & 1 deletion .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
pull_request:
branches:
- master
workflow_dispatch:

jobs:
build:
Expand All @@ -30,4 +31,4 @@ jobs:
- name: Build test
run: |
pio run

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
_Notes
.pio
test/stage1
Loading