Skip to content

Commit

Permalink
Try using uv in the tests.yml workflow without the trick
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Feb 18, 2024
1 parent f97c2a3 commit 4e74d1d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ jobs:
cache: "pip"
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Trick uv into thinking we've activated a venv
run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
- name: Install uv
- name: Install dependencies and run tests
# 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
#
# Unfortunately uv doesn't allow you to install packages globally,
# and if you activate a venv, it is deactivated again
# as soon as the step ends,
# so we have to do the whole thing in one massive step here:
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
pip install "uv>=0.1.4"
uv venv
.venv\Scripts\activate.bat
else
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
fi
- name: Uninstall pip
# we need to uninstall pip or uv complains about how setup-python
# has pip installed twice for some reason??
run: python -m pip uninstall pip --yes
- name: Install dependencies
run: uv pip install -e ".[pytest]"
- run: uv pip freeze
- name: Run tests under coverage
run: |
uv pip install -e ".[pytest]"
uv pip freeze
coverage run -m pytest --doctest-modules
coverage report --no-skip-covered
Expand Down

0 comments on commit 4e74d1d

Please sign in to comment.