Skip to content
Snippets Groups Projects
Commit 10270e4e authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts.ci] Fix nightly checks

parent b54ffbe0
No related branches found
No related tags found
No related merge requests found
Pipeline #53049 passed
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
"""Tools to help CI-based builds and artifact deployment.""" """Tools to help CI-based builds and artifact deployment."""
import contextlib
import distutils.version import distutils.version
import os
import git import git
...@@ -295,3 +297,26 @@ def cleanup(dry_run, username, password, includes): ...@@ -295,3 +297,26 @@ def cleanup(dry_run, username, password, includes):
pyver=True, pyver=True,
includes=includes, includes=includes,
) )
@contextlib.contextmanager
def temporary_cwd(path):
"""Temporarily changes the working directory to a given path
A context manager that temporarily changes the path to the given directory.
The working directory changes the working directory back to the starting
directory when it exits.
Args:
path: The directory to temporarily change to
"""
oldpwd = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(oldpwd)
...@@ -6,7 +6,8 @@ variables: ...@@ -6,7 +6,8 @@ variables:
PYTHONUNBUFFERED: "1" PYTHONUNBUFFERED: "1"
CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda" CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda"
BOOTSTRAP: "https://gitlab.idiap.ch/bob/bob.devtools/raw/master/bob/devtools/bootstrap.py" BOOTSTRAP: "https://gitlab.idiap.ch/bob/bob.devtools/raw/master/bob/devtools/bootstrap.py"
TORCH_HOME: "${CI_PROJECT_DIR}/torch" TORCH_HOME: "${CI_PROJECT_DIR}/.cache/torch"
PRE_COMMIT_HOME: "${CI_PROJECT_DIR}/.cache/pre-commit"
# Definition of our build pipeline order # Definition of our build pipeline order
...@@ -26,7 +27,9 @@ stages: ...@@ -26,7 +27,9 @@ stages:
- conda activate base - conda activate base
cache: cache:
paths: paths:
- torch - miniconda.sh
- ${TORCH_HOME}
- ${PRE_COMMIT_HOME}
# Build targets # Build targets
......
...@@ -19,6 +19,7 @@ from ..ci import ( ...@@ -19,6 +19,7 @@ from ..ci import (
select_conda_build_config, select_conda_build_config,
select_conda_recipe_append, select_conda_recipe_append,
select_user_condarc, select_user_condarc,
temporary_cwd,
) )
from ..constants import BASE_CONDARC, SERVER from ..constants import BASE_CONDARC, SERVER
from ..deploy import deploy_conda_package, deploy_documentation from ..deploy import deploy_conda_package, deploy_documentation
...@@ -730,8 +731,9 @@ def nightlies(ctx, order, dry_run): ...@@ -730,8 +731,9 @@ def nightlies(ctx, order, dry_run):
) )
logger.info("Conda build recipe-append file: %s", append_file) logger.info("Conda build recipe-append file: %s", append_file)
logger.info("Running checks") logger.info("Running checks...")
ctx.invoke(check, root=clone_to) with temporary_cwd(clone_to):
ctx.invoke(check)
logger.info("Building") logger.info("Building")
ctx.invoke( ctx.invoke(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment