Skip to content

Commit b0d85db

Browse files
authored
ci: force local wheels via uv override in cross-tests (#1723)
1 parent 97ad2b6 commit b0d85db

4 files changed

Lines changed: 96 additions & 23 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""Write a uv override file forcing the locally built uipath wheels.
2+
3+
Cross-test workflows build uipath wheels from the PR and run them against
4+
downstream repos (uipath-langchain-python, uipath-integrations-python,
5+
uipath-runtime-python). Those downstreams cap the uipath* version (e.g.
6+
``uipath<2.11.0``), so a backward-compatible minor bump would fail resolution
7+
purely on the cap. uv ``override-dependencies`` ignore the declared version
8+
specifier, so pointing them at the local wheels lets the cross-test exercise the
9+
real new code regardless of the cap.
10+
11+
The script is layout-agnostic: it overrides whatever ``uipath*`` wheels exist
12+
under ``$GITHUB_WORKSPACE/wheels`` (recursively), so it works for the
13+
three-wheel layout (``wheels/<pkg>/dist/*.whl``) and the single-wheel runtime
14+
layout (``wheels/*.whl``) alike.
15+
16+
The resulting override file path is appended to ``GITHUB_ENV`` as ``UV_OVERRIDE``
17+
so every subsequent ``uv`` invocation in the job honors it.
18+
"""
19+
20+
import glob
21+
import os
22+
import pathlib
23+
24+
25+
def main() -> None:
26+
wheels = pathlib.Path(os.environ.get("GITHUB_WORKSPACE", ".")).resolve() / "wheels"
27+
28+
lines = []
29+
for whl in sorted(glob.glob(str(wheels / "**" / "*.whl"), recursive=True)):
30+
# Wheel filename is ``{distribution}-{version}-...whl`` where the
31+
# distribution escapes hyphens to underscores (uipath_core -> uipath-core).
32+
dist = pathlib.Path(whl).name.split("-", 1)[0].replace("_", "-")
33+
if not dist.startswith("uipath"):
34+
continue
35+
lines.append(f"{dist} @ {pathlib.Path(whl).resolve().as_uri()}")
36+
37+
if not lines:
38+
raise SystemExit(f"no uipath wheels found under {wheels}")
39+
40+
out = wheels / "overrides.txt"
41+
out.write_text("\n".join(lines) + "\n")
42+
43+
with open(os.environ["GITHUB_ENV"], "a") as fh:
44+
fh.write(f"UV_OVERRIDE={out}\n")
45+
46+
print("\n".join(lines))
47+
48+
49+
if __name__ == "__main__":
50+
main()

.github/workflows/test-uipath-integrations.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@ jobs:
102102
repository: 'UiPath/uipath-integrations-python'
103103
path: 'uipath-integrations-python'
104104

105-
- name: Update uipath packages
105+
- name: Checkout uipath-python scripts
106+
uses: actions/checkout@v4
107+
with:
108+
path: _scripts
109+
sparse-checkout: .github/scripts
110+
111+
- name: Override uipath packages with local wheels
106112
shell: bash
107-
working-directory: uipath-integrations-python/packages/${{ matrix.package }}
108113
run: |
109-
uv add ../../../wheels/uipath-core/dist/*.whl --dev
110-
uv add ../../../wheels/uipath-platform/dist/*.whl --dev
111-
uv add ../../../wheels/uipath/dist/*.whl --dev
114+
PYBIN=$(command -v python || command -v python3)
115+
"$PYBIN" "$GITHUB_WORKSPACE/_scripts/.github/scripts/write_uv_overrides.py"
112116
113117
- name: Install dependencies and run tests
114118
shell: bash
@@ -202,13 +206,17 @@ jobs:
202206
repository: 'UiPath/uipath-integrations-python'
203207
path: 'uipath-integrations-python'
204208

205-
- name: Update uipath packages
209+
- name: Checkout uipath-python scripts
210+
uses: actions/checkout@v4
211+
with:
212+
path: _scripts
213+
sparse-checkout: .github/scripts
214+
215+
- name: Override uipath packages with local wheels
206216
shell: bash
207-
working-directory: uipath-integrations-python/packages/${{ matrix.package }}
208217
run: |
209-
uv add ../../../wheels/uipath-core/dist/*.whl
210-
uv add ../../../wheels/uipath-platform/dist/*.whl
211-
uv add ../../../wheels/uipath/dist/*.whl
218+
PYBIN=$(command -v python || command -v python3)
219+
"$PYBIN" "$GITHUB_WORKSPACE/_scripts/.github/scripts/write_uv_overrides.py"
212220
213221
- name: Install dependencies
214222
working-directory: uipath-integrations-python/packages/${{ matrix.package }}

.github/workflows/test-uipath-langchain.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,17 @@ jobs:
7272
repository: 'UiPath/uipath-langchain-python'
7373
path: 'uipath-langchain-python'
7474

75-
- name: Update uipath packages
75+
- name: Checkout uipath-python scripts
76+
uses: actions/checkout@v4
77+
with:
78+
path: _scripts
79+
sparse-checkout: .github/scripts
80+
81+
- name: Override uipath packages with local wheels
7682
shell: bash
77-
working-directory: uipath-langchain-python
7883
run: |
79-
uv add ../wheels/uipath-core/dist/*.whl --dev
80-
uv add ../wheels/uipath-platform/dist/*.whl --dev
81-
uv add ../wheels/uipath/dist/*.whl --dev
84+
PYBIN=$(command -v python || command -v python3)
85+
"$PYBIN" "$GITHUB_WORKSPACE/_scripts/.github/scripts/write_uv_overrides.py"
8286
8387
- name: Run uipath-langchain tests
8488
working-directory: uipath-langchain-python
@@ -146,13 +150,17 @@ jobs:
146150
repository: 'UiPath/uipath-langchain-python'
147151
path: 'uipath-langchain-python'
148152

149-
- name: Update uipath packages
153+
- name: Checkout uipath-python scripts
154+
uses: actions/checkout@v4
155+
with:
156+
path: _scripts
157+
sparse-checkout: .github/scripts
158+
159+
- name: Override uipath packages with local wheels
150160
shell: bash
151-
working-directory: uipath-langchain-python
152161
run: |
153-
uv add ../wheels/uipath-core/dist/*.whl
154-
uv add ../wheels/uipath-platform/dist/*.whl
155-
uv add ../wheels/uipath/dist/*.whl
162+
PYBIN=$(command -v python || command -v python3)
163+
"$PYBIN" "$GITHUB_WORKSPACE/_scripts/.github/scripts/write_uv_overrides.py"
156164
157165
- name: Install dependencies
158166
working-directory: uipath-langchain-python

.github/workflows/test-uipath-runtime.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,17 @@ jobs:
6464
repository: 'UiPath/uipath-runtime-python'
6565
path: 'uipath-runtime-python'
6666

67-
- name: Update uipath-core version
67+
- name: Checkout uipath-python scripts
68+
uses: actions/checkout@v4
69+
with:
70+
path: _scripts
71+
sparse-checkout: .github/scripts
72+
73+
- name: Override uipath packages with local wheels
6874
shell: bash
69-
working-directory: uipath-runtime-python
70-
run: uv add ../wheels/*.whl --dev
75+
run: |
76+
PYBIN=$(command -v python || command -v python3)
77+
"$PYBIN" "$GITHUB_WORKSPACE/_scripts/.github/scripts/write_uv_overrides.py"
7178
7279
- name: Run uipath-runtime tests
7380
working-directory: uipath-runtime-python

0 commit comments

Comments
 (0)