ci: upload cache only when requirements txt changed

pull/9141/head
Fu Hanxi 2022-06-07 09:05:15 +08:00
rodzic 5a0a14504d
commit f20a747a26
5 zmienionych plików z 53 dodań i 9 usunięć

Wyświetl plik

@ -1,4 +1,5 @@
stages:
- upload_cache
- pre_check
- build
- assign_test
@ -100,7 +101,7 @@ cache:
paths:
- .cache/pip
# pull only for most of the use cases since it's cache dir.
# Only set "pull-push" policy for "scan_test" since it would **possibly** install all pypi packages
# Only set "push" policy for "upload_cache" stage jobs since it would install all pypi packages
policy: pull
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
@ -226,6 +227,7 @@ default:
include:
- '.gitlab/ci/rules.yml'
- '.gitlab/ci/upload_cache.yml'
- '.gitlab/ci/docs.yml'
- '.gitlab/ci/static-code-analysis.yml'
- '.gitlab/ci/pre_check.yml'

Wyświetl plik

@ -7,7 +7,11 @@
tags:
- host_test
dependencies: []
needs: [] # run host_test jobs immediately
needs:
- job: upload-pip-cache-shiny
optional: true # run host_test jobs immediately, only after upload cache
- job: upload-pip-cache-brew
optional: true # run host_test jobs immediately, only after upload cache
test_nvs_on_host:
extends: .host_test_template

Wyświetl plik

@ -160,13 +160,6 @@ scan_tests:
- $TEST_APPS_OUTPUT_DIR
- $COMPONENT_UT_OUTPUT_DIR
expire_in: 1 week
cache:
key: pip-cache
paths:
- .cache/pip
# pull only for most of the use cases since it's cache dir.
# Only set "pull-push" policy for "scan_test" since it would **possibly** install all pypi packages
policy: pull-push
variables:
EXAMPLE_TEST_DIR: ${CI_PROJECT_DIR}/examples
EXAMPLE_TEST_OUTPUT_DIR: ${CI_PROJECT_DIR}/examples/test_configs

Wyświetl plik

@ -12,6 +12,10 @@
- "components/**/Kconfig"
- "components/**/CMakeList.txt"
.patterns-python-cache: &patterns-python-cache
- "tools/requirements.json"
- "tools/requirements/requirements.*.txt"
.patterns-python-files: &patterns-python-files
- ".gitlab/ci/static-code-analysis.yml"
- "**/*.py"
@ -232,6 +236,11 @@
rules:
- <<: *if-protected-no_label
.rules:patterns:python-cache:
rules:
- <<: *if-dev-push
changes: *patterns-python-cache
.rules:dev:
rules:
- <<: *if-trigger

Wyświetl plik

@ -0,0 +1,36 @@
.upload_cache_template:
stage: upload_cache
image: $ESP_ENV_IMAGE
.upload_pip_cache_template:
extends:
- .upload_cache_template
- .rules:patterns:python-cache
cache:
key: pip-cache
paths:
- .cache/pip
# pull only for most of the use cases since it's cache dir.
# Only set "push" policy for "upload_cache" stage jobs since it would install all pypi packages
policy: push
before_script: []
script:
- source tools/ci/utils.sh
- is_based_on_commits $REQUIRED_ANCESTOR_COMMITS
- source tools/ci/setup_python.sh
- rm -rf .cache/pip # clear old packages
- $IDF_PATH/tools/idf_tools.py install-python-env --features pytest
# TODO: remove this, IDFCI-1207
- pip install esptool -c ~/.espressif/${CI_PYTHON_CONSTRAINT_FILE}
upload-pip-cache-shiny:
extends: .upload_pip_cache_template
tags:
- shiny
- build
upload-pip-cache-brew:
extends: .upload_pip_cache_template
tags:
- brew
- build