1
0
Fork 0

Run bazel build on mainline

This commit is contained in:
Mikhail Goncharov 2021-09-03 15:15:11 +02:00
parent 307a6e71ee
commit 3329564f50
2 changed files with 13 additions and 11 deletions

View file

@ -17,7 +17,7 @@
import os
from steps import generic_linux, generic_windows, from_shell_output, extend_steps_env
from steps import generic_linux, generic_windows, from_shell_output, extend_steps_env, bazel
from sync_fork import sync_fork
import git
import yaml
@ -50,7 +50,7 @@ if __name__ == '__main__':
# two placess).
steps.extend(generic_windows(
os.getenv('ph_projects', 'llvm;clang;clang-tools-extra;libc;libcxx;libcxxabi;lld;libunwind;mlir;polly;flang')))
steps.extend(bazel([], force=True))
if os.getenv('ph_skip_generated') is None:
e = os.environ.copy()
# BUILDKITE_COMMIT might be an alias, e.g. "HEAD". Resolve it to make the build hermetic.

View file

@ -75,23 +75,25 @@ def generic_linux(projects: str, check_diff: bool) -> List:
return [linux_buld_step]
def bazel(modified_files: Set[str]) -> List:
def bazel(modified_files: Set[str], force: bool = False) -> List:
if os.getenv('ph_skip_bazel') is not None:
logging.info('bazel build is skipped as "ph_skip_bazel" is set')
return []
updated_build = any(s.startswith('utils/bazel/') for s in modified_files)
if updated_build:
logging.info('files in utils/bazel/ modified, will trigger bazel build')
else:
user_projects = os.getenv('ph_user_project_slugs', '').split(',')
if 'bazel_build' not in user_projects:
logging.info('bazel build is skipped as "bazel_build" is not listed in user projects and no files in '
'utils/bazel/ are modified')
return []
if not force:
if updated_build:
logging.info('files in utils/bazel/ modified, will trigger bazel build')
else:
user_projects = os.getenv('ph_user_project_slugs', '').split(',')
if 'bazel_build' not in user_projects:
logging.info('bazel build is skipped as "bazel_build" is not listed in user projects and no files in '
'utils/bazel/ are modified')
return []
agents = {'queue': 'llvm-bazel-premerge'}
t = os.getenv('ph_bazel_agents')
if t is not None:
agents = json.loads(t)
return [{
'label': ':bazel: bazel',
'key': 'bazel',