Skip to content

Commit d4d2795

Browse files
committed
Merge branch 'task/ci-supported-idf' into 'master'
gitlab-ci: Compile for all supported ESP IDF versions and targets See merge request app-frameworks/esp-rainmaker!305
2 parents acace37 + 42101c0 commit d4d2795

File tree

1 file changed

+59
-156
lines changed

1 file changed

+59
-156
lines changed

Diff for: .gitlab-ci.yml

+59-156
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ stages:
55
variables:
66
V: "0"
77
MAKEFLAGS: "-j8 --no-keep-going"
8-
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
98
APP_BUILD: "all"
109
GIT_SUBMODULE_STRATEGY: recursive
1110

@@ -20,173 +19,77 @@ before_script:
2019
# Create esp-rainmaker-bins-${CI_JOB_ID}/ dir (to copy binaries into for artifacts)
2120
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}
2221

23-
.setup_idf: &setup_idf
24-
# Checking git version
25-
- echo Checking git version
26-
- git --version
27-
# Cloning esp-idf - Started
28-
- echo Cloning esp-idf - Started
29-
- git clone --recursive --branch ${IDF_GIT_BRANCH} --depth 1 ${IDF_GIT_PATH}/esp-idf.git
30-
- cd esp-idf
31-
- echo Cloning esp-idf - Done
32-
# Cloning esp-idf - Done
33-
# Running install.sh - Started
34-
- echo Running install.sh - Started
35-
- ./install.sh
36-
- echo Running install.sh - Done
37-
# Running install.sh - Done
38-
# Running export.sh - Started
39-
- echo Running export.sh - Started
40-
- . export.sh
41-
- echo Running export.sh - Done
42-
# Running export.sh - Done
43-
44-
.build_switch: &build_switch
45-
# Building switch app - Started
46-
- echo Building switch app - Started
47-
- ls
48-
- cd $CI_PROJECT_DIR/examples/switch
49-
- echo Building for esp32
50-
- idf.py set-target esp32
51-
- idf.py build
52-
- rm -rf build/ sdkconfig
53-
- echo Building for esp32s2
54-
- idf.py set-target esp32s2
55-
- idf.py build
56-
- rm -rf build/ sdkconfig
57-
- echo Building for esp32c3
58-
- idf.py set-target esp32c3
59-
- idf.py build
60-
- rm -rf build/ sdkconfig
61-
- echo Building for esp32s3
62-
- idf.py set-target esp32s3
63-
- idf.py build
64-
- echo Building switch app - Done
65-
# Building switch app - Done
66-
# Copying switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
67-
- echo Copy switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
68-
- cp $CI_PROJECT_DIR/examples/switch/build/switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
69-
70-
.build_led_light: &build_led_light
71-
# Building led_light app - Started
72-
- echo Building led_light app - Started
73-
- echo Running idf.py
74-
- cd $CI_PROJECT_DIR/examples/led_light
75-
- idf.py build
76-
- echo Building led_light app - Done
77-
# Building led_light app - Done
78-
# Copying led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
79-
- echo Copy led_light.bin to esp-rainmaker-bins-${CI_JOB_ID}/
80-
- cp $CI_PROJECT_DIR/examples/led_light/build/led_light.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
81-
82-
.build_fan: &build_fan
83-
# Building fan app - Started
84-
- echo Building fan app - Started
85-
- echo Running idf.py
86-
- cd $CI_PROJECT_DIR/examples/fan
87-
- idf.py build
88-
- echo Building fan app - Done
89-
# Building fan app - Done
90-
# Copying fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
91-
- echo Copy fan.bin to esp-rainmaker-bins-${CI_JOB_ID}/
92-
- cp $CI_PROJECT_DIR/examples/fan/build/fan.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
93-
94-
.build_temperature_sensor: &build_temperature_sensor
95-
# Building temperature_sensor app - Started
96-
- echo Building temperature_sensor app - Started
97-
- echo Running idf.py
98-
- cd $CI_PROJECT_DIR/examples/temperature_sensor
99-
- idf.py build
100-
- echo Building temperature_sensor app - Done
101-
# Building temperature_sensor app - Done
102-
# Copying temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
103-
- echo Copy temperature_sensor.bin to esp-rainmaker-bins-${CI_JOB_ID}/
104-
- cp $CI_PROJECT_DIR/examples/temperature_sensor/build/temperature_sensor.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
105-
106-
.build_multi_device: &build_multi_device
107-
# Building multi_device app - Started
108-
- echo Building multi_device app - Started
109-
- echo Running idf.py
110-
- cd $CI_PROJECT_DIR/examples/multi_device
111-
- idf.py build
112-
- echo Building multi_device app - Done
113-
# Building multi_device app - Done
114-
# Copying multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
115-
- echo Copy multi_device.bin to esp-rainmaker-bins-${CI_JOB_ID}/
116-
- cp $CI_PROJECT_DIR/examples/multi_device/build/multi_device.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
117-
118-
.build_gpio: &build_gpio
119-
# Building gpio app - Started
120-
- echo Building gpio app - Started
121-
- echo Running idf.py
122-
- cd $CI_PROJECT_DIR/examples/gpio
123-
- idf.py build
124-
- echo Building gpio app - Done
125-
# Building gpio app - Done
126-
# Copying gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
127-
- echo Copy gpio.bin to esp-rainmaker-bins-${CI_JOB_ID}/
128-
- cp $CI_PROJECT_DIR/examples/gpio/build/gpio.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
129-
130-
.build_homekit_switch: &build_homekit_switch
131-
# Building homekit_switch app - Started
132-
- cd $CI_PROJECT_DIR/examples/homekit_switch
22+
.build_all_examples: &build_all_examples
23+
- pip install --upgrade idf-component-manager
24+
- for EXAMPLE in $EXAMPLES; do
25+
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
26+
- echo Building $EXAMPLE
27+
- if [[ "$EXAMPLE" == "homekit_switch" ]]; then
13328
- cd components
13429
- echo Cloning esp-homekit-sdk
13530
- git clone --recursive --branch master --depth 1 https://github.com/espressif/esp-homekit-sdk.git
13631
- cd ..
13732
- export HOMEKIT_PATH=$PWD/components/esp-homekit-sdk
138-
- echo Building homekit_switch app - Started
139-
- echo Running idf.py
33+
- fi
34+
- for TARGET in $EXAMPLE_TARGETS; do
35+
- echo Building for $TARGET
36+
- idf.py set-target $TARGET
14037
- idf.py build
141-
- echo Building homekit_switch app - Done
142-
# Building homekit_switch app - Done
143-
# Copying homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
144-
- echo Copy homekit_switch.bin to esp-rainmaker-bins-${CI_JOB_ID}/
145-
- cp $CI_PROJECT_DIR/examples/homekit_switch/build/homekit_switch.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/
38+
- mkdir -p $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
39+
- cp $CI_PROJECT_DIR/examples/$EXAMPLE/build/*.bin $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}/$EXAMPLE/$TARGET/
40+
- done
41+
- echo Build Complete for $EXAMPLE
42+
- done
43+
# Generating zip file for binaries generated
44+
- cd $CI_PROJECT_DIR
45+
- echo Generating zip file for binaries generated
46+
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
14647

147-
build_app:
48+
.build_template:
14849
stage: build
149-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
50+
image: espressif/idf:latest
15051
tags:
15152
- build
152-
artifacts:
153-
paths:
154-
- $CI_PROJECT_DIR/esp-rainmaker-bins-${CI_JOB_ID}.zip
155-
expire_in: 6 mos
53+
variables:
54+
PEDANTIC_FLAGS: "-Werror -Werror=deprecated-declarations -Wno-error=cpp -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
55+
EXTRA_CFLAGS: "${PEDANTIC_FLAGS}"
56+
EXTRA_CXXFLAGS: "${PEDANTIC_FLAGS}"
57+
EXAMPLE_TARGETS: "esp32"
58+
EXAMPLES: "switch led_light fan temperature_sensor multi_device gpio homekit_switch"
15659
script:
157-
- *setup_idf
158-
- for APP in $APP_BUILD; do
159-
- if [[ "$APP_BUILD" == "all" || "$APP" == "switch" ]]; then
160-
- *build_switch
161-
- fi
162-
- if [[ "$APP_BUILD" == "all" || "$APP" == "led_light" ]]; then
163-
- *build_led_light
164-
- fi
165-
- if [[ "$APP_BUILD" == "all" || "$APP" == "fan" ]]; then
166-
- *build_fan
167-
- fi
168-
- if [[ "$APP_BUILD" == "all" || "$APP" == "temperature_sensor" ]]; then
169-
- *build_temperature_sensor
170-
- fi
171-
- if [[ "$APP_BUILD" == "all" || "$APP" == "multi_device" ]]; then
172-
- *build_multi_device
173-
- fi
174-
- if [[ "$APP_BUILD" == "all" || "$APP" == "gpio" ]]; then
175-
- *build_gpio
176-
- fi
177-
- if [[ "$APP_BUILD" == "all" || "$APP" == "homekit_switch" ]]; then
178-
- *build_homekit_switch
179-
- fi
180-
- done
181-
- echo Build Complete for $APP_BUILD
182-
# Generating zip file for binaries generated
183-
- cd $CI_PROJECT_DIR
184-
- echo Generating zip file for binaries generated
185-
- tar -zcvf esp-rainmaker-bins-${CI_JOB_ID}.zip esp-rainmaker-bins-${CI_JOB_ID}/
186-
60+
- *build_all_examples
61+
62+
build_idf_v4.1:
63+
extends: .build_template
64+
image: espressif/idf:release-v4.1
65+
66+
build_idf_v4.2:
67+
extends: .build_template
68+
image: espressif/idf:release-v4.2
69+
variables:
70+
EXAMPLE_TARGETS: "esp32 esp32s2"
71+
72+
build_idf_v4.3:
73+
extends: .build_template
74+
image: espressif/idf:release-v4.3
75+
variables:
76+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3"
77+
78+
build_idf_v4.4:
79+
extends: .build_template
80+
image: espressif/idf:release-v4.4
81+
variables:
82+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
83+
84+
build_idf_master:
85+
extends: .build_template
86+
image: espressif/idf:latest
87+
variables:
88+
EXAMPLE_TARGETS: "esp32 esp32s2 esp32c3 esp32s3"
89+
18790
build_docs:
18891
stage: build
189-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
92+
image: $CI_DOCKER_REGISTRY/esp32-ci-env
19093
tags:
19194
- build
19295
artifacts:
@@ -213,7 +116,7 @@ build_docs:
213116

214117
push_master_to_github:
215118
stage: deploy
216-
image: $CI_DOCKER_REGISTRY/esp32-ci-env:rainmaker
119+
image: espressif/idf:latest
217120
tags:
218121
- build
219122
when: on_success

0 commit comments

Comments
 (0)