diff --git a/.buildkite/pipelines/experimental/launch_unsigned_builders.yml b/.buildkite/pipelines/experimental/launch_unsigned_builders.yml index f023e19a5c940..70347077dcbce 100644 --- a/.buildkite/pipelines/experimental/launch_unsigned_builders.yml +++ b/.buildkite/pipelines/experimental/launch_unsigned_builders.yml @@ -1,6 +1,10 @@ steps: - label: ":buildkite: Launch unsigned pipelines" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + + echo "--- Launch unsigned pipelines" buildkite-agent pipeline upload .buildkite/pipelines/experimental/misc/sanitizers.yml agents: queue: julia diff --git a/.buildkite/pipelines/experimental/misc/sanitizers.yml b/.buildkite/pipelines/experimental/misc/sanitizers.yml index 79af4905416fc..52e46490a2fd5 100644 --- a/.buildkite/pipelines/experimental/misc/sanitizers.yml +++ b/.buildkite/pipelines/experimental/misc/sanitizers.yml @@ -21,5 +21,8 @@ steps: version: 1.6 timeout_in_minutes: 120 commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Build julia-debug with ASAN" contrib/asan/build.sh ./tmp/test-asan -j$${JULIA_CPU_THREADS:?} debug diff --git a/.buildkite/pipelines/main/launch_unsigned_builders.yml b/.buildkite/pipelines/main/launch_unsigned_builders.yml index f978b0c48ed77..ffa44b95370a3 100644 --- a/.buildkite/pipelines/main/launch_unsigned_builders.yml +++ b/.buildkite/pipelines/main/launch_unsigned_builders.yml @@ -15,6 +15,11 @@ steps: - label: ":buildkite: Launch unsigned builders" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + + echo "--- Launch unsigned builders" + # Launch the `whitespace` builder first, because we want that builder to finish as quickly as possible. buildkite-agent pipeline upload .buildkite/pipelines/main/misc/whitespace.yml diff --git a/.buildkite/pipelines/main/misc/doctest.yml b/.buildkite/pipelines/main/misc/doctest.yml index e1af8d7cd839f..3471f45115544 100644 --- a/.buildkite/pipelines/main/misc/doctest.yml +++ b/.buildkite/pipelines/main/misc/doctest.yml @@ -18,6 +18,9 @@ steps: # Include `/cache/repos` so that our `git` version introspection works. - "/cache/repos:/cache/repos" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Build Julia from source" make -j 6 diff --git a/.buildkite/pipelines/main/misc/embedding.yml b/.buildkite/pipelines/main/misc/embedding.yml index dc5e80e85d065..575dda4132fef 100644 --- a/.buildkite/pipelines/main/misc/embedding.yml +++ b/.buildkite/pipelines/main/misc/embedding.yml @@ -18,12 +18,15 @@ steps: # Include `/cache/repos` so that our `git` version introspection works. - "/cache/repos:/cache/repos" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + prefix="/tmp/prefix" - echo "+++ Build julia, deploy to $${prefix:?}" + echo "--- Build julia, deploy to $${prefix:?}" make -j$${JULIA_CPU_THREADS:?} JULIA_PRECOMPILE=0 prefix=$${prefix:?} install embedding_output="/tmp/embedding-test" - echo "+++ Run embedding tests, deploy to $${embedding_output:?}" + echo "--- Run embedding tests, deploy to $${embedding_output:?}" mkdir -p "$${embedding_output:?}" make -j$${JULIA_CPU_THREADS:?} -C test/embedding JULIA="$${prefix:?}/bin/julia" BIN="$${embedding_output:?}" timeout_in_minutes: 60 diff --git a/.buildkite/pipelines/main/misc/llvmpasses.yml b/.buildkite/pipelines/main/misc/llvmpasses.yml index 921f39c5fb360..dd51d081d3334 100644 --- a/.buildkite/pipelines/main/misc/llvmpasses.yml +++ b/.buildkite/pipelines/main/misc/llvmpasses.yml @@ -16,6 +16,9 @@ steps: # Include `/cache/repos` so that our `git` version introspection works. - "/cache/repos:/cache/repos" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Install in-tree LLVM dependencies" make -j$${JULIA_CPU_THREADS:?} -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind echo "+++ run clangsa/analyzegc" @@ -35,6 +38,9 @@ steps: workspaces: - "/cache/repos:/cache/repos" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- make release" make -j$${JULIA_CPU_THREADS:?} release JULIA_PRECOMPILE=0 echo "--- make src/install-analysis-deps" diff --git a/.buildkite/pipelines/main/misc/whitespace.yml b/.buildkite/pipelines/main/misc/whitespace.yml index 89231b80cc48d..c0754e5e05611 100644 --- a/.buildkite/pipelines/main/misc/whitespace.yml +++ b/.buildkite/pipelines/main/misc/whitespace.yml @@ -19,4 +19,8 @@ steps: - github_commit_status: context: "whitespace" commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + + echo "--- Run the whitespace check" make -j$${JULIA_CPU_THREADS:?} check-whitespace diff --git a/.buildkite/pipelines/main/platforms/package_linux.yml b/.buildkite/pipelines/main/platforms/package_linux.yml index a054390bb2c0c..49292c0f305d8 100644 --- a/.buildkite/pipelines/main/platforms/package_linux.yml +++ b/.buildkite/pipelines/main/platforms/package_linux.yml @@ -21,14 +21,19 @@ steps: - "/cache/repos:/cache/repos" timeout_in_minutes: ${TIMEOUT?} commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Print the full and short commit hashes" SHORT_COMMIT_LENGTH=10 - SHORT_COMMIT=`echo $${BUILDKITE_COMMIT:?} | cut -c1-$${SHORT_COMMIT_LENGTH:?}` + CHECKED_OUT_COMMIT_FULL=`git rev-parse HEAD` + CHECKED_OUT_COMMIT_SHORT=`echo $${CHECKED_OUT_COMMIT_FULL:?} | cut -c1-$${SHORT_COMMIT_LENGTH:?}` JULIA_BINARYDIST_FILENAME=`make print-JULIA_BINARYDIST_FILENAME | cut -c27-` ARTIFACT_FILE_EXTENSION="tar.gz" ARTIFACT_FILENAME="$${JULIA_BINARYDIST_FILENAME:?}.$${ARTIFACT_FILE_EXTENSION:?}" - echo "The full commit is: $${BUILDKITE_COMMIT:?}" - echo "The short commit is: $${SHORT_COMMIT:?}" + echo "The original Buildkite commit is: $${BUILDKITE_COMMIT:?}" + echo "The full checked-out commit is: $${CHECKED_OUT_COMMIT_FULL:?}" + echo "The short checked-out commit is: $${CHECKED_OUT_COMMIT_SHORT:?}" echo "The artifact filename will be: $${ARTIFACT_FILENAME:?}" echo "--- Build Julia from source" diff --git a/.buildkite/pipelines/main/platforms/tester_linux.yml b/.buildkite/pipelines/main/platforms/tester_linux.yml index 3a71599ad6f0a..bfc87fd0e1696 100644 --- a/.buildkite/pipelines/main/platforms/tester_linux.yml +++ b/.buildkite/pipelines/main/platforms/tester_linux.yml @@ -24,16 +24,21 @@ steps: JULIA_SHELL: "/bin/bash" timeout_in_minutes: ${TIMEOUT?} commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Print the full and short commit hashes" SHORT_COMMIT_LENGTH=10 - SHORT_COMMIT=`echo $${BUILDKITE_COMMIT:?} | cut -c1-$${SHORT_COMMIT_LENGTH:?}` - JULIA_DIR="julia-$${SHORT_COMMIT:?}" + CHECKED_OUT_COMMIT_FULL=`git rev-parse HEAD` + CHECKED_OUT_COMMIT_SHORT=`echo $${CHECKED_OUT_COMMIT_FULL:?} | cut -c1-$${SHORT_COMMIT_LENGTH:?}` + JULIA_DIR="julia-$${CHECKED_OUT_COMMIT_SHORT:?}" JULIA_BINARY="$${JULIA_DIR:?}/bin/julia" ARTIFACT_FILE_EXTENSION="tar.gz" - ARTIFACT_FILENAME="julia-$${SHORT_COMMIT:?}-linux${ARCH?}.$${ARTIFACT_FILE_EXTENSION:?}" - echo "The full commit is: $${BUILDKITE_COMMIT:?}" - echo "The short commit is: $${SHORT_COMMIT:?}" - echo "The artifact filename will be: $${ARTIFACT_FILENAME:?}" + ARTIFACT_FILENAME="julia-$${CHECKED_OUT_COMMIT_SHORT:?}-linux${ARCH?}.$${ARTIFACT_FILE_EXTENSION:?}" + echo "The original Buildkite commit is: $${BUILDKITE_COMMIT:?}" + echo "The full checked-out commit is: $${CHECKED_OUT_COMMIT_FULL:?}" + echo "The short checked-out commit is: $${CHECKED_OUT_COMMIT_SHORT:?}" + echo "The artifact filename will be: $${ARTIFACT_FILENAME:?}" echo "The Julia directory name will be: $${JULIA_DIR:?}" echo "The Julia binary will be: $${JULIA_BINARY:?}" diff --git a/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml b/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml index f5d93264f7aac..efe4ddb1e8aaa 100644 --- a/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml +++ b/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml @@ -18,6 +18,9 @@ steps: uid: 1000 gid: 1000 commands: | + echo "--- Checkout the merge commit (if this is a pull request build)" + MCSH=.buildkite/utilities/merge_commit/merge_commit.sh && test -f $${MCSH:?} && bash $${MCSH:?} + echo "--- Build Julia from source" make -j 6 diff --git a/.buildkite/utilities/merge_commit/merge_commit.sh b/.buildkite/utilities/merge_commit/merge_commit.sh new file mode 100755 index 0000000000000..29a98475baf41 --- /dev/null +++ b/.buildkite/utilities/merge_commit/merge_commit.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -euo pipefail +if [[ "${BUILDKITE_PULL_REQUEST:?}" != "false" ]]; then + git log -n 1 + echo "" + echo "This is a pull request build." + echo "Pull request: ${BUILDKITE_PULL_REQUEST:?}" + echo "Fetching the pull request merge commit..." + sleep 0.01 # Make sure GitHub has enough time to create the merge commit. + git fetch origin +refs/pull/${BUILDKITE_PULL_REQUEST:?}/merge + echo "Checking out the pull request merge commit..." + git checkout --force FETCH_HEAD +else + echo "This is not a pull request build." +fi + +git log -n 1 +echo ""