Add matrix to build all environments #21
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: Build Firmware | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'doc/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| env: [ESP32, ESP32-S3, ESP32-S3-USB, ESP32-C3, ESP32-LILYGO_SX1280] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Cache pip | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-platformio-${{ hashFiles('**/lockfiles') }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install PlatformIO | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade platformio | |
| - name: Run PlatformIO | |
| run: pio run -e ${{ matrix.env }} | |
| - name: Create merged binary | |
| run: | | |
| CHIP=esp32 | |
| if [[ "${{ matrix.env }}" == *"S3"* ]]; then CHIP=esp32s3; fi | |
| if [[ "${{ matrix.env }}" == *"C3"* ]]; then CHIP=esp32c3; fi | |
| python ~/.platformio/packages/tool-esptoolpy/esptool.py --chip "$CHIP" merge_bin -o .pio/build/${{ matrix.env }}/firmware-full.bin \ | |
| --flash_mode dio --flash_freq 40m --flash_size 4MB \ | |
| 0x1000 .pio/build/${{ matrix.env }}/bootloader.bin \ | |
| 0x8000 .pio/build/${{ matrix.env }}/partitions.bin \ | |
| 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \ | |
| 0x10000 .pio/build/${{ matrix.env }}/firmware.bin | |
| - name: Rename binaries | |
| run: | | |
| mv .pio/build/${{ matrix.env }}/firmware.bin .pio/build/${{ matrix.env }}/tinygs-${{ matrix.env }}-$(git describe --tags --always)-ota.bin | |
| mv .pio/build/${{ matrix.env }}/firmware-full.bin .pio/build/${{ matrix.env }}/tinygs-${{ matrix.env }}-$(git describe --tags --always)-full.bin | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firmware-${{ matrix.env }} | |
| path: | | |
| .pio/build/${{ matrix.env }}/tinygs-${{ matrix.env }}-*-ota.bin | |
| .pio/build/${{ matrix.env }}/tinygs-${{ matrix.env }}-*-full.bin |