Mikhail Goncharov | 1c63b14 | 2020-10-09 12:23:48 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | #===----------------------------------------------------------------------===## |
| 3 | # |
| 4 | # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | # See https://llvm.org/LICENSE.txt for license information. |
| 6 | # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | # |
| 8 | #===----------------------------------------------------------------------===## |
| 9 | |
| 10 | # |
| 11 | # This file generates a Buildkite pipeline that triggers the libc++ CI |
| 12 | # job(s) if needed. |
| 13 | # See https://buildkite.com/docs/agent/v3/cli-pipeline#pipeline-format. |
| 14 | # |
| 15 | # Invoked by CI on pre-merge check for a commit. |
| 16 | # |
| 17 | |
| 18 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
| 19 | |
| 20 | if ! git diff --name-only HEAD~1 | grep -q -E "libcxx/|libcxxabi/"; then |
| 21 | # libcxx is not affected |
| 22 | exit 0 |
| 23 | fi |
| 24 | |
| 25 | reviewID="$(git log --format=%B -n 1 | sed -nE 's/^Review-ID:[[:space:]]*(.+)$/\1/p')" |
| 26 | if [[ "${reviewID}" != "" ]]; then |
| 27 | buildMessage="https://llvm.org/${reviewID}" |
| 28 | else |
| 29 | buildMessage="Push to branch ${BUILDKITE_BRANCH}" |
| 30 | fi |
| 31 | |
| 32 | |
| 33 | cat <<EOF |
| 34 | steps: |
| 35 | - trigger: "libcxx-ci" |
| 36 | build: |
| 37 | message: "${buildMessage}" |
| 38 | commit: "${BUILDKITE_COMMIT}" |
| 39 | branch: "${BUILDKITE_BRANCH}" |
| 40 | EOF |
| 41 | |
| 42 | |