|
| 1 | +name: Build Firmware (Reusable) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + upload_artifacts: |
| 7 | + description: 'Whether to upload artifacts' |
| 8 | + required: false |
| 9 | + type: boolean |
| 10 | + default: true |
| 11 | + upload_release: |
| 12 | + description: 'Whether to upload to release' |
| 13 | + required: false |
| 14 | + type: boolean |
| 15 | + default: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + setup: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + cache-hit: ${{ steps.cache-esp-idf.outputs.cache-hit }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install -y git wget flex bison gperf quilt python3 python3-pip \ |
| 29 | + python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 |
| 30 | +
|
| 31 | + - name: Cache esp-idf |
| 32 | + uses: actions/cache@v4 |
| 33 | + id: cache-esp-idf |
| 34 | + with: |
| 35 | + path: | |
| 36 | + ~/.espressif |
| 37 | + ${{ github.workspace }}/esp-idf |
| 38 | + key: ${{ runner.os }}-idf-v5.4.2 |
| 39 | + |
| 40 | + - name: Install ESP-IDF |
| 41 | + if: steps.cache-esp-idf.outputs.cache-hit != 'true' |
| 42 | + run: | |
| 43 | + git clone --depth=1 -b $IDF_VERSION https://github.com/espressif/esp-idf.git |
| 44 | + ./esp-idf/install.sh |
| 45 | + env: |
| 46 | + IDF_VERSION: "v5.4.2" |
| 47 | + |
| 48 | + - name: Setup environment |
| 49 | + run: | |
| 50 | + source tools/ci.sh && ci_esp32_idf542_setup |
| 51 | + source esp-idf/export.sh |
| 52 | + pip install future |
| 53 | + make -C m5stack submodules |
| 54 | + make -C m5stack patch |
| 55 | + make -C m5stack littlefs |
| 56 | +
|
| 57 | + build: |
| 58 | + needs: setup |
| 59 | + runs-on: ubuntu-latest |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + board: |
| 63 | + - M5STACK_AirQ |
| 64 | + - M5STACK_Atom_Echo |
| 65 | + - M5STACK_Atom_EchoS3R |
| 66 | + - M5STACK_Atom_Lite |
| 67 | + - M5STACK_Atom_Matrix |
| 68 | + - M5STACK_AtomS3 |
| 69 | + - M5STACK_AtomS3_Lite |
| 70 | + - M5STACK_AtomS3R |
| 71 | + - M5STACK_AtomS3R_CAM |
| 72 | + - M5STACK_AtomS3U |
| 73 | + - M5STACK_AtomU |
| 74 | + - M5STACK_Basic |
| 75 | + - M5STACK_Basic_4MB |
| 76 | + - M5STACK_Capsule |
| 77 | + - M5STACK_Cardputer |
| 78 | + - M5STACK_CardputerADV |
| 79 | + - M5STACK_Core2 |
| 80 | + - M5STACK_CoreInk |
| 81 | + - M5STACK_CoreS3 |
| 82 | + - M5STACK_Dial |
| 83 | + - M5STACK_DinMeter |
| 84 | + - M5STACK_Fire |
| 85 | + - M5STACK_NanoC6 |
| 86 | + - M5STACK_Paper |
| 87 | + - M5STACK_PaperS3 |
| 88 | + - M5STACK_PowerHub |
| 89 | + - M5STACK_Stamp_PICO |
| 90 | + - M5STACK_StamPLC |
| 91 | + - M5STACK_StampS3 |
| 92 | + - M5STACK_Station |
| 93 | + - M5STACK_StickC |
| 94 | + - M5STACK_StickC_PLUS |
| 95 | + - M5STACK_StickC_PLUS2 |
| 96 | + - M5STACK_Tab5 |
| 97 | + - M5STACK_Tough |
| 98 | + - M5STACK_Unit_C6L |
| 99 | + - Nesso_N1 |
| 100 | + - ESPRESSIF_ESP32_S3_BOX_3 |
| 101 | + - SEEED_STUDIO_XIAO_ESP32S3 |
| 102 | + max-parallel: 4 |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + |
| 106 | + - name: Install dependencies |
| 107 | + run: | |
| 108 | + sudo apt-get update |
| 109 | + sudo apt-get install -y git wget flex bison gperf quilt python3 python3-pip \ |
| 110 | + python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 |
| 111 | +
|
| 112 | + - name: Restore ESP-IDF cache |
| 113 | + uses: actions/cache@v4 |
| 114 | + with: |
| 115 | + path: | |
| 116 | + ~/.espressif |
| 117 | + ${{ github.workspace }}/esp-idf |
| 118 | + key: ${{ runner.os }}-idf-v5.4.2 |
| 119 | + |
| 120 | + - name: Prepare environment |
| 121 | + run: | |
| 122 | + source esp-idf/export.sh |
| 123 | +
|
| 124 | + - name: Build M5Stack ${{ matrix.board }} |
| 125 | + if: startsWith(matrix.board, 'M5STACK') |
| 126 | + run: | |
| 127 | + source esp-idf/export.sh |
| 128 | + pip install future |
| 129 | + make -C m5stack submodules |
| 130 | + make -C m5stack patch |
| 131 | + make -C m5stack littlefs |
| 132 | + make -C m5stack BOARD=${{ matrix.board }} pack_all |
| 133 | +
|
| 134 | + - name: Build third-party ${{ matrix.board }} |
| 135 | + if: "!startsWith(matrix.board, 'M5STACK')" |
| 136 | + run: | |
| 137 | + source esp-idf/export.sh |
| 138 | + pip install future |
| 139 | + make -C m5stack submodules |
| 140 | + make -C m5stack patch |
| 141 | + make -C m5stack littlefs |
| 142 | + make -C third-party BOARD=${{ matrix.board }} pack_all |
| 143 | +
|
| 144 | + - name: Upload M5Stack firmware artifact |
| 145 | + if: inputs.upload_artifacts && startsWith(matrix.board, 'M5STACK') |
| 146 | + uses: actions/upload-artifact@v4 |
| 147 | + with: |
| 148 | + name: firmware-${{ matrix.board }} |
| 149 | + path: m5stack/build-${{ matrix.board }}/uiflow-*-*.bin |
| 150 | + |
| 151 | + - name: Upload third-party firmware artifact |
| 152 | + if: inputs.upload_artifacts && !startsWith(matrix.board, 'M5STACK') |
| 153 | + uses: actions/upload-artifact@v4 |
| 154 | + with: |
| 155 | + name: firmware-${{ matrix.board }} |
| 156 | + path: third-party/build-${{ matrix.board }}/uiflow-*-*.bin |
| 157 | + |
| 158 | + - name: Upload firmware to release |
| 159 | + uses: softprops/action-gh-release@v2 |
| 160 | + if: inputs.upload_release && startsWith(github.ref, 'refs/tags/') |
| 161 | + env: |
| 162 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 163 | + with: |
| 164 | + files: | |
| 165 | + ${{ startsWith(matrix.board, 'M5STACK') && 'm5stack' || 'third-party' }}/build-${{ matrix.board }}/uiflow-*-*.bin |
0 commit comments