build: - upgrade idf-build-apps to 2.x - unify get_pytest_apps and get_cmake_apps to get_all_apps - returns (test_apps, non_test_apps) tuple - add tests for the new get_all_apps assign: - generate build report - generate target test pipeline based on the build report target test: - download artifacts from minio server - users can use `pytest --pipeline-id xxxxx` to download and flash the binaries from the artifacts .post: - generate target test reports
How the generate_rules.py works
Functionalities
This script can do only two things:
- Auto-generate some labels/rules we need and update them in
rules.yml - Generate a dependency tree graph
Schema
This file only used basic YAML grammar and has nothing to do with the GitLab version YAML file.
It has five custom keywords:
matrix: An array of sub-arrays, used to replicate rules by formatting strings. You can use the format string everywhere, it will be formatted recursivelylabels: An array oflabels.patterns: An array ofpatterns. Patterns that not includedincluded_in: An array of otherrulenames. It indicates thelabelsandpatternswill be included in all specifiedrulesas welldeploy: An array of strings, used to replicate rules by adding postfix-<item in deploy array>. It indicates the extralabelused inrules, which will explain later.
How to use this file to generate rules.yml
Let's take a complicated example to help understand the process
"test-{0}-{1}":
matrix:
- [a, b]
- [c, d]
labels:
- "{0}-{1}"
patterns:
- "{0}"
- pattern-not-exist
included_in:
- build-{0}
-
expand the mapping dicts defined by
matrixAfter this step, it will turn into 4 dicts:
key labels patterns included_in test-a-c a-c a build-a test-a-d a-d a build-a test-b-c b-c b build-b test-b-d b-d b build-b Advanced Usage: You can overwrite a mapping by declaring it again later, For example:
If we concatenate this part to the previous example,
# ... The same as the previous example test-a-c: labels: - overwriteruletest-a-cwill be turned into:key labels test-a-c overwrite Mappings with the keyword
deploywill also replicate by adding a postfix-<item in deploy array>to the mapping key -
create rules by
included_inAfter this step, it will turn into 6 mapping dicts:
key labels patterns test-a-c a-c a test-a-d a-d a test-b-c b-c b test-b-d b-d b build-a a-c, a-d a build-b b-c, b-d b -
replace the auto-generated region in
rules.ymlwithlabels, andrules. Each mapping will generate aruleand all the required labels.patternsare pre-defined inrules.ymland could not be generated automatically. If a mapping is using apatternundefined, thepatternwill be ignored.- If a mapping key has postfix
-preview, noif-protected-xxxclause will be added - else if a mapping key has postfix
-production, anif-protected-no_labelclause will be added - else, an
if-protectedclause will be added
- If a mapping key has postfix
Graph
All label nodes are in green, pattern nodes are in cyan, rule nodes are in blue
Requirements
There are a few extra dependencies while generating the dependency tree graph, please refer to pygraphviz documentation to install both graphviz and pygraphviz
CLI usage
python $IDF_PATH/tools/ci/generate_rules.py --graph OUTPUT_PATH