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 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 from sync_fork import sync_fork
import git import git
import yaml import yaml
@ -50,7 +50,7 @@ if __name__ == '__main__':
# two placess). # two placess).
steps.extend(generic_windows( steps.extend(generic_windows(
os.getenv('ph_projects', 'llvm;clang;clang-tools-extra;libc;libcxx;libcxxabi;lld;libunwind;mlir;polly;flang'))) 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: if os.getenv('ph_skip_generated') is None:
e = os.environ.copy() e = os.environ.copy()
# BUILDKITE_COMMIT might be an alias, e.g. "HEAD". Resolve it to make the build hermetic. # 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] 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: if os.getenv('ph_skip_bazel') is not None:
logging.info('bazel build is skipped as "ph_skip_bazel" is set') logging.info('bazel build is skipped as "ph_skip_bazel" is set')
return [] return []
updated_build = any(s.startswith('utils/bazel/') for s in modified_files) updated_build = any(s.startswith('utils/bazel/') for s in modified_files)
if updated_build: if not force:
logging.info('files in utils/bazel/ modified, will trigger bazel build') if updated_build:
else: logging.info('files in utils/bazel/ modified, will trigger bazel build')
user_projects = os.getenv('ph_user_project_slugs', '').split(',') else:
if 'bazel_build' not in user_projects: user_projects = os.getenv('ph_user_project_slugs', '').split(',')
logging.info('bazel build is skipped as "bazel_build" is not listed in user projects and no files in ' if 'bazel_build' not in user_projects:
'utils/bazel/ are modified') logging.info('bazel build is skipped as "bazel_build" is not listed in user projects and no files in '
return [] 'utils/bazel/ are modified')
return []
agents = {'queue': 'llvm-bazel-premerge'} agents = {'queue': 'llvm-bazel-premerge'}
t = os.getenv('ph_bazel_agents') t = os.getenv('ph_bazel_agents')
if t is not None: if t is not None:
agents = json.loads(t) agents = json.loads(t)
return [{ return [{
'label': ':bazel: bazel', 'label': ':bazel: bazel',
'key': 'bazel', 'key': 'bazel',