|
| 1 | +name: build-all-firmwares |
| 2 | +run-name: Build firmwares for all boards and RFID-readers |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - dev |
| 8 | + - master |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - "src/*" |
| 12 | + - "html/*" |
| 13 | + - "test/*" |
| 14 | + - "**.ini" |
| 15 | + - "**.py" |
| 16 | + - "**.csv" |
| 17 | + |
| 18 | +jobs: |
| 19 | + test_builds: |
| 20 | + name: Run all Tests |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + variant: |
| 25 | + - lolin_d32_pro |
| 26 | + - lolin_d32_pro_sdmmc_pe |
| 27 | + - ttgo_t8 |
| 28 | + - complete |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v5 |
| 32 | + - name: Cache pip |
| 33 | + uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: ~/.cache/pip |
| 36 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-pip- |
| 39 | +
|
| 40 | + - name: Cache PlatformIO |
| 41 | + uses: actions/cache@v4 |
| 42 | + with: |
| 43 | + path: ~/.platformio |
| 44 | + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} |
| 45 | + |
| 46 | + - name: Setup Python 3.13 |
| 47 | + uses: actions/setup-python@v4 |
| 48 | + with: |
| 49 | + python-version: "3.13" |
| 50 | + - name: Install PlatformIO Core |
| 51 | + run: | |
| 52 | + pip install -U setuptools platformio |
| 53 | + pio upgrade --dev |
| 54 | + pio pkg update --global |
| 55 | + - name: Build ${{ matrix.variant }} for RC522 without BT |
| 56 | + run: platformio run -e ${{ matrix.variant }} |
| 57 | + - name: Upload Firmware |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: firmware-${{ matrix.variant }}-RC522-noBT.bin |
| 61 | + path: .pio/build/${{ matrix.variant }}/firmware.bin |
| 62 | + - name: Activate BT |
| 63 | + run: | |
| 64 | + sed -i 's/\/\/#define BLUETOOTH_ENABLE/#define BLUETOOTH_ENABLE/' src/settings.h |
| 65 | + - name: Build ${{ matrix.variant }} for RC522 with BT |
| 66 | + run: platformio run -e ${{ matrix.variant }} |
| 67 | + - name: Upload Firmware |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: firmware-${{ matrix.variant }}-RC522-BT.bin |
| 71 | + path: .pio/build/${{ matrix.variant }}/firmware.bin |
| 72 | + - name: Change RFID type |
| 73 | + run: | |
| 74 | + sed -i 's/\/\/#define RFID_READER_TYPE_PN5180/#define RFID_READER_TYPE_PN5180/' src/settings.h |
| 75 | + sed -i 's/#define RFID_READER_TYPE_MFRC522_SPI/\/\/#define RFID_READER_TYPE_MFRC522_SPI/' src/settings.h |
| 76 | + - name: Build ${{ matrix.variant }} for PN5180 with BT |
| 77 | + run: platformio run -e ${{ matrix.variant }} |
| 78 | + - name: Upload Firmware |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: firmware-${{ matrix.variant }}-PN5180-BT.bin |
| 82 | + path: .pio/build/${{ matrix.variant }}/firmware.bin |
| 83 | + - name: Disable BT |
| 84 | + run: | |
| 85 | + sed -i 's/#define BLUETOOTH_ENABLE/\/\/#define BLUETOOTH_ENABLE/' src/settings.h |
| 86 | + - name: Build ${{ matrix.variant }} for PN5180 without BT |
| 87 | + run: platformio run -e ${{ matrix.variant }} |
| 88 | + - name: Upload Firmware |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: firmware-${{ matrix.variant }}-PN5180-noBT.bin |
| 92 | + path: .pio/build/${{ matrix.variant }}/firmware.bin |
| 93 | + commit: |
| 94 | + runs-on: ubuntu-latest |
| 95 | + needs: test_builds |
| 96 | + steps: |
| 97 | + - name: Checkout target repository |
| 98 | + uses: actions/checkout@v4 |
| 99 | + with: |
| 100 | + repository: biologist79/ESPuino-Firmware |
| 101 | + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
| 102 | + path: target-repo |
| 103 | + |
| 104 | + - name: Download artifacts |
| 105 | + uses: actions/download-artifact@v4 |
| 106 | + with: |
| 107 | + pattern: "firmware*" |
| 108 | + path: target-repo/Firmwares/${{ github.ref_name }} |
| 109 | + |
| 110 | + - name: Commit and push changes |
| 111 | + run: | |
| 112 | + cd target-repo |
| 113 | + git config user.name "GitHub Actions" |
| 114 | + git config user.email "actions@github.com" |
| 115 | + for variant in lolin_d32_pro lolin_d32_pro_sdmmc_pe ttgo_t8 complete; do |
| 116 | + git add Firmwares/${{ github.ref_name }}/firmware-*.bin |
| 117 | + done |
| 118 | + git commit -m "Firmware built from commit biologist79/ESPuino@${{ github.sha }}" |
| 119 | + git push |
0 commit comments