mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
Merge branch 'ci/use_same_build_flags' into 'master'
CI: use same build flags in ci_build_apps.py Closes IDFCI-1564 See merge request espressif/esp-idf!21868
This commit is contained in:
commit
bcf19a275c
@ -168,3 +168,11 @@ check_test_scripts_build_test_rules:
|
||||
# required pytest related packages
|
||||
- run_cmd bash install.sh --enable-pytest
|
||||
- python tools/ci/check_build_test_rules.py check-test-scripts examples/ tools/test_apps components
|
||||
|
||||
check_configure_ci_environment_parsing:
|
||||
extends:
|
||||
- .pre_check_template
|
||||
- .before_script_build_jobs
|
||||
script:
|
||||
- cd tools/ci
|
||||
- python -m unittest ci_build_apps.py
|
||||
|
@ -8,6 +8,7 @@ This file is used in CI generate binary files for different kinds of apps
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Set
|
||||
@ -17,6 +18,14 @@ from idf_build_apps import LOGGER, App, build_apps, find_apps, setup_logging
|
||||
from idf_build_apps.constants import SUPPORTED_TARGETS
|
||||
from idf_ci_utils import IDF_PATH, PytestApp, get_pytest_cases, get_ttfw_app_paths
|
||||
|
||||
CI_ENV_VARS = {
|
||||
'EXTRA_CFLAGS': '-Werror -Werror=deprecated-declarations -Werror=unused-variable '
|
||||
'-Werror=unused-but-set-variable -Werror=unused-function -Wstrict-prototypes',
|
||||
'EXTRA_CXXFLAGS': '-Werror -Werror=deprecated-declarations -Werror=unused-variable '
|
||||
'-Werror=unused-but-set-variable -Werror=unused-function',
|
||||
'LDGEN_CHECK_MAPPING': '1',
|
||||
}
|
||||
|
||||
|
||||
def get_pytest_apps(
|
||||
paths: List[str],
|
||||
@ -157,22 +166,22 @@ def main(args: argparse.Namespace) -> None:
|
||||
if abs_extra_preserve_dir == abs_app_dir or abs_extra_preserve_dir in abs_app_dir.parents:
|
||||
app.preserve = True
|
||||
|
||||
ret_code = build_apps(
|
||||
apps,
|
||||
parallel_count=args.parallel_count,
|
||||
parallel_index=args.parallel_index,
|
||||
dry_run=False,
|
||||
build_verbose=args.build_verbose,
|
||||
keep_going=True,
|
||||
collect_size_info=args.collect_size_info,
|
||||
collect_app_info=args.collect_app_info,
|
||||
ignore_warning_strs=args.ignore_warning_str,
|
||||
ignore_warning_file=args.ignore_warning_file,
|
||||
copy_sdkconfig=args.copy_sdkconfig,
|
||||
sys.exit(
|
||||
build_apps(
|
||||
apps,
|
||||
parallel_count=args.parallel_count,
|
||||
parallel_index=args.parallel_index,
|
||||
dry_run=False,
|
||||
build_verbose=args.build_verbose,
|
||||
keep_going=True,
|
||||
collect_size_info=args.collect_size_info,
|
||||
collect_app_info=args.collect_app_info,
|
||||
ignore_warning_strs=args.ignore_warning_str,
|
||||
ignore_warning_file=args.ignore_warning_file,
|
||||
copy_sdkconfig=args.copy_sdkconfig,
|
||||
)
|
||||
)
|
||||
|
||||
sys.exit(ret_code)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(
|
||||
@ -276,8 +285,31 @@ if __name__ == '__main__':
|
||||
default=os.path.join(IDF_PATH, '.gitlab', 'ci', 'default-build-test-rules.yml'),
|
||||
help='default build test rules config file',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--skip-setting-flags',
|
||||
action='store_true',
|
||||
help='by default this script would set the build flags exactly the same as the CI ones. '
|
||||
'Set this flag to use your local build flags.',
|
||||
)
|
||||
|
||||
arguments = parser.parse_args()
|
||||
|
||||
setup_logging(arguments.verbose)
|
||||
|
||||
# skip setting flags in CI
|
||||
if not arguments.skip_setting_flags and not os.getenv('CI_JOB_ID'):
|
||||
for _k, _v in CI_ENV_VARS.items():
|
||||
os.environ[_k] = _v
|
||||
LOGGER.info(f'env var {_k} set to "{_v}"')
|
||||
|
||||
main(arguments)
|
||||
|
||||
|
||||
class TestParsingShellScript(unittest.TestCase):
|
||||
"""
|
||||
This test case is run in CI jobs to make sure the CI build flags is the same as the ones recorded in CI_ENV_VARS
|
||||
"""
|
||||
|
||||
def test_parse_result(self) -> None:
|
||||
for k, v in CI_ENV_VARS.items():
|
||||
self.assertEqual(os.getenv(k), v)
|
||||
|
Loading…
x
Reference in New Issue
Block a user