mirror of https://github.com/astral-sh/uv
Enable the Python download cache in CI
This commit is contained in:
parent
5686771464
commit
d3239a76b7
|
|
@ -214,7 +214,18 @@ jobs:
|
||||||
run: rustup show
|
run: rustup show
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||||
|
|
||||||
|
- name: "Cache Python downloads"
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/uv/python
|
||||||
|
key: uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
restore-keys: |
|
||||||
|
uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
uv-${{ runner.os }}
|
||||||
- name: "Install required Python versions"
|
- name: "Install required Python versions"
|
||||||
|
env:
|
||||||
|
UV_PYTHON_CACHE_DIR: /tmp/uv/python
|
||||||
run: uv python install
|
run: uv python install
|
||||||
|
|
||||||
- name: "Install cargo nextest"
|
- name: "Install cargo nextest"
|
||||||
|
|
@ -226,6 +237,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# Retry more than default to reduce flakes in CI
|
# Retry more than default to reduce flakes in CI
|
||||||
UV_HTTP_RETRIES: 5
|
UV_HTTP_RETRIES: 5
|
||||||
|
UV_PYTHON_CACHE_DIR: /tmp/uv/python
|
||||||
run: |
|
run: |
|
||||||
cargo nextest run \
|
cargo nextest run \
|
||||||
--features python-patch \
|
--features python-patch \
|
||||||
|
|
@ -250,7 +262,18 @@ jobs:
|
||||||
run: rustup show
|
run: rustup show
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||||
|
|
||||||
|
- name: "Cache Python downloads"
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/uv/python
|
||||||
|
key: uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
restore-keys: |
|
||||||
|
uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
uv-${{ runner.os }}
|
||||||
- name: "Install required Python versions"
|
- name: "Install required Python versions"
|
||||||
|
env:
|
||||||
|
UV_PYTHON_CACHE_DIR: /tmp/uv/python
|
||||||
run: uv python install
|
run: uv python install
|
||||||
|
|
||||||
- name: "Install cargo nextest"
|
- name: "Install cargo nextest"
|
||||||
|
|
@ -262,6 +285,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
# Retry more than default to reduce flakes in CI
|
# Retry more than default to reduce flakes in CI
|
||||||
UV_HTTP_RETRIES: 5
|
UV_HTTP_RETRIES: 5
|
||||||
|
UV_PYTHON_CACHE_DIR: /tmp/uv/python
|
||||||
run: |
|
run: |
|
||||||
cargo nextest run \
|
cargo nextest run \
|
||||||
--no-default-features \
|
--no-default-features \
|
||||||
|
|
@ -287,7 +311,19 @@ jobs:
|
||||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.UV_WORKSPACE }}" -Recurse
|
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.UV_WORKSPACE }}" -Recurse
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
- uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
|
||||||
|
|
||||||
|
- name: "Cache Python downloads"
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.UV_WORKSPACE }}/python
|
||||||
|
key: uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
restore-keys: |
|
||||||
|
uv-${{ runner.os }}-${{ hashFiles('.python-versions') }}
|
||||||
|
uv-${{ runner.os }}
|
||||||
|
|
||||||
- name: "Install required Python versions"
|
- name: "Install required Python versions"
|
||||||
|
env:
|
||||||
|
UV_PYTHON_CACHE_DIR: ${{ env.UV_WORKSPACE }}/python
|
||||||
run: uv python install
|
run: uv python install
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
|
- uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
|
||||||
|
|
@ -311,6 +347,7 @@ jobs:
|
||||||
# Avoid permission errors during concurrent tests
|
# Avoid permission errors during concurrent tests
|
||||||
# See https://github.com/astral-sh/uv/issues/6940
|
# See https://github.com/astral-sh/uv/issues/6940
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
|
UV_PYTHON_CACHE_DIR: ${{ env.UV_WORKSPACE }}/python
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cargo nextest run \
|
cargo nextest run \
|
||||||
|
|
|
||||||
|
|
@ -2261,7 +2261,8 @@ fn python_install_no_cache() {
|
||||||
.with_managed_python_dirs();
|
.with_managed_python_dirs();
|
||||||
|
|
||||||
// Install the latest version
|
// Install the latest version
|
||||||
uv_snapshot!(context.filters(), context.python_install(), @r"
|
uv_snapshot!(context.filters(), context.python_install()
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2279,7 +2280,8 @@ fn python_install_no_cache() {
|
||||||
bin_python.assert(predicate::path::exists());
|
bin_python.assert(predicate::path::exists());
|
||||||
|
|
||||||
// Should be a no-op when already installed
|
// Should be a no-op when already installed
|
||||||
uv_snapshot!(context.filters(), context.python_install(), @r###"
|
uv_snapshot!(context.filters(), context.python_install()
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2289,7 +2291,8 @@ fn python_install_no_cache() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// Similarly, when a requested version is already installed
|
// Similarly, when a requested version is already installed
|
||||||
uv_snapshot!(context.filters(), context.python_install().arg("3.13"), @r###"
|
uv_snapshot!(context.filters(), context.python_install().arg("3.13")
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2298,7 +2301,8 @@ fn python_install_no_cache() {
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
// You can opt-in to a reinstall
|
// You can opt-in to a reinstall
|
||||||
uv_snapshot!(context.filters(), context.python_install().arg("3.13").arg("--reinstall"), @r"
|
uv_snapshot!(context.filters(), context.python_install().arg("3.13").arg("--reinstall")
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2309,7 +2313,8 @@ fn python_install_no_cache() {
|
||||||
");
|
");
|
||||||
|
|
||||||
// Uninstallation requires an argument
|
// Uninstallation requires an argument
|
||||||
uv_snapshot!(context.filters(), context.python_uninstall(), @r###"
|
uv_snapshot!(context.filters(), context.python_uninstall()
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r###"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2323,7 +2328,8 @@ fn python_install_no_cache() {
|
||||||
For more information, try '--help'.
|
For more information, try '--help'.
|
||||||
"###);
|
"###);
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.python_uninstall().arg("3.13"), @r"
|
uv_snapshot!(context.filters(), context.python_uninstall().arg("3.13")
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -2343,7 +2349,8 @@ fn python_install_no_cache() {
|
||||||
uv_snapshot!(filters, context
|
uv_snapshot!(filters, context
|
||||||
.python_install()
|
.python_install()
|
||||||
.arg("3.12")
|
.arg("3.12")
|
||||||
.arg("--offline"), @r"
|
.arg("--offline")
|
||||||
|
.env_remove(EnvVars::UV_PYTHON_CACHE_DIR), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 1
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue