-
Notifications
You must be signed in to change notification settings - Fork 4.3k
181 lines (170 loc) · 5.84 KB
/
Copy pathci.yml
File metadata and controls
181 lines (170 loc) · 5.84 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: "Run CI"
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review, labeled, unlabeled]
workflow_dispatch:
inputs:
python_versions:
description: 'JSON array of Python versions to run. Leave empty for the full default matrix.'
required: false
default: ""
type: string
run_windows:
description: "Run the Windows smoke test lane."
required: false
default: false
type: boolean
run_macos:
description: "Run the macOS smoke test lane."
required: false
default: false
type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
DEFAULT_PYTHON_VERSIONS: '["3.10"]'
FULL_PYTHON_VERSIONS: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
run_ci: ${{ steps.manual.outputs.run_ci || steps.labeled.outputs.run_ci || steps.filter.outputs.run_ci }}
full_ci: ${{ steps.manual.outputs.full_ci || steps.labeled.outputs.full_ci || steps.filter.outputs.full_matrix_override }}
default_python_versions: ${{ steps.python_versions.outputs.default_python_versions }}
full_python_versions: ${{ steps.python_versions.outputs.full_python_versions }}
steps:
- name: Set Python version selections
id: python_versions
run: |
echo "default_python_versions=${DEFAULT_PYTHON_VERSIONS}" >> "$GITHUB_OUTPUT"
echo "full_python_versions=${FULL_PYTHON_VERSIONS}" >> "$GITHUB_OUTPUT"
- name: Mark manual runs to execute CI
if: ${{ github.event_name == 'workflow_dispatch' }}
id: manual
run: |
echo "run_ci=true" >> "$GITHUB_OUTPUT"
echo "full_ci=true" >> "$GITHUB_OUTPUT"
- name: Mark explicitly labeled PR runs to execute CI
if: >-
${{
github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'tests:full')
}}
id: labeled
run: |
echo "run_ci=true" >> "$GITHUB_OUTPUT"
echo "full_ci=true" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: >-
${{
github.event_name != 'workflow_dispatch' &&
steps.labeled.outcome == 'skipped'
}}
with:
fetch-depth: 0
- name: Detect changed paths
if: >-
${{
github.event_name != 'workflow_dispatch' &&
steps.labeled.outcome == 'skipped'
}}
id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
run_ci:
- ".github/workflows/**"
- ".github/scripts/**"
- ".github/actions/**"
- ".github/max-lines-ignore"
- ".github/dprint.json"
- ".pre-commit-config.yaml"
- "pyproject.toml"
- "scripts/check_max_lines.py"
- "scripts/check_tach_module_coverage.py"
- "tach.toml"
- "uv.lock"
- "Dockerfile"
- "Makefile"
- "README.md"
- "LICENSE"
- "docling/**"
- "tests/**"
- "docs/examples/**"
full_matrix_override:
- ".github/workflows/**"
- ".github/scripts/**"
- ".github/actions/**"
- "tach.toml"
- "pyproject.toml"
- "uv.lock"
code-checks:
needs: changes
if: ${{ needs.changes.outputs.run_ci == 'true' }}
permissions:
contents: read
pull-requests: read
uses: ./.github/workflows/checks.yml
with:
run_lint: true
force_all_checks: ${{ needs.changes.outputs.full_ci == 'true' }}
run_package_compat: ${{ needs.changes.outputs.full_ci == 'true' }}
run_windows: ${{ github.event_name == 'workflow_dispatch' && inputs.run_windows }}
run_macos: ${{ github.event_name == 'workflow_dispatch' && inputs.run_macos }}
use_tach: ${{ github.event_name == 'pull_request' && needs.changes.outputs.full_ci != 'true' }}
tach_base_ref: >-
${{
(
github.event_name == 'pull_request' &&
github.event.pull_request.base.sha
) || ''
}}
python_versions: >-
${{
(
github.event_name == 'workflow_dispatch' &&
(inputs.python_versions || needs.changes.outputs.full_python_versions)
) ||
(
needs.changes.outputs.full_ci == 'true' &&
needs.changes.outputs.full_python_versions
) ||
needs.changes.outputs.default_python_versions
}}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
ci-status:
if: ${{ always() }}
needs:
- changes
- code-checks
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
steps:
- name: Check CI result
env:
CHANGES_RESULT: ${{ needs.changes.result }}
CODE_CHECKS_RESULT: ${{ needs.code-checks.result }}
run: |
if [ "$CHANGES_RESULT" != "success" ]; then
echo "::error title=CI changes job failed::changes result was $CHANGES_RESULT"
exit 1
fi
case "$CODE_CHECKS_RESULT" in
success)
echo "CI checks passed."
;;
skipped)
echo "CI checks are not required for this change set."
;;
*)
echo "::error title=CI checks failed::code-checks result was $CODE_CHECKS_RESULT"
exit 1
;;
esac