Skip to content

Commit

Permalink
Use uv to install dependencies in test.yml (attempt 394)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Feb 19, 2024
1 parent f49d239 commit 4a475ee
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false

defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
Expand All @@ -62,24 +58,28 @@ jobs:
cache: "pip"
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install uv
# Installing uv via curl is much faster than via pip,
# but there doesn't seem to be a great alternative to pip on Windows
# in the context of GitHub Actions
- name: Create and activate a virtual environment (Windows)
if: ${{ runner.os }} == "Windows"
# `pip install uv` is annoyingly slow,
# but there doesn't seem to be a better option on Windows currently
# that's available on GitHub Actions :(
#
# uv doesn't (yet) allow us to install packages globally;
# we have to create and activate a virtual environment
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
pip install "uv>=0.1.4"
else
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
# uv doesn't allow us to install packages globally;
# we have to create a venv and install things into that
- name: Create and activate a virtual environment
pip install uv
uv venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Create and activate a virtual environment (Windows)
if: ${{ runner.os }} != "Windows"
# uv doesn't (yet) allow us to install packages globally;
# we have to create and activate a virtual environment
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
echo "$PWD/.venv/Scripts" >> $GITHUB_PATH
- name: Install dependencies
run: uv pip install -e ".[pytest]"
- run: uv pip freeze
Expand Down

0 comments on commit 4a475ee

Please sign in to comment.