-
-
Notifications
You must be signed in to change notification settings - Fork 6
131 lines (118 loc) · 4.49 KB
/
ESP32.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build MicroPython for ESP32 Boards
on:
push:
branches:
- CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup-environment:
runs-on: ubuntu-24.04
outputs:
idf-path: ${{ steps.export-idf.outputs.idf-path }}
micropython-path: ${{ steps.clone-micropython.outputs.micropython-path }}
steps:
# Check out the repository
- name: Checkout repository
uses: actions/checkout@v4
# Cache ESP-IDF dependencies and MicroPython
- name: Cache ESP-IDF and MicroPython
id: cache_esp_idf
uses: actions/cache@v4
with:
path: |
./esp-idf/
~/.espressif/
!~/.espressif/dist/
./micropython/
key: 2esp-idf-${{ hashFiles('path-to-lock-file-or-important-files') }}
restore-keys: |
2esp-idf-
# 3. Install ESP-IDF dependencies (if not cached)
- name: Install ESP-IDF dependencies
if: steps.cache_esp_idf.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
# 4. Download and set up ESP-IDF 5.2.x (if not cached)
- name: Set up ESP-IDF 5.2.x
id: export-idf
run: |
if [ ! -d "esp-idf" ]; then
git clone --branch release/v5.2 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
./install.sh all
echo "::set-output name=idf-path::$(pwd)"
else
echo "ESP-IDF found in cache."
echo "::set-output name=idf-path::$(pwd)/esp-idf"
fi
# 5. Clone the latest MicroPython release (if not cached)
- name: Clone MicroPython latest release
id: clone-micropython
run: |
if [ ! -d "micropython" ]; then
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/micropython/micropython/releases/latest" | jq -r .tag_name)
echo "Cloning MicroPython release: $LATEST_RELEASE"
git clone --depth 1 --branch $LATEST_RELEASE https://github.com/micropython/micropython.git
cd micropython
git submodule update --init --depth 1
echo "::set-output name=micropython-path::$(pwd)"
cd mpy-cross
make
echo "Mpy-Cross compiler built successfully"
else
echo "MicroPython found in cache."
echo "::set-output name=micropython-path::$(pwd)/micropython"
fi
# Dynamically create jobs for each board
build:
needs: setup-environment
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
board:
- ESP32_GENERIC:SPIRAM
- ESP32_GENERIC_S2:SPIRAM
- ESP32_GENERIC_S3:SPIRAM
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install ESP-IDF dependencies
run: |
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
# Cache ESP-IDF dependencies and MicroPython
- name: Cache ESP-IDF and MicroPython
uses: actions/cache@v4
with:
path: |
./esp-idf/
./micropython/
key: esp-idf-${{ hashFiles('path-to-lock-file-or-important-files') }}
restore-keys: |
esp-idf-
# 1. Set up ESP-IDF environment for the job
- name: Set up ESP-IDF environment
run: |
cd ${{ needs.setup-environment.outputs.idf-path }}
source ./export.sh
cd -
# 2. Parse Board Name and Variant
- name: Parse Board Name and Variant
id: parse
run: |
IFS=':' read -r BOARD_NAME BOARD_VARIANT <<< "${{ matrix.board }}"
echo "::set-output name=board_name::${BOARD_NAME}"
echo "::set-output name=board_variant::${BOARD_VARIANT}"
# 3. Build MicroPython for each board
- name: Build MicroPython
run: |
cd ${{ needs.setup-environment.outputs.micropython-path }}/ports/esp32
make submodules
# Apply sdkconfig if available
if [ -f "../../../src/sdkconfig_${{ steps.parse.outputs.board_name }}" ]; then
cp ../../../src/sdkconfig_${{ steps.parse.outputs.board_name }} sdkconfig.defaults
fi