Skip to content

Commit

Permalink
Use uv in CI (#292)
Browse files Browse the repository at this point in the history
* Use uv in CI

* Use official uv action

* Add build dependencies to pyproject.toml

* Use uv run?

* Set up python with uv in CI

* idk

* Use venv

* uv run?

* Use uv python when building too

* Remove system python env var
  • Loading branch information
pederhan authored Sep 17, 2024
1 parent 0aa1665 commit 3c1cd08
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 30 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ jobs:
- name: Exit if not on master branch
if: github.ref_name != 'master'
run: exit -1

- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Set up Python 3.12
run: uv python install 3.12

- name: Install build dependencies
run: python -m pip install --upgrade build
run: |
uv venv
uv pip install --upgrade build
- name: Build source distribution
run: python -m build
run: uv run python -m build

- uses: actions/upload-artifact@v4
with:
Expand All @@ -43,15 +51,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Run PyInstaller with Tox
run: |
python -m ensurepip --upgrade
python -m pip install tox tox-uv tox-gh-actions
uv venv
uv pip install tox-uv tox-gh-actions
tox
- name: Rename binary
Expand Down
36 changes: 14 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on: [push, pull_request]


name: CI
jobs:
test:
Expand All @@ -17,25 +18,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
# - name: Cache pip
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: v1-pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements-*.txt') }}
# restore-keys: |
# v1-pip-${{ runner.os }}-${{ matrix.python-version }}
# v1-pip-${{ runner.os }}
# v1-pip-
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install mreg-cli
run: |
python -m ensurepip --upgrade
pip install -e .[dev]
uv venv
uv pip install -e .[dev]
- name: Test and compare api calls
run: ci/run_testsuite_and_record.sh
run: uv run ci/run_testsuite_and_record.sh

tox:
name: tox
Expand All @@ -49,14 +41,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m ensurepip --upgrade
python -m pip install tox tox-uv tox-gh-actions
uv venv
uv pip install tox-uv tox-gh-actions
- name: Test with tox
run: tox r
run: uv run tox r

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
dev = ["ruff", "tox", "rich"]
dev = ["ruff", "tox-uv", "rich", "setuptools", "setuptools-scm", "build"]

[project.urls]
Repository = 'https://github.com/unioslo/mreg-cli/'
Expand Down

0 comments on commit 3c1cd08

Please sign in to comment.