Smart CI for docs (#21021)
* Handle Smart CI for docs * Remove path filters * Fix quotes * Fix logic * Revert unneeded change * Add md_files_only to components configuration * Get rid of custom output * Try to fix condition * Add manual handling of some docs changes * Remove helper label
This commit is contained in:
1 parent
75acdac5f9
commit
f0c0bf89e2
2 files changed
+22
-14
No files matched your search
@@ -189,6 +189,26 @@ def main():
|
||||
cfg = ComponentConfig(components_config, schema, all_possible_components)
|
||||
affected_components = cfg.get_affected_components(changed_component_names)
|
||||
|
||||
# We don't need to run workflow if changes were only in documentation
|
||||
# This is the case when we have no product labels set except "docs"
|
||||
# or only if md files were matched (the latter covers cases where *.md is outside docs directory)
|
||||
only_docs_changes = False
|
||||
if args.pr and not run_full_scope:
|
||||
# We don't want to add helper labels to labeler config for now, so handling it manually
|
||||
docs_label_only = changed_component_names - {'docs'} == set()
|
||||
if docs_label_only:
|
||||
only_docs_changes = True
|
||||
else:
|
||||
# To avoid spending extra API requests running step below only if necessary
|
||||
changed_files = gh_api.pulls.list_files(args.pr)
|
||||
doc_suffixes = ['.md', '.rst', '.png', '.jpg', '.svg']
|
||||
only_docs_changes = all([Path(f.filename).suffix in doc_suffixes for f in changed_files])
|
||||
logger.debug(f"doc files only: {only_docs_changes}")
|
||||
|
||||
if only_docs_changes:
|
||||
logger.info(f"Changes are documentation only, workflow may be skipped")
|
||||
affected_components['docs_only'] = ComponentConfig.FullScope
|
||||
|
||||
# Syntactic sugar for easier use in GHA pipeline
|
||||
affected_components_output = {name: {s: True for s in scope} for name, scope in affected_components.items()}
|
||||
set_github_output("affected_components", json.dumps(affected_components_output))
|
||||
|
||||
@@ -5,21 +5,7 @@ on:
|
||||
- cron: '0 0 * * 3,6'
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**'
|
||||
- '!**/docs/**'
|
||||
- '!docs/**'
|
||||
- 'docs/snippets/**'
|
||||
- '!**/**.md'
|
||||
- '!**.md'
|
||||
push:
|
||||
paths:
|
||||
- '**'
|
||||
- '!docs/**'
|
||||
- '!**/docs/**'
|
||||
- 'docs/snippets/**'
|
||||
- '!**/**.md'
|
||||
- '!**.md'
|
||||
branches:
|
||||
- master
|
||||
- 'releases/**'
|
||||
@@ -60,6 +46,7 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
Build:
|
||||
needs: Smart_CI
|
||||
timeout-minutes: 150
|
||||
defaults:
|
||||
run:
|
||||
@@ -85,6 +72,7 @@ jobs:
|
||||
BUILD_DIR: /__w/openvino/openvino/openvino_build
|
||||
SCCACHE_AZURE_KEY_PREFIX: ubuntu20_x86_64_Release
|
||||
ONNX_RUNTIME_UTILS: /__w/openvino/openvino/openvino/.ci/azure/ci_utils/onnxruntime
|
||||
if: "!fromJSON(needs.smart_ci.outputs.affected_components).docs_only"
|
||||
|
||||
steps:
|
||||
- name: Install git
|
||||
|
||||
Reference in new issue
Block a user