Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodetect CI python #466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ jobs:
- name: Install dependencies
run: python -m pip install --upgrade nox pdm
- name: Run unit tests
run: nox -vs unit -p ${{ matrix.python-version }} -- -v
run: nox -vs unit -- -v
- name: Run integration tests
if: ${{ env.B2_TEST_APPLICATION_KEY != '' && env.B2_TEST_APPLICATION_KEY_ID != '' }}
run: nox -vs integration -p ${{ matrix.python-version }} -- --dont-cleanup-old-buckets -v
run: nox -vs integration -- --dont-cleanup-old-buckets -v
doc:
needs: build
runs-on: ubuntu-latest
Expand Down
19 changes: 15 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import os
import pathlib
import platform
import re
import subprocess

Expand All @@ -22,6 +23,12 @@
CI = os.environ.get('CI') is not None
NOX_PYTHONS = os.environ.get('NOX_PYTHONS')

if CI and not NOX_PYTHONS:
NOX_PYTHONS = ""
print(
f"CI job mode; using provided interpreter only; equivalent to NOX_PYTHONS={NOX_PYTHONS!r}"
)

PYTHON_VERSIONS = [
'pypy3.9',
'pypy3.10',
Expand All @@ -31,9 +38,13 @@
'3.10',
'3.11',
'3.12',
] if NOX_PYTHONS is None else NOX_PYTHONS.split(',')
]
if NOX_PYTHONS:
PYTHON_VERSIONS = NOX_PYTHONS.split(',')
elif NOX_PYTHONS == "":
PYTHON_VERSIONS = None

PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1]
PYTHON_DEFAULT_VERSION = PYTHON_VERSIONS[-1] if PYTHON_VERSIONS else None

PY_PATHS = ['b2sdk', 'test', 'noxfile.py']

Expand All @@ -53,8 +64,8 @@ def pdm_install(session: nox.Session, *args: str, dev: bool = True) -> None:
session.run('pdm', 'install', *prod_args, *group_args, external=True)


def skip_coverage(python_version: str) -> bool:
return python_version.startswith('pypy')
def skip_coverage(python_version: str | None) -> bool:
return (python_version or platform.python_implementation()).lower().startswith('pypy')


@nox.session(name='format', python=PYTHON_DEFAULT_VERSION)
Expand Down
Loading