1stages: 2 - pre_check 3 - build 4 - assign_test 5 - build_doc 6 - target_test 7 - host_test 8 - test_deploy 9 - deploy 10 - post_deploy 11 12workflow: 13 rules: 14 # Disable those non-protected push triggered pipelines 15 - if: '$CI_COMMIT_REF_NAME != "master" && $CI_COMMIT_BRANCH !~ /^release\/v/ && $CI_COMMIT_TAG !~ /^v\d+\.\d+(\.\d+)?($|-)/ && $CI_PIPELINE_SOURCE == "push"' 16 when: never 17 # when running merged result pipelines, it would create a temp commit id. use $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA instead of $CI_COMMIT_SHA. 18 # Please use PIPELINE_COMMIT_SHA at all places that require a commit sha 19 - if: $CI_OPEN_MERGE_REQUESTS != null 20 variables: 21 PIPELINE_COMMIT_SHA: $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA 22 - if: $CI_OPEN_MERGE_REQUESTS == null 23 variables: 24 PIPELINE_COMMIT_SHA: $CI_COMMIT_SHA 25 - when: always 26 27variables: 28# System environment 29 30 # Common parameters for the 'make' during CI tests 31 MAKEFLAGS: "-j5 --no-keep-going" 32 33# GitLab-CI environment 34 35 # XXX_ATTEMPTS variables (https://docs.gitlab.com/ce/ci/yaml/README.html#job-stages-attempts) are not defined here. 36 # Use values from "CI / CD Settings" - "Variables". 37 38 # GIT_STRATEGY is not defined here. 39 # Use an option from "CI / CD Settings" - "General pipelines". 40 41 # we will download archive for each submodule instead of clone. 42 # we don't do "recursive" when fetch submodule as they're not used in CI now. 43 GIT_SUBMODULE_STRATEGY: none 44 SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py" 45 # by default we will fetch all submodules 46 # jobs can overwrite this variable to only fetch submodules they required 47 # set to "none" if don't need to fetch submodules 48 SUBMODULES_TO_FETCH: "all" 49 # tell build system do not check submodule update as we download archive instead of clone 50 IDF_SKIP_CHECK_SUBMODULES: 1 51 52 IDF_PATH: "$CI_PROJECT_DIR" 53 BATCH_BUILD: "1" 54 V: "0" 55 CHECKOUT_REF_SCRIPT: "$CI_PROJECT_DIR/tools/ci/checkout_project_ref.py" 56 57 # Docker images 58 BOT_DOCKER_IMAGE_TAG: ":latest" 59 ESP_IDF_DOC_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env:v4.4-1-v5" 60 ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env:v4.4-1" 61 AFL_FUZZER_TEST_IMAGE: "$CI_DOCKER_REGISTRY/afl-fuzzer-test:v4.4-1-1" 62 CLANG_STATIC_ANALYSIS_IMAGE: "${CI_DOCKER_REGISTRY}/clang-static-analysis:v4.4-1-2" 63 SONARQUBE_SCANNER_IMAGE: "${CI_DOCKER_REGISTRY}/sonarqube-scanner:3" 64 65 # target test config file, used by assign test job 66 CI_TARGET_TEST_CONFIG_FILE: "$CI_PROJECT_DIR/.gitlab/ci/target-test.yml" 67 68 # target test repo parameters 69 TEST_ENV_CONFIG_REPO: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/ci-test-runner-configs.git" 70 CI_AUTO_TEST_SCRIPT_REPO_URL: "https://gitlab-ci-token:${BOT_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/qa/auto_test_script.git" 71 CI_AUTO_TEST_SCRIPT_REPO_BRANCH: "ci/v4.1" 72 73.setup_tools_unless_target_test: &setup_tools_unless_target_test | 74 if [[ -n "$IDF_DONT_USE_MIRRORS" ]]; then 75 export IDF_MIRROR_PREFIX_MAP= 76 fi 77 if [[ "$SETUP_TOOLS" == "1" || "$CI_JOB_STAGE" != "target_test" ]]; then 78 tools/idf_tools.py --non-interactive install ${SETUP_TOOLS_LIST:-} && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1 79 if [[ ! -z "$OOCD_DISTRO_URL" && "$CI_JOB_STAGE" == "target_test" ]]; then 80 echo "Using custom OpenOCD from ${OOCD_DISTRO_URL}" 81 wget $OOCD_DISTRO_URL 82 ARCH_NAME=$(basename $OOCD_DISTRO_URL) 83 tar -x -f $ARCH_NAME 84 export OPENOCD_SCRIPTS=$PWD/openocd-esp32/share/openocd/scripts 85 export PATH=$PWD/openocd-esp32/bin:$PATH 86 fi 87 fi 88 89before_script: 90 - source tools/ci/utils.sh 91 - source tools/ci/setup_python.sh 92 - add_gitlab_ssh_keys 93 - source tools/ci/configure_ci_environment.sh 94 - *setup_tools_unless_target_test 95 - fetch_submodules 96 97# used for check scripts which we want to run unconditionally 98.before_script_no_sync_submodule: 99 before_script: 100 - echo "Not setting up GitLab key, not fetching submodules" 101 - source tools/ci/utils.sh 102 - source tools/ci/setup_python.sh 103 - source tools/ci/configure_ci_environment.sh 104 105.before_script_minimal: 106 before_script: 107 - echo "Only load utils.sh" 108 - source tools/ci/utils.sh 109 110.before_script_macos: 111 before_script: 112 - source tools/ci/utils.sh 113 - export IDF_TOOLS_PATH="${HOME}/.espressif_runner_${CI_RUNNER_ID}_${CI_CONCURRENT_ID}" 114 - $IDF_PATH/tools/idf_tools.py install-python-env 115 # On macOS, these tools need to be installed 116 - $IDF_PATH/tools/idf_tools.py --non-interactive install cmake ninja 117 # This adds tools (compilers) and the version-specific Python environment to PATH 118 - *setup_tools_unless_target_test 119 # Install packages required by CI scripts into IDF Python environment 120 - pip install -r $IDF_PATH/tools/ci/python_packages/ttfw_idf/requirements.txt 121 - source tools/ci/configure_ci_environment.sh 122 # Part of tools/ci/setup_python.sh; we don't use pyenv on macOS, so can't run the rest of the script. 123 - export PYTHONPATH="$IDF_PATH/tools:$IDF_PATH/tools/ci/python_packages:$PYTHONPATH" 124 - fetch_submodules 125 126default: 127 retry: 128 max: 2 129 # In case of a runner failure we could hop to another one, or a network error could go away. 130 when: runner_system_failure 131 132include: 133 - '.gitlab/ci/rules.yml' 134 - '.gitlab/ci/docs.yml' 135 - '.gitlab/ci/static-code-analysis.yml' 136 - '.gitlab/ci/pre_check.yml' 137 - '.gitlab/ci/build.yml' 138 - '.gitlab/ci/assign-test.yml' 139 - '.gitlab/ci/host-test.yml' 140 - '.gitlab/ci/target-test.yml' 141 - '.gitlab/ci/deploy.yml' 142