Skip to content

Commit

Permalink
Run tests against the main branch of Ruff (#286)
Browse files Browse the repository at this point in the history
Adds tests against ruff@main, installed from source.

Since this depends on us opening a pull request here to notice breakage
with ruff, I'm also adding astral-sh/ruff#8016
which runs tests on each change to ruff.
  • Loading branch information
zanieb authored Oct 23, 2023
1 parent 88c7379 commit b2c8574
Showing 1 changed file with 36 additions and 14 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

env:
RUFF_UNRELEASED_REF: 'main'

on:
push:
branches: [main]
Expand Down Expand Up @@ -45,29 +48,33 @@ jobs:
)
# Get the oldest supported version from the pyproject.toml
OLDEST=$(rg -No '"ruff>=(.*)"' -r '$1' pyproject.toml)
UNRELEASED=${{ env.RUFF_UNRELEASED_REF }}
echo "::set-output name=versions::[\"$OLDEST\", \"$LATEST\"]"
echo "::set-output name=oldest::$OLDEST
echo "::set-output name=latest::$LATEST
echo "::set-output name=latest::$LATEST"
echo "::set-output name=oldest::$OLDEST"
echo "::set-output name=dev::$UNRELEASED"
outputs:
versions: ${{ steps.set-versions.outputs.versions }}
oldest: ${{ steps.set-versions.outputs.oldest }}
latest: ${{ steps.set-versions.outputs.latest }}
oldest: ${{ steps.set-versions.outputs.oldest }}
dev: ${{ steps.set-versions.outputs.dev }}

test:
name: Test (python-${{ matrix.python-version }}, ruff-${{ matrix.ruff-version }}, ${{ matrix.os }})
needs: ruff-versions
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
ruff-version: ${{ fromJson(needs.ruff-versions.outputs.versions) }}
os: [ubuntu-latest, macos-latest, windows-latest]

exclude:
- os: windows-latest
ruff-version: ${{ needs.ruff-versions.outputs.oldest }}
- os: macos-latest
ruff-version: ${{ needs.ruff-versions.outputs.oldest }}
include:
- ruff-version: ${{ needs.ruff-versions.outputs.latest }}
- ruff-version: ${{ needs.ruff-versions.outputs.oldest }}
os: ubuntu-latest
python-version: "3.7"
- ruff-version: ${{ needs.ruff-versions.outputs.dev }}
os: ubuntu-latest
python-version: "3.12"

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -79,9 +86,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: just install
- name: Install test Ruff version
run: pip install ruff==${{ matrix.ruff-version }}
run: |
pip install -U pip
just install
- name: Install test Ruff version from PyPI
if: ${{ matrix.ruff-version != env.RUFF_UNRELEASED_REF }}
run: |
pip install ruff==${{ matrix.ruff-version }}
ruff --version
- name: "Install test Ruff version from GitHub"
if: ${{ matrix.ruff-version == env.RUFF_UNRELEASED_REF }}
run: |
pip install --force-reinstall git+https://github.com/astral-sh/ruff@${{ matrix.ruff-version }}
pip show ruff
ruff version
- name: Run tests
run: just test

0 comments on commit b2c8574

Please sign in to comment.