Skip to content

Commit 1de39c7

Browse files
committed
Merge branch 'feature/add_ci' into 'main'
Add CI build flow See merge request adf/esp-webrtc-solution!2
2 parents 02af003 + 73c5a89 commit 1de39c7

File tree

17 files changed

+978
-1
lines changed

17 files changed

+978
-1
lines changed

.codespellrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[codespell]
2+
skip = build,*.yuv,alice.txt,*.rgb
3+
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,wel,ot
4+
write-changes = true

.gitlab-ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
stages:
2+
- pre_check
3+
- build
4+
- deploy
5+
6+
variables:
7+
GIT_STRATEGY: clone
8+
GET_SOURCES_ATTEMPTS: "10"
9+
ARTIFACT_DOWNLOAD_ATTEMPTS: "10"
10+
GIT_SUBMODULE_STRATEGY: none
11+
IDF_SKIP_CHECK_SUBMODULES: 1
12+
GIT_DEPTH: 1
13+
14+
before_script:
15+
- source ${CI_PROJECT_DIR}/tools/ci/utils.sh
16+
- add_gitlab_ssh_keys
17+
18+
include:
19+
- '.gitlab/ci/rules.yml'
20+
- '.gitlab/ci/common.yml'
21+
# - '.gitlab/ci/pre_check.yml'
22+
# - '.gitlab/ci/build_webrtc_solutions.yml'
23+
- '.gitlab/ci/deploy.yml'

.gitlab/ci/build_webrtc_solutions.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.build_template:
2+
artifacts:
3+
expire_in: 4 days
4+
paths:
5+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/size.json
6+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/build_log.txt
7+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/*.bin
8+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/*.elf
9+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/flasher_args.json
10+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/flash_project_args
11+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/config/sdkconfig.json
12+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/sdkconfig
13+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/bootloader/*.bin
14+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/build*/partition_table/*.bin
15+
- ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER/*.py
16+
before_script:
17+
- export OPENAI_API_KEY=FAKE_KEY_FOR_BUILD_ONLY
18+
script:
19+
- run_cmd python ${BASE_FRAMEWORK_PATH}/tools/ci/ci_build_apps.py ${CI_PROJECT_DIR}/solutions/$CI_BUILD_FOLDER
20+
-vv -t $IDF_TARGET --pytest-apps
21+
build_doorbell_demo_esp32p4:
22+
extends: .build_template
23+
stage: build
24+
variables:
25+
CI_BUILD_FOLDER: doorbell_demo
26+
IDF_TARGET: esp32p4
27+
build_doorbell_demo_esp32s3:
28+
extends: .build_template
29+
stage: build
30+
variables:
31+
CI_BUILD_FOLDER: doorbell_demo
32+
IDF_TARGET: esp32s3
33+
build_openai_demo_esp32s3:
34+
extends: .build_template
35+
stage: build
36+
variables:
37+
CI_BUILD_FOLDER: openai_demo
38+
IDF_TARGET: esp32s3
39+
build_peer_demo_esp32:
40+
extends: .build_template
41+
stage: build
42+
variables:
43+
CI_BUILD_FOLDER: peer_demo
44+
IDF_TARGET: esp32
45+
build_peer_demo_esp32s2:
46+
extends: .build_template
47+
stage: build
48+
variables:
49+
CI_BUILD_FOLDER: peer_demo
50+
IDF_TARGET: esp32s2
51+
build_peer_demo_esp32s3:
52+
extends: .build_template
53+
stage: build
54+
variables:
55+
CI_BUILD_FOLDER: peer_demo
56+
IDF_TARGET: esp32s3
57+
stages:
58+
- build
59+
variables:
60+
BASE_FRAMEWORK: $IDF_REPOSITORY
61+
BASE_FRAMEWORK_PATH: $CI_PROJECT_DIR/esp-idf
62+
DOCKER_IMAGE: ${CI_DOCKER_REGISTRY}/esp-env-v5.4:1
63+
IDF_TAG_FLAG: false
64+
IDF_VERSION_TAG: v5.4

.gitlab/ci/common.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
variables:
2+
DOCKER_IMAGE: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
3+
BASE_FRAMEWORK_PATH: "$CI_PROJECT_DIR/esp-idf"
4+
BASE_FRAMEWORK: $IDF_REPOSITORY
5+
IDF_VERSION_TAG: v5.3
6+
IDF_TAG_FLAG: false
7+
8+
.update_source: &update_source
9+
- source ${CI_PROJECT_DIR}/tools/ci/utils.sh
10+
- add_gitlab_ssh_keys
11+
- git submodule update --init --recursive
12+
- git clone $BASE_FRAMEWORK --depth 1
13+
- cd $BASE_FRAMEWORK_PATH
14+
- git submodule update --init
15+
- git log -2
16+
- fetch_idf_branch ${IDF_VERSION_TAG}
17+
- common_before_scripts
18+
- setup_tools_and_idf_python_venv
19+
- set_env_variable
20+
21+
.build_template:
22+
stage: build
23+
image: ${CI_DOCKER_REGISTRY}/esp-env-v5.3:1
24+
tags:
25+
- multimedia_build
26+
before_script:
27+
- *update_source

.gitlab/ci/deploy.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
push_to_github:
2+
stage: deploy
3+
rules:
4+
- if:
5+
'($CI_COMMIT_REF_NAME == "main" ||
6+
$CI_COMMIT_BRANCH =~ /^release\/v/ ||
7+
$CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/) &&
8+
$CI_PIPELINE_SOURCE != "schedule"'
9+
when: on_success
10+
image: $CI_DOCKER_REGISTRY/esp32-ci-env
11+
variables:
12+
GIT_STRATEGY: clone
13+
before_script:
14+
- echo "skip default before_script"
15+
script:
16+
- source ${CI_PROJECT_DIR}/tools/ci/utils.sh
17+
- add_github_ssh_keys
18+
- git fetch --unshallow
19+
- git remote remove github &>/dev/null || true
20+
- git remote add github ${TARGET_GITHUB_REPO}
21+
- push_to_github

.gitlab/ci/pre_check.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.pre_check_template:
2+
stage: pre_check
3+
image: "${CI_DOCKER_REGISTRY}/esp-env-v5.3:1"
4+
tags:
5+
- host_test
6+
dependencies: []
7+
8+
.check_branch_script: &check_branch_script |
9+
if [[ "$BOT_LABEL_SKIP_BRANCH_CHECK" = "true" || "$CI_MERGE_REQUEST_LABELS" =~ skip_branch_check ]]; then
10+
echo "Skip branch name check."
11+
else
12+
${CHECK_TOOLS_PATH}/check_commit_format branch-name
13+
fi
14+
15+
.check_commit_script: &check_commit_script |
16+
if [[ "$BOT_LABEL_SKIP_COMMIT_CHECK" = "true" || "$CI_MERGE_REQUEST_LABELS" =~ skip_commit_check ]]; then
17+
echo "Skip commit message check."
18+
else
19+
${CHECK_TOOLS_PATH}/check_commit_format commit-message
20+
fi
21+
22+
.check_code_script: &check_code_script |
23+
if [[ "$BOT_LABEL_SKIP_CODE_CHECK" = "true" || "$CI_MERGE_REQUEST_LABELS" =~ skip_code_check ]]; then
24+
echo "Skip code style check."
25+
else
26+
${CHECK_TOOLS_PATH}/check_commit_format --verbose --format code-style;
27+
if [ -d "${CHECK_REPO_PATH}/formatted" ] && [ "$(ls -A ${CHECK_REPO_PATH}/formatted)" ]; then
28+
git diff -- . ':(exclude).gitmodules' > ${CHECK_REPO_PATH}/patch/code_format.patch
29+
exit 1
30+
fi
31+
fi
32+
33+
check_commit_format:
34+
image: "$MULTIMEDIA_DOCKER_REGISTRY/pre_commit:1"
35+
stage: pre_check
36+
rules:
37+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS !~ /^(?:[^,\n\r]+,)*skip_check(?:,[^,\n\r]+)*$/i'
38+
script:
39+
- git clone --depth 1 $CHECK_FORMAT_TOOL_REPO
40+
- cd check-format-tool/bin
41+
- export CHECK_REPO_PATH=${CI_PROJECT_DIR}
42+
- ./install.sh
43+
- . ./export.sh
44+
- cd ${CHECK_REPO_PATH};
45+
- *check_branch_script
46+
- *check_commit_script
47+
- *check_code_script
48+
allow_failure: true
49+
artifacts:
50+
paths:
51+
- ${CI_PROJECT_DIR}/patch
52+
- ${CI_PROJECT_DIR}/formatted
53+
when: always
54+
expire_in: 4 days
55+
56+
check_pre_commit:
57+
extends:
58+
- .rules:build:protected-merge-requests
59+
- .pre_check_template
60+
before_script:
61+
- pip install pre-commit
62+
script:
63+
- |
64+
# merged results pipelines, by default
65+
if [[ -n $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA ]]; then
66+
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
67+
git fetch origin $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
68+
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA)
69+
# merge request pipelines, when the mr got conflicts
70+
elif [[ -n $CI_MERGE_REQUEST_DIFF_BASE_SHA ]]; then
71+
git fetch origin $CI_MERGE_REQUEST_DIFF_BASE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
72+
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
73+
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_MERGE_REQUEST_DIFF_BASE_SHA $CI_COMMIT_SHA)
74+
# other pipelines, like the protected branches pipelines
75+
elif [[ "$CI_COMMIT_BEFORE_SHA" != "0000000000000000000000000000000000000000" ]]; then
76+
git fetch origin $CI_COMMIT_BEFORE_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
77+
git fetch origin $CI_COMMIT_SHA --depth=1 ${GIT_FETCH_EXTRA_FLAGS}
78+
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA)
79+
else
80+
# pipeline source could be web, scheduler, etc.
81+
git fetch origin $CI_COMMIT_SHA --depth=2 ${GIT_FETCH_EXTRA_FLAGS}
82+
export GIT_DIFF_OUTPUT=$(git diff --name-only $CI_COMMIT_SHA~1 $CI_COMMIT_SHA)
83+
fi
84+
- MODIFIED_FILES=$(echo $GIT_DIFF_OUTPUT | xargs)
85+
- echo "MODIFIED_FILES=$MODIFIED_FILES" >> pipeline.env
86+
- pre-commit install --allow-missing-config -t pre-commit -t commit-msg
87+
- pre-commit run --files $MODIFIED_FILES
88+
artifacts:
89+
reports:
90+
dotenv: pipeline.env
91+
paths:
92+
- pipeline.env
93+
expire_in: 1 week
94+
when: always

.gitlab/ci/rules.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
##############
2+
# if anchors #
3+
##############
4+
.if-web: &if-web
5+
if: '$CI_PIPELINE_SOURCE == "web"'
6+
7+
.if-ref-main: &if-ref-main
8+
if: '$CI_COMMIT_REF_NAME == "main"'
9+
10+
.if-trigger: &if-trigger
11+
if: '$CI_PIPELINE_SOURCE == "trigger"'
12+
13+
.if-pipeline: &if-pipeline
14+
if: '$CI_PIPELINE_SOURCE == "pipeline"'
15+
16+
.if-schedule: &if-schedule
17+
if: '$CI_PIPELINE_SOURCE == "schedule"'
18+
19+
.if-merge_request_event: &if-merge_request_event
20+
if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
21+
22+
.if-open-merge-request: &if-open-merge-request
23+
if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && ($CI_PIPELINE_SOURCE == "push")'
24+
25+
.if-dev-push: &if-dev-push
26+
if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && ($CI_PIPELINE_SOURCE == "push")'
27+
28+
.if-protected: &if-protected
29+
if: '($CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_BRANCH =~ /^release\/v/ || $CI_COMMIT_TAG =~ /^v\d+\.\d+(\.\d+)?($|-)/)'
30+
31+
.if-label-unit_test: &if-label-unit_test
32+
if: '$BOT_LABEL_UNIT_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*unit_test(?:,[^,\n\r]+)*$/i'
33+
34+
.if-label-example_test: &if-label-example_test
35+
if: '$BOT_LABEL_EXAMPLE_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*example_test(?:,[^,\n\r]+)*$/i'
36+
37+
.if-label-example: &if-label-example
38+
if: '$BOT_LABEL_EXAMPLE_TEST || $CI_MERGE_REQUEST_LABELS =~ /^(?:[^,\n\r]+,)*example(?:,[^,\n\r]+)*$/i'
39+
40+
.if-idf-version-tag-v5-3: &if-idf-version-tag-v5-3
41+
if: '$IDF_VERSION_TAG == "v5.3"'
42+
variables:
43+
IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v5.3:1"
44+
45+
.rules:build:unit-test:
46+
rules:
47+
- <<: *if-protected
48+
- <<: *if-label-unit_test
49+
50+
.rules:ref:main-schedule:
51+
rules:
52+
- <<: *if-ref-main
53+
- <<: *if-schedule
54+
55+
.rules:ref:check-label:
56+
rules:
57+
- <<: *if-merge_request_event
58+
59+
.rules:build:regular-board-idf-ver-tag:
60+
rules:
61+
- <<: *if-dev-push
62+
when: never
63+
- <<: *if-schedule
64+
when: never
65+
- <<: *if-idf-version-tag-v5-3
66+
67+
.rules:build:non-regular-board-idf-ver-tag:
68+
rules:
69+
- <<: *if-dev-push
70+
when: never
71+
- <<: *if-merge_request_event
72+
when: never
73+
- <<: *if-idf-version-tag-v5-3
74+
75+
.rules:build:protected-merge-requests-pipeline:
76+
rules:
77+
- <<: *if-trigger
78+
- <<: *if-pipeline
79+
- <<: *if-protected
80+
- <<: *if-merge_request_event
81+
82+
.rules:build:protected-merge-requests:
83+
rules:
84+
- <<: *if-protected
85+
- <<: *if-merge_request_event

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
4+
repos:
5+
- repo: https://github.com/codespell-project/codespell
6+
rev: v2.2.6
7+
hooks:
8+
- id: codespell
9+
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v4.3.0
12+
hooks:
13+
- id: check-executables-have-shebangs
14+
- id: check-merge-conflict
15+
- id: double-quote-string-fixer
16+
- id: end-of-file-fixer
17+
types_or: [c, c++]
18+
- id: mixed-line-ending
19+
args: ['-f=lf']
20+
types_or: [c, c++]
21+
- id: no-commit-to-branch
22+
name: Do not use more than one slash in the branch name
23+
args: ['--pattern', '^[^/]*/[^/]*/']
24+
- id: no-commit-to-branch
25+
name: Do not use uppercase letters in the branch name
26+
args: ['--pattern', '^[^A-Z]*[A-Z]']
27+
- id: trailing-whitespace
28+
types_or: [c, c++]

components/esp_webrtc/impl/peer_default/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
idf_component_register()
1+
idf_component_register(INCLUDE_DIRS ./include)
22

33
get_filename_component(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
44
add_prebuilt_library(${BASE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/${IDF_TARGET}/libpeer_default.a"

0 commit comments

Comments
 (0)