-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
124 lines (109 loc) · 4.26 KB
/
intelligent-testing.yml
File metadata and controls
124 lines (109 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: "Intelligent Python Testing"
on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened]
branches: [ main ]
concurrency:
group: intelligent-${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || format('run-{0}', github.run_id) }}
cancel-in-progress: true
permissions:
contents: read
jobs:
intelligent-test-selection:
name: Select test plan
runs-on: ubuntu-latest
outputs:
run_skip: ${{ steps.selector.outputs.run_skip }}
run_docs: ${{ steps.selector.outputs.run_docs }}
run_fast: ${{ steps.selector.outputs.run_fast }}
run_full: ${{ steps.selector.outputs.run_full }}
selected_workflows: ${{ steps.selector.outputs.selected_workflows }}
lane_reasons: ${{ steps.selector.outputs.lane_reasons }}
pytest_paths: ${{ steps.selector.outputs.pytest_paths }}
functional_scripts: ${{ steps.selector.outputs.functional_scripts }}
reasons: ${{ steps.selector.outputs.reasons }}
changed_files: ${{ steps.selector.outputs.changed_files }}
provenance: ${{ steps.selector.outputs.provenance }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for merge-base/diff to be reliable
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Run selector + generate report
id: selector
run: |
python -m pip install --upgrade pip
pip install "pydantic>=2,<3"
python tools/test_selector.py \
--write-github-output \
--write-summary \
--report-dir tmp/test-selection \
--json
- name: Upload selector report
uses: actions/upload-artifact@v6
with:
name: test-selection-report
path: |
tmp/test-selection/selection.json
tmp/test-selection/decision.md
retention-days: 7
if-no-files-found: error
skip:
name: Skipped (lint config change)
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_skip == 'true'
runs-on: ubuntu-latest
steps:
- run: |
echo "Only lint config files changed; skipping docs/tests."
echo "Pre-commit workflow is responsible for lint config validation."
docs:
name: Docs build
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_docs == 'true'
uses: ./.github/workflows/build-book.yml
with:
python-version: "3.10"
build_dir: "./_build/html"
upload_artifact: false
secrets: inherit
fast-tests:
name: Fast lane (targeted pytest + selected functional)
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_fast == 'true'
uses: ./.github/workflows/python-package.yml
with:
concurrency_key: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || '' }}
matrix_json: >-
{"include":[{"os":"ubuntu-latest","python-version":"3.12"}]}
pytest_paths_json: ${{ needs.intelligent-test-selection.outputs.pytest_paths }}
functional_scripts_json: ${{ needs.intelligent-test-selection.outputs.functional_scripts }}
full_suite: false
full-tests:
name: Full matrix tests
needs: intelligent-test-selection
if: needs.intelligent-test-selection.outputs.run_full == 'true'
uses: ./.github/workflows/python-package.yml
with:
concurrency_key: ${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || '' }}
matrix_json: >-
{
"include": [
{"os":"ubuntu-latest","python-version":"3.10"},
{"os":"ubuntu-latest","python-version":"3.11"},
{"os":"ubuntu-latest","python-version":"3.12"},
{"os":"macos-latest","python-version":"3.10"},
{"os":"macos-latest","python-version":"3.11"},
{"os":"macos-latest","python-version":"3.12"},
{"os":"windows-latest","python-version":"3.10"},
{"os":"windows-latest","python-version":"3.11"},
{"os":"windows-latest","python-version":"3.12"}
]
}
full_suite: true