Skip to content

Commit

Permalink
Merge pull request #466 from reef-technologies/auto_detect_ci_python
Browse files Browse the repository at this point in the history
autodetect CI python
  • Loading branch information
mjurbanski-reef committed Jan 30, 2024
2 parents 592dcc1 + fa9ef8d commit 68b5c37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
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

0 comments on commit 68b5c37

Please sign in to comment.