diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 37fdec4e..02f6d262 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,9 +23,9 @@ jobs: path: ~/.cache/pypoetry/virtualenvs key: ${{ runner.os }}-poetry-tests-${{ hashFiles('poetry.lock') }} - name: Install project - run: poetry install --no-interaction --sync --with=test - - name: Run tests - run: poetry run pytest + run: poetry install --no-interaction --sync --with=nox,test + - name: Run tests on Python ${{ matrix.python-version }} + run: poetry run nox --no-venv --no-install --non-interactive -s tests lint: strategy: @@ -47,11 +47,9 @@ jobs: path: ~/.cache/pypoetry/virtualenvs key: ${{ runner.os }}-poetry-lint-${{ hashFiles('poetry.lock') }} - name: Install project - run: poetry install --no-interaction --sync --with=lint - - name: Run type-checking - run: poetry run mypy fawltydeps tests - - name: Run linter - run: poetry run pylint fawltydeps tests + run: poetry install --no-interaction --sync --no-root --only=nox,lint + - name: Run linters on Python ${{ matrix.python-version }} + run: poetry run nox --no-venv --no-install --non-interactive -s lint format: strategy: @@ -73,11 +71,9 @@ jobs: path: ~/.cache/pypoetry/virtualenvs key: ${{ runner.os }}-poetry-format-${{ hashFiles('poetry.lock') }} - name: Install project - run: poetry install --no-interaction --sync --with=format - - name: Check formatting with Black - run: poetry run black . --check - - name: Run import sort checker - run: poetry run isort fawltydeps tests --check-only + run: poetry install --no-interaction --sync --no-root --only=nox,format + - name: Run formatting checks + run: poetry run nox --no-venv --no-install --non-interactive -s format # Inspiration for the CI setup: # https://github.com/marketplace/actions/python-poetry-action diff --git a/noxfile.py b/noxfile.py index ac3455d7..51c7bbd6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -28,6 +28,14 @@ def install_groups( Auto-skip the `poetry export` step if the poetry.lock file is unchanged since the last time this session was run. """ + if isinstance(session.virtualenv, nox.virtualenv.PassthroughEnv): + session.warn( + "Running outside a Nox virtualenv! We will skip installation here, " + "and simply assume that the necessary dependency groups have " + "already been installed by other means!" + ) + return + lockdata = Path("poetry.lock").read_bytes() digest = hashlib.blake2b(lockdata).hexdigest() requirements_txt = Path(session.cache_dir, session.name, "reqs_from_poetry.txt")