split raspberrypi and refactor espressif

This commit is contained in:
MicroDev 2023-02-14 20:33:24 +05:30
parent 65e9d937ac
commit 50c52fca88
No known key found for this signature in database
GPG Key ID: 2C0867BE60967730
5 changed files with 42 additions and 46 deletions

View File

@ -8,7 +8,7 @@ inputs:
options: options:
- arm - arm
- aarch - aarch
- espressif - esp
- riscv - riscv
- none - none
@ -42,13 +42,13 @@ runs:
with: with:
release: '10-2020-q4' release: '10-2020-q4'
# espressif # esp
- name: Get espressif toolchain - name: Get esp toolchain
if: inputs.platform == 'espressif' if: inputs.platform == 'esp'
run: sudo apt-get install -y ninja-build run: sudo apt-get install -y ninja-build
shell: bash shell: bash
- name: Install IDF tools - name: Install IDF tools
if: inputs.platform == 'espressif' if: inputs.platform == 'esp'
run: | run: |
echo "Installing ESP-IDF tools" echo "Installing ESP-IDF tools"
$IDF_PATH/tools/idf_tools.py --non-interactive install required $IDF_PATH/tools/idf_tools.py --non-interactive install required
@ -58,7 +58,7 @@ runs:
rm -rf $IDF_TOOLS_PATH/dist rm -rf $IDF_TOOLS_PATH/dist
shell: bash shell: bash
- name: Set environment - name: Set environment
if: inputs.platform == 'espressif' if: inputs.platform == 'esp'
run: | run: |
source $IDF_PATH/export.sh source $IDF_PATH/export.sh
echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH" echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH"
@ -75,7 +75,7 @@ runs:
# common # common
- name: Cache python dependencies - name: Cache python dependencies
if: inputs.platform != 'espressif' if: inputs.platform != 'esp'
uses: ./.github/actions/deps/python uses: ./.github/actions/deps/python
with: with:
action: ${{ fromJSON('["restore", "cache"]')[github.job == 'scheduler'] }} action: ${{ fromJSON('["restore", "cache"]')[github.job == 'scheduler'] }}

View File

@ -1,27 +1,15 @@
name: Fetch port deps name: Fetch espressif port deps
inputs:
platform:
required: false
default: none
type: choice
options:
- espressif
- none
runs: runs:
using: composite using: composite
steps: steps:
# espressif
- name: Set IDF env - name: Set IDF env
if: inputs.platform == 'espressif'
run: | run: |
echo >> $GITHUB_ENV "IDF_PATH=$GITHUB_WORKSPACE/ports/espressif/esp-idf" echo >> $GITHUB_ENV "IDF_PATH=$GITHUB_WORKSPACE/ports/espressif/esp-idf"
echo >> $GITHUB_ENV "IDF_TOOLS_PATH=$GITHUB_WORKSPACE/.idf_tools" echo >> $GITHUB_ENV "IDF_TOOLS_PATH=$GITHUB_WORKSPACE/.idf_tools"
shell: bash shell: bash
- name: Get IDF commit - name: Get IDF commit
if: inputs.platform == 'espressif'
id: idf-commit id: idf-commit
run: | run: |
COMMIT=$(git submodule status ports/espressif/esp-idf | grep -o -P '(?<=^-).*(?= )') COMMIT=$(git submodule status ports/espressif/esp-idf | grep -o -P '(?<=^-).*(?= )')
@ -30,7 +18,6 @@ runs:
shell: bash shell: bash
- name: Cache IDF submodules - name: Cache IDF submodules
if: inputs.platform == 'espressif'
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
@ -39,13 +26,11 @@ runs:
key: submodules-idf-${{ steps.idf-commit.outputs.commit }} key: submodules-idf-${{ steps.idf-commit.outputs.commit }}
- name: Cache IDF tools - name: Cache IDF tools
if: inputs.platform == 'espressif'
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ${{ env.IDF_TOOLS_PATH }} path: ${{ env.IDF_TOOLS_PATH }}
key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-idf-${{ steps.idf-commit.outputs.commit }} key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-idf-${{ steps.idf-commit.outputs.commit }}
- name: Initialize IDF submodules - name: Initialize IDF submodules
if: inputs.platform == 'espressif'
run: git submodule update --init --depth=1 --recursive $IDF_PATH run: git submodule update --init --depth=1 --recursive $IDF_PATH
shell: bash shell: bash

View File

@ -35,9 +35,8 @@ jobs:
with: with:
python-version: 3.x python-version: 3.x
- name: Set up port - name: Set up port
uses: ./.github/actions/deps/port if: inputs.platform == 'esp'
with: uses: ./.github/actions/deps/ports/espressif
platform: ${{ inputs.platform }}
- name: Set up submodules - name: Set up submodules
id: set-up-submodules id: set-up-submodules
uses: ./.github/actions/deps/submodules uses: ./.github/actions/deps/submodules

View File

@ -24,8 +24,9 @@ jobs:
build-boards: ${{ steps.set-matrix.outputs.build-boards }} build-boards: ${{ steps.set-matrix.outputs.build-boards }}
boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }} boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }}
boards-arm: ${{ steps.set-matrix.outputs.boards-arm }} boards-arm: ${{ steps.set-matrix.outputs.boards-arm }}
boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }} boards-esp: ${{ steps.set-matrix.outputs.boards-esp }}
boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }} boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }}
boards-rpi: ${{ steps.set-matrix.outputs.boards-rpi }}
cp-version: ${{ steps.set-up-submodules.outputs.version }} cp-version: ${{ steps.set-up-submodules.outputs.version }}
steps: steps:
- name: Dump GitHub context - name: Dump GitHub context
@ -238,13 +239,13 @@ jobs:
cp-version: ${{ needs.scheduler.outputs.cp-version }} cp-version: ${{ needs.scheduler.outputs.cp-version }}
espressif: esp:
needs: [scheduler, mpy-cross, tests] needs: [scheduler, mpy-cross, tests]
if: ${{ needs.scheduler.outputs.boards-espressif != '[]' }} if: ${{ needs.scheduler.outputs.boards-esp != '[]' }}
uses: ./.github/workflows/build-boards.yml uses: ./.github/workflows/build-boards.yml
with: with:
platform: espressif platform: esp
boards: ${{ needs.scheduler.outputs.boards-espressif }} boards: ${{ needs.scheduler.outputs.boards-esp }}
cp-version: ${{ needs.scheduler.outputs.cp-version }} cp-version: ${{ needs.scheduler.outputs.cp-version }}
@ -256,3 +257,12 @@ jobs:
platform: riscv platform: riscv
boards: ${{ needs.scheduler.outputs.boards-riscv }} boards: ${{ needs.scheduler.outputs.boards-riscv }}
cp-version: ${{ needs.scheduler.outputs.cp-version }} cp-version: ${{ needs.scheduler.outputs.cp-version }}
rpi:
needs: [scheduler, mpy-cross, tests]
if: ${{ needs.scheduler.outputs.boards-rpi != '[]' }}
uses: ./.github/workflows/build-boards.yml
with:
platform: arm
boards: ${{ needs.scheduler.outputs.boards-rpi }}
cp-version: ${{ needs.scheduler.outputs.cp-version }}

View File

@ -46,11 +46,11 @@ PORT_TO_ARCH = {
"atmel-samd": "arm", "atmel-samd": "arm",
"broadcom": "aarch", "broadcom": "aarch",
"cxd56": "arm", "cxd56": "arm",
"espressif": "espressif", "espressif": "esp",
"litex": "riscv", "litex": "riscv",
"mimxrt10xx": "arm", "mimxrt10xx": "arm",
"nrf": "arm", "nrf": "arm",
"raspberrypi": "arm", "raspberrypi": "rpi",
"stm": "arm", "stm": "arm",
} }
@ -204,31 +204,33 @@ def set_boards_to_build(build_all: bool):
break break
# Split boards by architecture. # Split boards by architecture.
arch_to_boards = {"aarch": [], "arm": [], "esp": [], "riscv": [], "rpi": []}
# Append previously failed boards
for arch in arch_to_boards:
arch_to_job = f"build-{arch}"
if arch_to_job in last_failed_jobs:
for board in last_failed_jobs[arch_to_job]:
if not board in boards_to_build:
boards_to_build.append(board)
build_boards = bool(boards_to_build) build_boards = bool(boards_to_build)
print("Building boards:", build_boards) print("Building boards:", build_boards)
set_output("build-boards", build_boards) set_output("build-boards", build_boards)
arch_to_boards = {"aarch": [], "arm": [], "riscv": [], "espressif": []}
# Append boards according to arch
for board in sorted(boards_to_build): for board in sorted(boards_to_build):
print(" ", board)
port = board_to_port.get(board) port = board_to_port.get(board)
# A board can appear due to its _deletion_ (rare) # A board can appear due to its _deletion_ (rare)
# if this happens it's not in `board_to_port`. # if this happens it's not in `board_to_port`.
if not port: if not port:
continue continue
arch = PORT_TO_ARCH[port] arch_to_boards[PORT_TO_ARCH[port]].append(board)
arch_to_boards[arch].append(board) print(" ", board)
# Set the step outputs for each architecture # Set the step outputs for each architecture
for arch in arch_to_boards: for arch in arch_to_boards:
# Append previous failed jobs set_output(f"boards-{arch}", json.dumps(arch_to_boards[arch]))
if f"build-{arch}" in last_failed_jobs:
failed_boards = last_failed_jobs[f"build-{arch}"]
for board in failed_boards:
if not board in arch_to_boards[arch]:
print(" ", board)
arch_to_boards[arch].append(board)
# Set Output
set_output(f"boards-{arch}", json.dumps(sorted(arch_to_boards[arch])))
def set_docs_to_build(build_doc: bool): def set_docs_to_build(build_doc: bool):