forked from espressif/esp-idf-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
196 lines (174 loc) · 5.86 KB
/
.gitlab-ci.yml
File metadata and controls
196 lines (174 loc) · 5.86 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
stages:
- pre-check
- codecheck
- host_test
- build
- target_test
variables:
# System environment
TARGET_TEST_ENV_IMAGE: "$CI_DOCKER_REGISTRY/target-test-env-v5.2:2"
TEST_DIR: "$CI_PROJECT_DIR/test"
include:
- project: espressif/shared-ci-dangerjs
ref: master
file: danger.yaml
run-danger-mr-linter:
stage: pre-check
# WORKFLOW RULES
# ------------------------------------------------------------------------------------------------------
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_COMMIT_BRANCH'
# ------------------------------------------------------------------------------------------------------
# TEMPLATES
# ------------------------------------------------------------------------------------------------------
.base_template:
image: python:3.7-bullseye
tags:
- build
- internet
before_script:
- pip install -e .[dev] --prefer-binary
.idf_template:
image: "espressif/idf:latest"
tags:
- build
- internet
before_script:
- pip install -e .[dev,host_test] --prefer-binary
.build_template:
stage: build
needs:
- pre-commit_hooks_MR
tags:
- build
variables:
IDF_CCACHE_ENABLE: "1"
after_script:
# Show ccache statistics if enabled globally
- test "$CI_CCACHE_STATS" == 1 && test -n "$(which ccache)" && ccache --show-stats || true
# BUILD TEST APPS
# This template gets expanded multiple times, once for every IDF version.
# IDF version is specified by setting the espressif/idf image tag.
#
# TEST_TARGETS sets the list of IDF_TARGET values to build the test for.
# It should contain only the targets with optimized assembly implementations.
#
.before_script_build_jobs:
before_script:
- pip install .[dev,target_test] --prefer-binary
.build_pytest_template:
stage: build
extends:
- .build_template
- .before_script_build_jobs
artifacts:
paths:
- "**/build*/size.json"
- "**/build*/build.log"
- "**/build*/build_log.txt"
- "**/build*/*.bin"
- "**/build*/*.elf"
- "**/build*/*.map"
- "**/build*/flasher_args.json"
- "**/build*/flash_project_args"
- "**/build*/config/sdkconfig.json"
- "**/build*/bootloader/*.bin"
- "**/build*/partition_table/*.bin"
- size_info.txt
when: always
expire_in: 3 days
script:
# CI specific options start from "--collect-size-info xxx". could ignore when running locally
# The script below will build all test applications defined in environment variable $TEST_TARGETS
- cd ${TEST_DIR}
- python -m idf_build_apps build -v -p .
--recursive
--target all
--default-build-targets ${TEST_TARGETS}
--config "sdkconfig.ci.*=" --build-dir "build_@t_@w"
--check-warnings
--ignore-warning-file ignore_build_warnings.txt
--collect-size-info size_info.txt
--manifest-rootpath .
--manifest-file .build-test-rules.yml
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
variables:
TEST_TARGETS: "esp32"
build_idf_latest:
extends: .build_pytest_template
image: espressif/idf:latest
build_idf_v5.1:
extends: .build_pytest_template
image: espressif/idf:release-v5.1
# ------------------------------------------------------------------------------------------------------
# JOBS
# ------------------------------------------------------------------------------------------------------
# CODE CHECK BY PRE-COMMIT HOOKS
pre-commit_hooks_MR:
extends: .base_template
stage: codecheck
script:
- apt-get update && apt-get install -y -q git
- git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | xargs pre-commit run --files
# ------------------------------------------------------------------------------------------------------
# TESTS
# ------------------------------------------------------------------------------------------------------
test_idf_monitor:
extends: .idf_template
stage: host_test
needs:
- pre-commit_hooks_MR
artifacts:
# save artifacts always in order to access results which were retried without consequent failure
when: always
paths:
- test/host_test/outputs/*
expire_in: 1 week
script:
- cd test/host_test
# don't use the configuration file
- pytest -v -c /dev/null test_monitor.py
.before_script_pytest_jobs:
before_script:
- pip install .[target_test] --prefer-binary
# Get ESP-IDF and install the tools (such as addr2line). We don't need the whole ESP-IDF, but it is easier for downloading required tools.
# Dowloading just the tools would require recreating the directory structure and downloading dependencies one by one.
- cd /opt/
- git clone --depth 1 -b ${IDF_BRANCH} https://gitlab-ci-token:${ESPCI_TOKEN}@${GITLAB_HTTPS_HOST}/espressif/esp-idf.git
- cd esp-idf
- export IDF_PATH=${PWD}
- tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
.test_template:
stage: target_test
image: ${TARGET_TEST_ENV_IMAGE}
extends:
- .before_script_pytest_jobs
tags:
- generic
- esp32
artifacts:
paths:
- "${TEST_DIR}/*/*.log"
- "${TEST_DIR}/results_*.xml"
- "${TEST_DIR}/*.txt"
- "${TEST_DIR}/test_apps/pytest_embedded_log/"
reports:
junit: ${TEST_DIR}/results_${IDF_TARGET}_*.xml
when: always
expire_in: 1 week
script:
- cd ${TEST_DIR}
- IDF_VERSION=$(echo $IDF_BRANCH | tr / _)
- python -m pytest --junit-xml=${TEST_DIR}/results_${IDF_TARGET}_${IDF_VERSION}.xml --target=${IDF_TARGET}
test_target_apps:
extends: .test_template
parallel:
matrix:
- IDF_BRANCH: ["release/v5.1", "master"]
IDF_TARGET: ["esp32"]
# ------------------------------------------------------------------------------------------------------