update github workflows #164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PlatformIO CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_call: # allow calling from other workflows | |
| workflow_dispatch: # allow manually calling the action | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini') }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install PlatformIO | |
| run: pip install platformio==6.1.19 | |
| - name: Install PlatformIO Libs | |
| run: pio pkg install | |
| - name: Run PlatformIO Tests | |
| run: pio test -e native | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| environment: [inkplate10, inkplate10v2] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini') }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install PlatformIO | |
| run: pip install platformio==6.1.19 | |
| - name: Install PlatformIO Libs | |
| run: pio pkg install | |
| - name: Build ${{ matrix.environment }} | |
| run: pio run -e ${{ matrix.environment }} -t '' | |
| - name: Generate idedata | |
| run: pio run -e ${{ matrix.environment }} -t idedata | |
| - name: Collect flash binaries | |
| run: | | |
| mkdir -p flash-package | |
| IDEDATA=".pio/build/${{ matrix.environment }}/idedata.json" | |
| # Copy firmware | |
| cp .pio/build/${{ matrix.environment }}/firmware.bin flash-package/firmware.bin | |
| cp .pio/build/${{ matrix.environment }}/firmware.bin flash-package/homeplate-${{ matrix.environment }}.bin | |
| # Copy extra flash images (bootloader, partitions, boot_app0) from idedata | |
| for row in $(python3 -c "import json; d=json.load(open('$IDEDATA')); [print(r['path']) for r in d['extra']['flash_images']]"); do | |
| cp "$row" flash-package/ | |
| done | |
| # Generate ESP Web Tools manifest from idedata | |
| python3 -c " | |
| import json | |
| d = json.load(open('$IDEDATA')) | |
| parts = [{'path': '${{ matrix.environment }}/' + p['path'].rsplit('/',1)[1], 'offset': int(p['offset'],16)} for p in d['extra']['flash_images']] | |
| parts.append({'path': '${{ matrix.environment }}/firmware.bin', 'offset': int(d['extra']['application_offset'],16)}) | |
| manifest = { | |
| 'name': 'HomePlate (${{ matrix.environment }})', | |
| 'version': 'VERSION_PLACEHOLDER', | |
| 'new_install_prompt_erase': True, | |
| 'builds': [{'chipFamily': 'ESP32', 'parts': parts}] | |
| } | |
| json.dump(manifest, open('flash-package/manifest.json','w'), indent=2) | |
| " | |
| - name: Upload firmware | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firmware-${{ matrix.environment }} | |
| path: flash-package/ |