Skip to content

Commit

Permalink
More ci tweak (#2636)
Browse files Browse the repository at this point in the history
* change concurrency group to ${{ github.workflow }}-${{ github.ref }}
* use argparse for build.py hil_test.py, remove the need to install click
* move ci win/mac to build_cmake.yml
* rename build_family.yml to build_util.yml
* build_util.yml support esp32
* integrate build-espressif into build.yml
* build.py support make with --board option
* add get_deps action
* update hil test to reuse action
  • Loading branch information
hathach committed May 10, 2024
1 parent bf9cf10 commit 3e2ea77
Show file tree
Hide file tree
Showing 24 changed files with 296 additions and 443 deletions.
@@ -1,30 +1,29 @@
name: Prepare to build
name: Get dependencies

inputs:
family:
arg:
required: true
type: string

runs:
using: "composite"
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Checkout pico-sdk for rp2040
if: contains(inputs.family, 'rp2040')
if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico')
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: develop
path: pico-sdk

- name: Get Dependencies
- name: Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt install -y ninja-build
pip install click
python3 tools/get_deps.py ${{ inputs.family }}
echo >> $GITHUB_ENV "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk"
shell: bash

- name: Get Dependencies
run: |
python3 tools/get_deps.py ${{ inputs.arg }}
echo "PICO_SDK_PATH=${{ github.workspace }}/pico-sdk" >> $GITHUB_ENV
shell: bash
18 changes: 17 additions & 1 deletion .github/actions/setup_toolchain/action.yml
Expand Up @@ -8,6 +8,11 @@ inputs:
required: false
type: string

outputs:
build_option:
description: 'Build option for the toolchain e.g --toolchain clang'
value: ${{ steps.set-toolchain-option.outputs.build_option }}

runs:
using: "composite"
steps:
Expand All @@ -19,7 +24,7 @@ runs:

- name: Pull ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
run: docker pull espressif/idf:latest
run: docker pull espressif/idf:${{ inputs.toolchain_url }}
shell: bash

- name: Download Toolchain
Expand All @@ -29,3 +34,14 @@ runs:
uses: ./.github/actions/setup_toolchain/download
with:
toolchain_url: ${{ inputs.toolchain_url }}

- name: Set toolchain option
id: set-toolchain-option
run: |
BUILD_OPTION=""
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
BUILD_OPTION="--toolchain clang"
fi
echo "build_option=$BUILD_OPTION"
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
shell: bash
46 changes: 41 additions & 5 deletions .github/workflows/build_cmake.yml
Expand Up @@ -12,6 +12,7 @@ on:
- 'tools/build.py'
- '.github/actions/**'
- '.github/workflows/build_cmake.yml'
- '.github/workflows/build_util.yml'
- '.github/workflows/ci_set_matrix.py'
pull_request:
branches: [ master ]
Expand All @@ -24,9 +25,10 @@ on:
- 'tools/build.py'
- '.github/actions/**'
- '.github/workflows/build_cmake.yml'
- '.github/workflows/build_util.yml'
- '.github/workflows/ci_set_matrix.py'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -55,7 +57,7 @@ jobs:
# ---------------------------------------
cmake:
needs: set-matrix
uses: ./.github/workflows/build_family.yml
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
Expand All @@ -69,14 +71,14 @@ jobs:
build-system: 'cmake'
toolchain: ${{ matrix.toolchain }}
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}

# ---------------------------------------
# Build Make
# ---------------------------------------
make:
needs: set-matrix
uses: ./.github/workflows/build_family.yml
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
Expand All @@ -90,4 +92,38 @@ jobs:
build-system: 'make'
toolchain: ${{ matrix.toolchain }}
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}

# ---------------------------------------
# Build Make on Windows/MacOS
# ---------------------------------------
make-os:
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
with:
os: ${{ matrix.os }}
build-system: 'make'
toolchain: 'arm-gcc'
build-args: '["-bstm32f411disco"]'

# ---------------------------------------
# Build Espressif
# ---------------------------------------
espressif:
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
matrix:
board:
# ESP32-S2
- 'espressif_kaluga_1'
# ESP32-S3 skip since devkitm is also compiled in hil-test workflow
#- 'espressif_s3_devkitm'
with:
build-system: 'cmake'
toolchain: 'esp-idf'
toolchain_url: 'v5.1.1'
build-args: '["-b${{ matrix.board }}"]'
109 changes: 0 additions & 109 deletions .github/workflows/build_esp.yml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/build_family.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_iar.yml
Expand Up @@ -23,7 +23,7 @@ on:
- '.github/workflows/build_iar.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build_renesas.yml
Expand Up @@ -21,7 +21,7 @@ on:
- '.github/workflows/build_renesas.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -65,7 +65,6 @@ jobs:

- name: Get Dependencies
run: |
pip install click
python3 tools/get_deps.py ${{ matrix.family }}
- name: Build
Expand Down

0 comments on commit 3e2ea77

Please sign in to comment.