Skip to content

Commit 0822761

Browse files
Update workflows to use uv
Update Github workflows to use uv … Co-authored-by: Oliver Copping <oliver.copping@diamond.ac.uk>
1 parent 1933864 commit 0822761

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Install requirements
2-
description: Install a version of python then call pip install and report what was installed
2+
description: Install uv, use it to install dependencies and report what was installed
33
inputs:
44
python-version:
55
description: Python version to install, default is from Dockerfile
66
default: "dev"
7-
pip-install:
8-
description: Parameters to pass to pip install
9-
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"
7+
uv-sync:
8+
description: Parameters to pass to uv sync
9+
default: "--locked"
1010

1111
runs:
1212
using: composite
@@ -21,15 +21,17 @@ runs:
2121
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
2222
shell: bash
2323

24-
- name: Setup python
25-
uses: actions/setup-python@v5
24+
- name: Install uv and set the python version
25+
uses: astral-sh/setup-uv@v5
2626
with:
2727
python-version: ${{ env.PYTHON_VERSION }}
28+
enable-cache: true
29+
cache-dependency-glob: "uv.lock"
2830

2931
- name: Install packages
30-
run: pip install ${{ inputs.pip-install }}
32+
run: uv sync ${{ inputs.uv-sync }}
3133
shell: bash
3234

3335
- name: Report what was installed
34-
run: pip freeze
36+
run: uv pip freeze
3537
shell: bash

.github/workflows/_dist.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ jobs:
2727
run: pipx run twine check --strict dist/*
2828

2929
- name: Install produced wheel
30-
uses: ./.github/actions/install_requirements
31-
with:
32-
pip-install: dist/*.whl
30+
run: pipx run pip install dist/*.whl
3331

3432
- name: Test module --version works using the installed wheel
3533
# If more than one module in src/ replace with module name to test

.github/workflows/_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
- if: inputs.python-version == 'dev'
3636
name: Write the requirements as an artifact
37-
run: pip freeze --exclude-editable > /tmp/dev-requirements.txt
37+
run: uv pip freeze --exclude-editable > /tmp/dev-requirements.txt
3838

3939
- if: inputs.python-version == 'dev'
4040
name: Upload dev-requirements.txt
@@ -48,7 +48,7 @@ jobs:
4848
uses: ./.github/actions/install_requirements
4949
with:
5050
python-version: ${{ inputs.python-version }}
51-
pip-install: ".[dev]"
51+
uv-sync: ""
5252

5353
- name: Run tests
5454
run: tox -e tests

0 commit comments

Comments
 (0)