Skip to content

Commit

Permalink
Try switching to using uv in GitHub Actions
Browse files Browse the repository at this point in the history
For #89
  • Loading branch information
philgyford committed Jan 15, 2025
1 parent e9d2219 commit e01f0ce
Showing 1 changed file with 14 additions and 45 deletions.
59 changes: 14 additions & 45 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
test:
name: "Python ${{ matrix.python-version }}, Django ${{ matrix.django-version}}"
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand All @@ -30,30 +30,18 @@ jobs:
- name: Git clone
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Install uv and set Python version
uses: astral-sh/setup-uv@v5
with:
# enable-cache: true
# cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.python-version }}-v2-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ matrix.python-version }}-v2-
- name: Install python packages
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade coverage[toml] tox tox-gh-actions
- name: Install dependencies
run: uv pip install --system tox tox-gh-actions tox-uv

- name: Test with Tox
run: tox --verbose --parallel auto
run: tox --parallel auto
env:
DJANGO: ${{ matrix.django-version }}

Expand All @@ -63,42 +51,23 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

ruff:
name: "Run ruff: ${{ matrix.toxenv }}"
name: Run ruff
runs-on: ubuntu-latest

strategy:
matrix:
toxenv:
- ruff

steps:
- name: Git clone
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv and set Python version
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"

- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Pip cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.python-version }}-v2-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ matrix.python-version }}-v2-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
run: uv pip install --system ruff tox tox-gh-actions tox-uv

- name: Run ${{ matrix.toxenv }}
run: python -m tox -e ${{ matrix.toxenv }}
- name: Run ruff
run: tox -e ruff

slack:
# https://github.com/8398a7/action-slack/issues/72#issuecomment-649910353
Expand Down

0 comments on commit e01f0ce

Please sign in to comment.