Skip to content

Commit 64720d4

Browse files
committed
Add integration test for UV_PROJECT_ENVIRONMENT
1 parent 9164999 commit 64720d4

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,6 @@ jobs:
880880
name: "integration test | github actions"
881881
runs-on: ubuntu-latest
882882
steps:
883-
- uses: actions/checkout@v4
884883
- uses: actions/setup-python@v5
885884
with:
886885
python-version: "3.12"
@@ -904,10 +903,35 @@ jobs:
904903
- name: Configure uv to use the system Python by default
905904
run: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
906905

907-
- name: "Install a package with environment system opt-in"
906+
- name: "Install a package with system opt-in via the environment"
908907
run: |
909908
./uv pip install anyio --reinstall
910909
910+
- name: "Create a project"
911+
run: |
912+
# Use Python 3.11 as the minimum required version
913+
./uv init --python 3.11
914+
./uv add anyio
915+
916+
- name: "Sync to the system Python"
917+
run: ./uv sync --python 3.12
918+
env:
919+
UV_PROJECT_ENVIRONMENT: "/opt/hostedtoolcache/Python/3.12.6/x64"
920+
921+
- name: "Attempt to sync to the system Python with an incompatible version"
922+
run: |
923+
./uv sync --python 3.11 && { echo "ci: Error; should not succeed"; exit 1; } || { echo "ci: Ok; expected failure"; exit 0; }
924+
env:
925+
UV_PROJECT_ENVIRONMENT: "/opt/hostedtoolcache/Python/3.12.6/x64"
926+
927+
- name: "Attempt to sync to a non-Python environment directory"
928+
run: |
929+
mkdir -p /home/runner/example
930+
touch /home/runner/example/some-file
931+
./uv sync && { echo "ci: Error; should not succeed"; exit 1; } || { echo "ci: Ok; expected failure"; exit 0; }
932+
env:
933+
UV_PROJECT_ENVIRONMENT: "/home/runner/example"
934+
911935
cache-test-ubuntu:
912936
timeout-minutes: 10
913937
needs: build-binary-linux

0 commit comments

Comments
 (0)