Skip to content

Commit d841a80

Browse files
committed
Skip development environment check on GitHub Actions, improved logging
1 parent 89d8b56 commit d841a80

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/test-python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Run tests with Nox
3333
run: |
3434
pip install nox-poetry
35-
nox -- skip-gpu
35+
nox -- skip-gpu github-action
3636
# - name: Upload Coverage report to CodeCov
3737
# uses: codecov/codecov-action@v3
3838
# with:

noxfile.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def check_poetry(session: Session) -> None:
4343
@session # to only run on the current python interpreter
4444
def check_development_environment(session: Session) -> None:
4545
"""Check whether the development environment is up to date with the dependencies, and try to update if necessary."""
46+
if session.posargs:
47+
if 'github-action' in session.posargs:
48+
session.log("Skipping development environment check on the GitHub Actions runner, as this is always up to date.")
49+
return None
4650
output: str = session.run("poetry", "install", "--sync", "--dry-run", "--with", "test", silent=True, external=True)
4751
match = re.search(r"Package operations: (\d+) installs, (\d+) updates, (\d+) removals, \d+ skipped", output)
4852
assert match is not None
@@ -131,15 +135,15 @@ def tests(session: Session) -> None:
131135
try:
132136
session.install("pycuda") # Attention: if changed, check `pycuda` in pyproject.toml as well
133137
except Exception as error:
134-
print(error)
138+
session.log(error)
135139
session.warn(install_warning)
136140
if install_opencl and session.python == "3.8":
137141
# if we need to install the OpenCL extras, first install pyopencl seperately.
138142
# it has `oldest-supported-numpy` as a build dependency which doesn't work with Poetry, but only for Python<3.9
139143
try:
140144
session.install("pyopencl") # Attention: if changed, check `pyopencl` in pyproject.toml as well
141145
except Exception as error:
142-
print(error)
146+
session.log(error)
143147
session.warn(install_warning)
144148

145149
# finally, install the dependencies, optional dependencies and the package itself
@@ -158,7 +162,7 @@ def tests(session: Session) -> None:
158162
try:
159163
session.install("cuda-python")
160164
except Exception as error:
161-
print(error)
165+
session.log(error)
162166
session.warn(install_additional_warning)
163167
try:
164168
# use NVCC to get the CUDA version
@@ -181,7 +185,7 @@ def tests(session: Session) -> None:
181185
session.warn(f"No prebuilt CuPy found for CUDA {cuda_version}, building from source...")
182186
session.install("cupy")
183187
except Exception as error:
184-
print(error)
188+
session.log(error)
185189
session.warn(install_additional_warning)
186190

187191
# for the last Python version session if all optional dependencies are enabled:

0 commit comments

Comments
 (0)