|
| 1 | +name: Custom board build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + board: |
| 7 | + description: 'Board: Found in ports/*/boards/[board_id]' |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + version: |
| 11 | + description: 'Version: Can be a tag or a commit (>=8.1.0)' |
| 12 | + required: false |
| 13 | + default: latest |
| 14 | + type: string |
| 15 | + language: |
| 16 | + description: 'Language: Found in locale/[language].po' |
| 17 | + required: false |
| 18 | + default: en_US |
| 19 | + type: string |
| 20 | + flags: |
| 21 | + description: 'Flags: Build flags (e.g. CIRCUITPY_WIFI=1)' |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + debug: |
| 25 | + description: 'Make a debug build' |
| 26 | + required: false |
| 27 | + default: false |
| 28 | + type: boolean |
| 29 | + |
| 30 | +run-name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }} |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + env: |
| 36 | + PLATFORM_atmel-samd: arm |
| 37 | + PLATFORM_broadcom: aarch |
| 38 | + PLATFORM_cxd56: arm |
| 39 | + PLATFORM_espressif: esp |
| 40 | + PLATFORM_litex: riscv |
| 41 | + PLATFORM_mimxrt10xx: arm |
| 42 | + PLATFORM_nrf: arm |
| 43 | + PLATFORM_raspberrypi: arm |
| 44 | + PLATFORM_stm: arm |
| 45 | + steps: |
| 46 | + - name: Set up repository |
| 47 | + run: | |
| 48 | + git clone --filter=tree:0 https://github.com/adafruit/circuitpython.git $GITHUB_WORKSPACE |
| 49 | + git checkout ${{ inputs.version == 'latest' && 'HEAD' || inputs.version }} |
| 50 | + - name: Set up identifier |
| 51 | + if: inputs.debug || inputs.flags != '' |
| 52 | + run: | |
| 53 | + > custom-build && git add custom-build |
| 54 | + - name: Get port |
| 55 | + id: get-port |
| 56 | + run: | |
| 57 | + PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g') |
| 58 | + if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi |
| 59 | + - name: Port to platform |
| 60 | + run: echo >> $GITHUB_ENV "PLATFORM=${{ env[format('PLATFORM_{0}', steps.get-port.outputs.port)] }}" |
| 61 | + - name: Set up python |
| 62 | + uses: actions/setup-python@v4 |
| 63 | + with: |
| 64 | + python-version: 3.x |
| 65 | + - name: Set up port |
| 66 | + if: env.PLATFORM == 'esp' |
| 67 | + uses: ./.github/actions/deps/ports/espressif |
| 68 | + - name: Set up submodules |
| 69 | + id: set-up-submodules |
| 70 | + uses: ./.github/actions/deps/submodules |
| 71 | + with: |
| 72 | + action: cache |
| 73 | + target: ${{ inputs.board }} |
| 74 | + - name: Set up external |
| 75 | + uses: ./.github/actions/deps/external |
| 76 | + with: |
| 77 | + action: cache |
| 78 | + platform: ${{ env.PLATFORM }} |
| 79 | + - name: Set up mpy-cross |
| 80 | + if: steps.set-up-submodules.outputs.frozen == 'True' |
| 81 | + uses: ./.github/actions/mpy_cross |
| 82 | + with: |
| 83 | + download: false |
| 84 | + - name: Versions |
| 85 | + run: | |
| 86 | + tools/describe |
| 87 | + gcc --version |
| 88 | + python3 --version |
| 89 | + cmake --version || true |
| 90 | + ninja --version || true |
| 91 | + aarch64-none-elf-gcc --version || true |
| 92 | + arm-none-eabi-gcc --version || true |
| 93 | + xtensa-esp32-elf-gcc --version || true |
| 94 | + riscv32-esp-elf-gcc --version || true |
| 95 | + riscv64-unknown-elf-gcc --version || true |
| 96 | + mkfs.fat --version || true |
| 97 | + - name: Build board |
| 98 | + run: make -j2 ${{ inputs.flags }} BOARD=${{ inputs.board }} DEBUG=${{ inputs.debug && '1' || '0' }} TRANSLATION=${{ inputs.language }} |
| 99 | + working-directory: ports/${{ steps.get-port.outputs.port }} |
| 100 | + - name: Upload artifact |
| 101 | + uses: actions/upload-artifact@v3 |
| 102 | + with: |
| 103 | + name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }} |
| 104 | + path: ports/${{ steps.get-port.outputs.port }}/build-${{ inputs.board }}/firmware.* |
0 commit comments