-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
skip windows GPU check if changes only in doc (#13248)
### Description Use Path filter and fake workflow to skip windows GPU check if there's only changes in doc. Refs: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks The fake github yaml is generated by code. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> ###verifications:### In this PR: since the win-gpu-ci-pipeline.yml and .github are updated, so the real Windows GPU workflows are always triggered. in #13256 To avoid update win-gpu-ci-pipleline.yml, I added the path filter in devops page. the fake win GPU workflows triggered, and the real workflows are skipped.
- Loading branch information
Showing
5 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# generate_skip_doc_change.py | ||
|
||
from pathlib import Path | ||
|
||
from jinja2 import Environment, FileSystemLoader, Template | ||
|
||
GITHUB_DIR = Path(__file__).resolve().parent.parent | ||
|
||
|
||
class Skipped_Workflow: | ||
def __init__(self, workflow_name: str, job_names: list, output_file_name: str): | ||
self.workflow_name = workflow_name | ||
self.job_names = job_names | ||
self.fake_file_name = output_file_name | ||
|
||
|
||
WIN_GPU_CI_WORKFLOW = Skipped_Workflow( | ||
workflow_name="Windows GPU CI Pipeline", | ||
job_names=[ | ||
"cuda build_x64_RelWithDebInfo", | ||
"dml build_x64_RelWithDebInfo", | ||
"training build_x64_RelWithDebInfo", | ||
"kernelDocumentation build_x64_RelWithDebInfo", | ||
], | ||
output_file_name=str(GITHUB_DIR.joinpath("workflows/generated_fake_win_gpu_ci.yml")), | ||
) | ||
|
||
|
||
def generate_fake_ci_yaml(template: Template, workflow: Skipped_Workflow): | ||
content = template.render(ci_workflow_name=workflow.workflow_name, job_names=workflow.job_names) | ||
|
||
filename = workflow.fake_file_name | ||
with open(filename, mode="w", encoding="utf-8") as output_file: | ||
output_file.write(content) | ||
if content[-1] != "\n": | ||
output_file.write("\n") | ||
print(f"... wrote {filename}") | ||
|
||
|
||
def main() -> None: | ||
environment = Environment(loader=FileSystemLoader(str(GITHUB_DIR.joinpath("workflows/")))) | ||
template = environment.get_template("skip-doc-change.yml.j2") | ||
skipped_workflows = [WIN_GPU_CI_WORKFLOW] | ||
[generate_fake_ci_yaml(template, workflow) for workflow in skipped_workflows] | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Don't edit this file manully. | ||
# Run generate_fake_workflows.py to generate it. | ||
|
||
name: Windows GPU CI Pipeline | ||
on: | ||
push: | ||
paths: | ||
- docs/** | ||
- README.md | ||
- CONTRIBUTING.md | ||
- BUILD.md | ||
|
||
jobs: | ||
job1: | ||
name: cuda build_x64_RelWithDebInfo | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: 'echo "No build required, only documentation changed"' | ||
|
||
job2: | ||
name: dml build_x64_RelWithDebInfo | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: 'echo "No build required, only documentation changed"' | ||
|
||
job3: | ||
name: training build_x64_RelWithDebInfo | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: 'echo "No build required, only documentation changed"' | ||
|
||
job4: | ||
name: kernelDocumentation build_x64_RelWithDebInfo | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: 'echo "No build required, only documentation changed"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Don't edit this file manully. | ||
# Run generate_fake_workflows.py to generate it. | ||
|
||
name: {{ ci_workflow_name }} | ||
on: | ||
push: | ||
paths: | ||
- docs/** | ||
- README.md | ||
- CONTRIBUTING.md | ||
- BUILD.md | ||
|
||
jobs: | ||
{%- for name in job_names %} | ||
job{{ loop.index }}: | ||
name: {{ name }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: 'echo "No build required, only documentation changed"' | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters