Skip to content

Commit 28687f8

Browse files
committed
Improve the CI/CD pipeline
1 parent f7804d9 commit 28687f8

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

.github/workflows/platformio.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
board:
10-
- megaatmega2560
11-
- esp32dev
12-
- esp01_1m
13-
# example:
9+
include:
1410
# Arduino32
1511
# - examples/arduino32/colorTftEthernet32
1612
# - examples/arduino32/dynamicMenuItems
@@ -23,7 +19,6 @@ jobs:
2319
# - examples/mbed/stm32EncoderLcdI2c
2420
# - examples/mbed/stm32f429FrameBuffer
2521
# - examples/mbed/stm32OledEncoder
26-
include:
2722
# AVR
2823
- example: examples/avr/adafruitST7735Mega
2924
board: megaatmega2560
@@ -47,14 +42,9 @@ jobs:
4742
- example: examples/esp/esp8266WifiOled
4843
board: esp01_1m
4944
- example: examples/esp/espCapTouchTft
50-
board: esp32dev
51-
- example: examples/esp/espCapTouchTft
52-
board: esp01_1m
45+
board: [esp32dev, esp01_1m]
5346
- example: examples/esp/simpleU8g2
54-
board: esp32dev
55-
- example: examples/esp/simpleU8g2
56-
board: esp01_1m
57-
47+
board: [esp32dev, esp01_1m]
5848
steps:
5949
- uses: actions/checkout@v4
6050
- uses: actions/cache@v4
@@ -68,6 +58,23 @@ jobs:
6858
python-version: '3.12'
6959
- name: Install PlatformIO Core
7060
run: pip install --upgrade platformio
71-
61+
- name: Set Board Environment Variables
62+
run: |
63+
if [ -n "${{ matrix.board }}" ] && [ "${{ matrix.board }}" != "null" ]; then
64+
BOARD_ENVS=""
65+
if [ "${{ matrix.board }}" = "Array" ]; then
66+
# If matrix.board is an array
67+
for board in $(echo '${{ toJSON(matrix.board) }}' | jq -r '.[]'); do
68+
BOARD_ENVS="$BOARD_ENVS --environment $board"
69+
done
70+
else
71+
# If matrix.board is a single value
72+
BOARD_ENVS="--environment ${{ matrix.board }}"
73+
fi
74+
echo "BOARD_ENVS=$BOARD_ENVS" >> $GITHUB_ENV
75+
fi
76+
shell: bash
7277
- name: Build PlatformIO examples
73-
run: pio ci --lib "." --project-conf=platformio.ini --environment ${{ matrix.board }} ${{ matrix.example }}
78+
run: pio ci --lib "." --project-conf=platformio.ini $BOARD_ENVS
79+
env:
80+
PLATFORMIO_CI_SRC: ${{ matrix.example }}

0 commit comments

Comments
 (0)