ci: Update ci to use idf_build_apps

This commit is contained in:
Wu Jian Gang
2023-03-30 12:02:55 +08:00
parent 7c8e38559a
commit 2cf8157cfd
4 changed files with 345 additions and 43 deletions
+19 -43
View File
@@ -2,6 +2,21 @@ stages:
- build
- deploy
workflow:
rules:
# Disable those non-protected push triggered pipelines
- if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"'
when: never
# when running merged result pipelines, it would create a temp commit id. use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA instead of $CI_COMMIT_SHA.
# Please use PIPELINE_COMMIT_SHA at all places that require a commit sha
- if: $CI_OPEN_MERGE_REQUESTS != null
variables:
PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA
- if: $CI_OPEN_MERGE_REQUESTS == null
variables:
PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA
- when: always
variables:
ESP_BOX_PATH: "$CI_PROJECT_DIR"
BATCH_BUILD: "1"
@@ -19,46 +34,7 @@ before_script:
- git --version
- git submodule update --init --recursive --force
.build_all_examples_script: &build_all_examples_script
- for EXAMPLE in $EXAMPLES; do
- cd $CI_PROJECT_DIR/examples/$EXAMPLE
- echo Building $EXAMPLE
- idf.py fullclean
- idf.py build
- echo Build Complete for $EXAMPLE
- done
.build_template:
stage: build
tags:
- build
variables:
EXAMPLES: "factory_demo image_display lv_demos mp3_demo watering_demo"
script:
- *build_all_examples_script
build_idf_v5.0:
extends: .build_template
image: espressif/idf:release-v5.0
push_to_github:
stage: deploy
only:
- master
- /^release\/v/
# when: on_success
image: $CI_DOCKER_REGISTRY/esp32-ci-env
variables:
GIT_STRATEGY: clone
before_script:
- echo "skip default before_script"
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git remote remove github &>/dev/null || true
- git remote add github git@github.com:espressif/esp-box.git
- ${ESP_BOX_PATH}/tools/ci/push_to_github.sh
include:
- '.gitlab/ci/rules.yml'
- '.gitlab/ci/build.yml'
- '.gitlab/ci/deploy.yml'
+209
View File
@@ -0,0 +1,209 @@
.build_template: &build_template
stage: build
image: espressif/idf:release-v5.0
tags:
- build
variables:
# Enable ccache for all build jobs. See configure_ci_environment.sh for more ccache related settings.
IDF_CCACHE_ENABLE: "1"
BATCH_BUILD: "1"
V: "0"
WARNING_STR: ""
.build_examples_template: &build_examples_template
<<: *build_template
artifacts:
when: always
paths:
- "**/build*/size.json"
- "**/build*/build_log.txt"
- "**/build*/*.bin"
# upload to s3 server to save the artifacts size
- "**/build*/*.map"
- "**/build*/*.elf"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/bootloader/*.elf"
- "**/build*/partition_table/*.bin"
- size_info.txt
expire_in: 1 week
variables:
IDF_CI_BUILD: "1"
script:
- pip install --upgrade idf-component-manager
- pip install idf_build_apps
- python -m idf_build_apps build -vv
-p $EXAMPLE_DIR
-t all
--config "sdkconfig.ci.*="
--build-dir build_@t_@w
--build-log build_log.txt
--size-file size.json
--check-warnings
--ignore-warning-str "$WARNING_STR"
--collect-size-info size_info.txt
--default-build-targets $IDF_TARGET
build_example_factory_demo_v5.0:
extends:
- .build_examples_template
- .rules:build:example_factory_demo
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/factory_demo
build_example_factory_demo_v5.1:
extends:
- .build_examples_template
- .rules:build:example_factory_demo
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/factory_demo
build_example_factory_demo_latest:
extends:
- .build_examples_template
- .rules:build:example_factory_demo
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/factory_demo
build_example_image_display_v5.0:
extends:
- .build_examples_template
- .rules:build:example_image_display
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/image_display
build_example_image_display_v5.1:
extends:
- .build_examples_template
- .rules:build:example_image_display
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/image_display
build_example_image_display_latest:
extends:
- .build_examples_template
- .rules:build:example_image_display
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/image_display
build_example_lv_demos_v5.0:
extends:
- .build_examples_template
- .rules:build:example_lv_demos
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/lv_demos
build_example_lv_demos_v5.1:
extends:
- .build_examples_template
- .rules:build:example_lv_demos
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/lv_demos
build_example_lv_demos_latest:
extends:
- .build_examples_template
- .rules:build:example_lv_demos
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/lv_demos
build_example_mp3_demo_v5.0:
extends:
- .build_examples_template
- .rules:build:example_mp3_demo
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/mp3_demo
build_example_mp3_demo_v5.1:
extends:
- .build_examples_template
- .rules:build:example_mp3_demo
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/mp3_demo
build_example_mp3_demo_latest:
extends:
- .build_examples_template
- .rules:build:example_mp3_demo
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/mp3_demo
build_example_usb_headset_v5.0:
extends:
- .build_examples_template
- .rules:build:example_usb_headset
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/usb_headset
build_example_usb_headset_v5.1:
extends:
- .build_examples_template
- .rules:build:example_usb_headset
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/usb_headset
build_example_usb_headset_latest:
extends:
- .build_examples_template
- .rules:build:example_usb_headset
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/usb_headset
build_example_watering_demo_v5.0:
extends:
- .build_examples_template
- .rules:build:example_watering_demo
image: espressif/idf:release-v5.0
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/watering_demo
build_example_watering_demo_v5.1:
extends:
- .build_examples_template
- .rules:build:example_watering_demo
image: espressif/idf:release-v5.1
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/watering_demo
build_example_watering_demo_latest:
extends:
- .build_examples_template
- .rules:build:example_watering_demo
image: espressif/idf:latest
variables:
IDF_TARGET: esp32s3
EXAMPLE_DIR: examples/watering_demo
+21
View File
@@ -0,0 +1,21 @@
push_to_github:
stage: deploy
only:
- master
- /^release\/v/
# when: on_success
image: $CI_DOCKER_REGISTRY/esp32-ci-env
variables:
GIT_STRATEGY: clone
before_script:
- echo "skip default before_script"
script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -n $GH_PUSH_KEY > ~/.ssh/id_rsa_base64
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git remote remove github &>/dev/null || true
- git remote add github git@github.com:espressif/esp-box.git
- ${ESP_BOX_PATH}/tools/ci/push_to_github.sh
+96
View File
@@ -0,0 +1,96 @@
############
# Patterns #
############
# components folder, in the alphabetic order
.patterns-components_bsp: &patterns-components_bsp
- "components/bsp/**/*"
# examples folder, in the alphabetic order
.patterns-example_factory_demo: &patterns-example_factory_demo
- "examples/factory_demo/**/*"
.patterns-example_image_display: &patterns-example_image_display
- "examples/image_display/**/*"
.patterns-example_lv_demos: &patterns-example_lv_demos
- "examples/lv_demos/**/*"
.patterns-example_mp3_demo: &patterns-example_mp3_demo
- "examples/mp3_demo/**/*"
.patterns-example_usb_headset: &patterns-example_usb_headset
- "examples/usb_headset/**/*"
.patterns-example_watering_demo: &patterns-example_watering_demo
- "examples/watering_demo/**/*"
##############
# if anchors #
##############
.if-protected: &if-protected
if: '($CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
.if-dev-push: &if-dev-push
if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event")'
##################
# Auto Generated #
##################
.if-label-build: &if-label-build
if: '$CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*build(?:,[^,\n\r]+)*$/i'
# rules for examples
.rules:build:example_factory_demo:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_factory_demo
.rules:build:example_image_display:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_image_display
.rules:build:example_lv_demos:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_lv_demos
.rules:build:example_mp3_demo:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_mp3_demo
.rules:build:example_usb_headset:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_usb_headset
.rules:build:example_watering_demo:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-components_bsp
- <<: *if-dev-push
changes: *patterns-example_watering_demo