Skip to content

Commit 3e2ea77

Browse files
authored
More ci tweak (#2636)
* 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
1 parent bf9cf10 commit 3e2ea77

File tree

24 files changed

+296
-443
lines changed

24 files changed

+296
-443
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
name: Prepare to build
1+
name: Get dependencies
22

33
inputs:
4-
family:
4+
arg:
55
required: true
66
type: string
77

88
runs:
99
using: "composite"
1010
steps:
11-
- name: Setup Python
12-
uses: actions/setup-python@v5
13-
with:
14-
python-version: '3.x'
15-
1611
- name: Checkout pico-sdk for rp2040
17-
if: contains(inputs.family, 'rp2040')
12+
if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico')
1813
uses: actions/checkout@v4
1914
with:
2015
repository: raspberrypi/pico-sdk
2116
ref: develop
2217
path: pico-sdk
2318

24-
- name: Get Dependencies
19+
- name: Linux dependencies
20+
if: runner.os == 'Linux'
2521
run: |
2622
sudo apt install -y ninja-build
27-
pip install click
28-
python3 tools/get_deps.py ${{ inputs.family }}
29-
echo >> $GITHUB_ENV "PICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk"
23+
shell: bash
24+
25+
- name: Get Dependencies
26+
run: |
27+
python3 tools/get_deps.py ${{ inputs.arg }}
28+
echo "PICO_SDK_PATH=${{ github.workspace }}/pico-sdk" >> $GITHUB_ENV
3029
shell: bash

.github/actions/setup_toolchain/action.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ inputs:
88
required: false
99
type: string
1010

11+
outputs:
12+
build_option:
13+
description: 'Build option for the toolchain e.g --toolchain clang'
14+
value: ${{ steps.set-toolchain-option.outputs.build_option }}
15+
1116
runs:
1217
using: "composite"
1318
steps:
@@ -19,7 +24,7 @@ runs:
1924

2025
- name: Pull ESP-IDF docker
2126
if: inputs.toolchain == 'esp-idf'
22-
run: docker pull espressif/idf:latest
27+
run: docker pull espressif/idf:${{ inputs.toolchain_url }}
2328
shell: bash
2429

2530
- name: Download Toolchain
@@ -29,3 +34,14 @@ runs:
2934
uses: ./.github/actions/setup_toolchain/download
3035
with:
3136
toolchain_url: ${{ inputs.toolchain_url }}
37+
38+
- name: Set toolchain option
39+
id: set-toolchain-option
40+
run: |
41+
BUILD_OPTION=""
42+
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
43+
BUILD_OPTION="--toolchain clang"
44+
fi
45+
echo "build_option=$BUILD_OPTION"
46+
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
47+
shell: bash

.github/workflows/build_cmake.yml

+41-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
- 'tools/build.py'
1313
- '.github/actions/**'
1414
- '.github/workflows/build_cmake.yml'
15+
- '.github/workflows/build_util.yml'
1516
- '.github/workflows/ci_set_matrix.py'
1617
pull_request:
1718
branches: [ master ]
@@ -24,9 +25,10 @@ on:
2425
- 'tools/build.py'
2526
- '.github/actions/**'
2627
- '.github/workflows/build_cmake.yml'
28+
- '.github/workflows/build_util.yml'
2729
- '.github/workflows/ci_set_matrix.py'
2830
concurrency:
29-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
31+
group: ${{ github.workflow }}-${{ github.ref }}
3032
cancel-in-progress: true
3133

3234
jobs:
@@ -55,7 +57,7 @@ jobs:
5557
# ---------------------------------------
5658
cmake:
5759
needs: set-matrix
58-
uses: ./.github/workflows/build_family.yml
60+
uses: ./.github/workflows/build_util.yml
5961
strategy:
6062
fail-fast: false
6163
matrix:
@@ -69,14 +71,14 @@ jobs:
6971
build-system: 'cmake'
7072
toolchain: ${{ matrix.toolchain }}
7173
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
72-
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
74+
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
7375

7476
# ---------------------------------------
7577
# Build Make
7678
# ---------------------------------------
7779
make:
7880
needs: set-matrix
79-
uses: ./.github/workflows/build_family.yml
81+
uses: ./.github/workflows/build_util.yml
8082
strategy:
8183
fail-fast: false
8284
matrix:
@@ -90,4 +92,38 @@ jobs:
9092
build-system: 'make'
9193
toolchain: ${{ matrix.toolchain }}
9294
toolchain_url: ${{ fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].toolchain_url }}
93-
build-family: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
95+
build-args: ${{ toJSON(fromJSON(needs.set-matrix.outputs.json)[matrix.toolchain].family) }}
96+
97+
# ---------------------------------------
98+
# Build Make on Windows/MacOS
99+
# ---------------------------------------
100+
make-os:
101+
uses: ./.github/workflows/build_util.yml
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
os: [windows-latest, macos-latest]
106+
with:
107+
os: ${{ matrix.os }}
108+
build-system: 'make'
109+
toolchain: 'arm-gcc'
110+
build-args: '["-bstm32f411disco"]'
111+
112+
# ---------------------------------------
113+
# Build Espressif
114+
# ---------------------------------------
115+
espressif:
116+
uses: ./.github/workflows/build_util.yml
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
board:
121+
# ESP32-S2
122+
- 'espressif_kaluga_1'
123+
# ESP32-S3 skip since devkitm is also compiled in hil-test workflow
124+
#- 'espressif_s3_devkitm'
125+
with:
126+
build-system: 'cmake'
127+
toolchain: 'esp-idf'
128+
toolchain_url: 'v5.1.1'
129+
build-args: '["-b${{ matrix.board }}"]'

.github/workflows/build_esp.yml

-109
This file was deleted.

.github/workflows/build_family.yml

-64
This file was deleted.

.github/workflows/build_iar.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
- '.github/workflows/build_iar.yml'
2424

2525
concurrency:
26-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
26+
group: ${{ github.workflow }}-${{ github.ref }}
2727
cancel-in-progress: true
2828

2929
jobs:

.github/workflows/build_renesas.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
- '.github/workflows/build_renesas.yml'
2222

2323
concurrency:
24-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
24+
group: ${{ github.workflow }}-${{ github.ref }}
2525
cancel-in-progress: true
2626

2727
jobs:
@@ -65,7 +65,6 @@ jobs:
6565

6666
- name: Get Dependencies
6767
run: |
68-
pip install click
6968
python3 tools/get_deps.py ${{ matrix.family }}
7069
7170
- name: Build

0 commit comments

Comments
 (0)