@@ -72,16 +72,11 @@ jobs:
72
72
persist-credentials : false
73
73
- name : " Cleanup docker"
74
74
run : ./scripts/ci/cleanup_docker.sh
75
- - uses : actions/setup-python@v5
76
- with :
77
- python-version : " ${{ inputs.default-python-version }}"
78
- cache : ' pip'
79
- cache-dependency-path : ./dev/breeze/pyproject.toml
80
- - run : pip install --editable ./dev/breeze/
81
- - run : python -m pytest -n auto --color=yes
75
+ - name : " Install Breeze"
76
+ uses : ./.github/actions/breeze
77
+ - run : uv tool run --from apache-airflow-breeze pytest -n auto --color=yes
82
78
working-directory : ./dev/breeze/
83
79
84
-
85
80
tests-ui :
86
81
timeout-minutes : 10
87
82
name : React UI tests
@@ -108,15 +103,24 @@ jobs:
108
103
node-version : 21
109
104
cache : ' pnpm'
110
105
cache-dependency-path : ' airflow/ui/pnpm-lock.yaml'
111
- - name : " Cache eslint"
112
- uses : actions/cache@v4
106
+ - name : " Restore eslint cache (ui) "
107
+ uses : apache/infrastructure- actions/stash/restore@c94b890bbedc2fc61466d28e6bd9966bc6c6643c
113
108
with :
114
- path : ' airflow/ui/node_modules'
115
- key : ${{ runner.os }}-ui-node-modules-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
109
+ path : airflow/ui/node_modules/
110
+ key : cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
111
+ id : restore-eslint-cache
116
112
- run : cd airflow/ui && pnpm install --frozen-lockfile
117
113
- run : cd airflow/ui && pnpm test
118
114
env :
119
115
FORCE_COLOR : 2
116
+ - name : " Save eslint cache (ui)"
117
+ uses : apache/infrastructure-actions/stash/save@c94b890bbedc2fc61466d28e6bd9966bc6c6643c
118
+ with :
119
+ path : airflow/ui/node_modules/
120
+ key : cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
121
+ if-no-files-found : ' error'
122
+ retention-days : ' 2'
123
+ if : steps.restore-eslint-cache.outputs.stash-hit != 'true'
120
124
121
125
tests-www :
122
126
timeout-minutes : 10
@@ -137,15 +141,64 @@ jobs:
137
141
uses : actions/setup-node@v4
138
142
with :
139
143
node-version : 21
140
- - name : " Cache eslint"
141
- uses : actions/cache@v4
144
+ - name : " Restore eslint cache (www) "
145
+ uses : apache/infrastructure- actions/stash/restore@c94b890bbedc2fc61466d28e6bd9966bc6c6643c
142
146
with :
143
- path : ' airflow/www/node_modules'
144
- key : ${{ runner.os }}-www-node-modules-${{ hashFiles('airflow/www/**/yarn.lock') }}
147
+ path : airflow/www/node_modules/
148
+ key : cache-www-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/www/**/yarn.lock') }}
149
+ id : restore-eslint-cache
145
150
- run : yarn --cwd airflow/www/ install --frozen-lockfile --non-interactive
146
151
- run : yarn --cwd airflow/www/ run test
147
152
env :
148
153
FORCE_COLOR : 2
154
+ - name : " Save eslint cache (www)"
155
+ uses : apache/infrastructure-actions/stash/save@c94b890bbedc2fc61466d28e6bd9966bc6c6643c
156
+ with :
157
+ path : airflow/www/node_modules/
158
+ key : cache-www-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/www/**/yarn.lock') }}
159
+ if-no-files-found : ' error'
160
+ retention-days : ' 2'
161
+ if : steps.restore-eslint-cache.outputs.stash-hit != 'true'
162
+
163
+ install-pre-commit :
164
+ timeout-minutes : 5
165
+ name : " Install pre-commit for cache"
166
+ runs-on : ${{ fromJSON(inputs.runs-on-as-json-default) }}
167
+ env :
168
+ PYTHON_MAJOR_MINOR_VERSION : " ${{ inputs.default-python-version }}"
169
+ if : inputs.basic-checks-only == 'true'
170
+ steps :
171
+ - name : " Cleanup repo"
172
+ shell : bash
173
+ run : docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
174
+ - name : " Checkout ${{ github.ref }} ( ${{ github.sha }} )"
175
+ uses : actions/checkout@v4
176
+ with :
177
+ persist-credentials : false
178
+ - name : " Install Breeze"
179
+ uses : ./.github/actions/breeze
180
+ id : breeze
181
+ - name : " Install pre-commit"
182
+ uses : ./.github/actions/install-pre-commit
183
+ id : pre-commit
184
+ with :
185
+ python-version : ${{steps.breeze.outputs.host-python-version}}
186
+ - name : " Prepare .tar file from pre-commit cache"
187
+ run : |
188
+ tar -C ~ -czf /tmp/cache-pre-commit.tar.gz .cache/pre-commit .cache/uv
189
+ shell : bash
190
+ # Saving pre-commit cache should happen only in one job in the entire workflow - because otherwise
191
+ # it will cause 409 conflict errors - see https://github.com/actions/upload-artifact/issues/478
192
+ # the way it works with airflow - even if the same action is in "ci-image-tests" the if condition
193
+ # above `if: inputs.basic-checks-only == 'true'` will prevent it from running in the other job
194
+ - name : " Save pre-commit[pre-commit] cache"
195
+ uses : apache/infrastructure-actions/stash/save@c94b890bbedc2fc61466d28e6bd9966bc6c6643c
196
+ with :
197
+ # yamllint disable rule:line-length
198
+ key : cache-pre-commit-v4-${{ steps.breeze.outputs.host-python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
199
+ path : /tmp/cache-pre-commit.tar.gz
200
+ if-no-files-found : ' error'
201
+ retention-days : ' 2'
149
202
150
203
# Those checks are run if no image needs to be built for checks. This is for simple changes that
151
204
# Do not touch any of the python code or any of the important files that might require building
@@ -154,6 +207,7 @@ jobs:
154
207
timeout-minutes : 30
155
208
name : " Static checks: basic checks only"
156
209
runs-on : ${{ fromJSON(inputs.runs-on-as-json-public) }}
210
+ needs : install-pre-commit
157
211
if : inputs.basic-checks-only == 'true'
158
212
steps :
159
213
- name : " Cleanup repo"
@@ -165,18 +219,6 @@ jobs:
165
219
persist-credentials : false
166
220
- name : " Cleanup docker"
167
221
run : ./scripts/ci/cleanup_docker.sh
168
- - name : " Setup python"
169
- uses : actions/setup-python@v5
170
- with :
171
- python-version : ${{ inputs.default-python-version }}
172
- cache : ' pip'
173
- cache-dependency-path : ./dev/breeze/pyproject.toml
174
- - name : " Setup python"
175
- uses : actions/setup-python@v5
176
- with :
177
- python-version : " ${{ inputs.default-python-version }}"
178
- cache : ' pip'
179
- cache-dependency-path : ./dev/breeze/pyproject.toml
180
222
- name : " Install Breeze"
181
223
uses : ./.github/actions/breeze
182
224
id : breeze
@@ -216,6 +258,7 @@ jobs:
216
258
timeout-minutes : 45
217
259
name : " Upgrade checks"
218
260
runs-on : ${{ fromJSON(inputs.runs-on-as-json-public) }}
261
+ needs : install-pre-commit
219
262
env :
220
263
PYTHON_MAJOR_MINOR_VERSION : " ${{ inputs.default-python-version }}"
221
264
if : inputs.canary-run == 'true' && inputs.latest-versions-only != 'true'
@@ -229,12 +272,14 @@ jobs:
229
272
persist-credentials : false
230
273
- name : " Cleanup docker"
231
274
run : ./scripts/ci/cleanup_docker.sh
232
- # Install python from scratch. No cache used. We always want to have fresh version of everything
233
- - uses : actions/setup-python@v5
275
+ - name : " Install Breeze"
276
+ uses : ./.github/actions/breeze
277
+ id : breeze
278
+ - name : " Install pre-commit"
279
+ uses : ./.github/actions/install-pre-commit
280
+ id : pre-commit
234
281
with :
235
- python-version : " ${{ inputs.default-python-version }}"
236
- - name : " Install latest pre-commit"
237
- run : pip install pre-commit
282
+ python-version : ${{steps.breeze.outputs.host-python-version}}
238
283
- name : " Autoupdate all pre-commits"
239
284
run : pre-commit autoupdate
240
285
- name : " Run automated upgrade for black"
0 commit comments