Add new pipeline to build a master branch
This commit is contained in:
parent
ac3e35d965
commit
770f6726bc
3 changed files with 71 additions and 4 deletions
|
@ -119,7 +119,7 @@ To spawn a new windows agent:
|
|||
Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_bootstrap.ps1' -OutFile windows_agent_bootstrap.ps1
|
||||
./windows_agent_bootstrap.ps1
|
||||
```
|
||||
Ignore the pop-up to format the new disk andw wait for the machine to reboot.
|
||||
Ignore the pop-up to format the new disk and wait for the machine to reboot.
|
||||
|
||||
### Buildkite
|
||||
|
||||
|
@ -131,6 +131,7 @@ To spawn a new windows agent:
|
|||
```
|
||||
1. Run
|
||||
```powershell
|
||||
git clone https://github.com/google/llvm-premerge-checks.git C:\llvm-premerge-checks
|
||||
C:\llvm-premerge-checks\scripts\windows_agent_start_buildkite.ps1 [-workdir D:/] [-testing] [-version latest]
|
||||
```
|
||||
|
||||
|
|
65
scripts/buildkite/build_master_pipeline.py
Executable file
65
scripts/buildkite/build_master_pipeline.py
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://llvm.org/LICENSE.txt
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import yaml
|
||||
|
||||
if __name__ == '__main__':
|
||||
script_branch = os.getenv("scripts_branch", "master")
|
||||
queue = os.getenv("BUILDKITE_AGENT_META_DATA_QUEUE", "default")
|
||||
diff_id = os.getenv("ph_buildable_diff", "")
|
||||
steps = []
|
||||
linux_buld_step = {
|
||||
'label': ':linux: build and test linux',
|
||||
'key': 'linux',
|
||||
'commands': [
|
||||
'export SRC=${BUILDKITE_BUILD_PATH}/llvm-premerge-checks',
|
||||
'rm -rf ${SRC}',
|
||||
'git clone --depth 1 --branch ${scripts_branch} https://github.com/google/llvm-premerge-checks.git ${SRC}',
|
||||
# Add link in review to the build.
|
||||
'${SRC}/scripts/phabtalk/add_url_artifact.py '
|
||||
'--phid="$ph_target_phid" '
|
||||
'--url="$BUILDKITE_BUILD_URL" '
|
||||
'--name="Buildkite build"',
|
||||
'${SRC}/scripts/premerge_checks.py --check-clang-format --check-clang-tidy --projects=default',
|
||||
],
|
||||
'artifact_paths': ['artifacts/**/*', '*_result.json'],
|
||||
'agents': {'queue': queue, 'os': 'linux'}
|
||||
}
|
||||
windows_buld_step = {
|
||||
'label': ':windows: build and test windows',
|
||||
'key': 'windows',
|
||||
'commands': [
|
||||
'sccache --show-stats',
|
||||
'set SRC=%BUILDKITE_BUILD_PATH%/llvm-premerge-checks',
|
||||
'rm -rf %SRC%',
|
||||
'git clone --depth 1 --branch %scripts_branch% https://github.com/google/llvm-premerge-checks.git %SRC%',
|
||||
'powershell -command "%SRC%/scripts/premerge_checks.py --projects=default; '
|
||||
'\\$exit=\\$?;'
|
||||
'sccache --show-stats;'
|
||||
'if (\\$exit) {'
|
||||
' echo "success";'
|
||||
' exit 0; } '
|
||||
'else {'
|
||||
' echo "failure";'
|
||||
' exit 1;'
|
||||
'}',
|
||||
],
|
||||
'artifact_paths': ['artifacts/**/*', '*_result.json'],
|
||||
'agents': {'queue': queue, 'os': 'windows'},
|
||||
}
|
||||
steps.append(linux_buld_step)
|
||||
steps.append(windows_buld_step)
|
||||
print(yaml.dump({'steps': steps}))
|
|
@ -67,9 +67,9 @@ def run_step(name: str, report: Report, thunk: Callable[[Step, Report], None]) -
|
|||
return step
|
||||
|
||||
|
||||
def cmake_report(step: Step, _: Report):
|
||||
def cmake_report(projects: str, step: Step, _: Report):
|
||||
global build_dir
|
||||
cmake_result, build_dir, cmake_artifacts = run_cmake.run('detect', os.getcwd())
|
||||
cmake_result, build_dir, cmake_artifacts = run_cmake.run(projects, os.getcwd())
|
||||
for file in cmake_artifacts:
|
||||
if os.path.exists(file):
|
||||
shutil.copy2(file, artifacts_dir)
|
||||
|
@ -88,6 +88,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('--log-level', type=str, default='WARNING')
|
||||
parser.add_argument('--check-clang-format', action='store_true')
|
||||
parser.add_argument('--check-clang-tidy', action='store_true')
|
||||
parser.add_argument('--projects', type=str, default='detect', choices=['detect', 'default'])
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(level=args.log_level, format='%(levelname)-7s %(message)s')
|
||||
build_dir = ''
|
||||
|
@ -104,7 +105,7 @@ if __name__ == '__main__':
|
|||
with open(report_path, 'w') as f:
|
||||
json.dump(report.__dict__, f, default=as_dict)
|
||||
report.success = True
|
||||
cmake = run_step('cmake', report, cmake_report)
|
||||
cmake = run_step('cmake', report, lambda s, r: cmake_report(args.projects, s, r))
|
||||
if cmake.success:
|
||||
ninja_all = run_step('ninja all', report, ninja_all_report)
|
||||
if ninja_all.success:
|
||||
|
|
Loading…
Reference in a new issue