diff --git a/.buildkite/pipelines/experimental/0_webui.yml b/.buildkite/pipelines/experimental/0_webui.yml index 54dbbc59d42562..eee9743d39f6aa 100644 --- a/.buildkite/pipelines/experimental/0_webui.yml +++ b/.buildkite/pipelines/experimental/0_webui.yml @@ -4,7 +4,6 @@ agents: queue: "julia" sandbox.jl: "true" - steps: - label: ":unlock: Unlock secrets, launch pipelines" plugins: @@ -16,9 +15,8 @@ steps: # pipelines. unsigned_pipelines: - .buildkite/pipelines/experimental/launch_unsigned_builders.yml - # Our signed pipelines must have a `signature` or `signature_file` parameter that # verifies the treehash of the pipeline itself and the inputs listed in `inputs` # signed_pipelines: # - pipeline: .buildkite/pipelines/experimental/misc/foo_bar_baz.yml - # signature: "my_signature" + # signature_file: .buildkite/pipelines/experimental/misc/foo_bar_baz.yml.signature diff --git a/.buildkite/pipelines/experimental/misc/sanitizers.yml b/.buildkite/pipelines/experimental/misc/sanitizers.yml index 72d252fc34578c..79af4905416fcc 100644 --- a/.buildkite/pipelines/experimental/misc/sanitizers.yml +++ b/.buildkite/pipelines/experimental/misc/sanitizers.yml @@ -3,10 +3,9 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: "asan" - key: asan + key: "asan" plugins: - JuliaCI/julia#v1: version: 1.6 @@ -17,13 +16,10 @@ steps: gid: 1000 workspaces: - "/cache/repos:/cache/repos" - # `contrib/check-asan.jl` needs a `julia` binary: + # `contrib/check-asan.jl` needs a `julia` binary inside the inner sandbox: - JuliaCI/julia#v1: version: 1.6 timeout_in_minutes: 120 - # notify: - # - github_commit_status: - # context: "asan" commands: | echo "--- Build julia-debug with ASAN" - contrib/asan/build.sh ./tmp/test-asan -j$${JULIA_NUM_CORES} debug + contrib/asan/build.sh ./tmp/test-asan -j$${JULIA_CPU_THREADS:?} debug diff --git a/.buildkite/pipelines/main/0_webui.yml b/.buildkite/pipelines/main/0_webui.yml index 8e7b9c58ea423b..af68158f9a51f0 100644 --- a/.buildkite/pipelines/main/0_webui.yml +++ b/.buildkite/pipelines/main/0_webui.yml @@ -4,7 +4,6 @@ agents: queue: "julia" sandbox.jl: "true" - steps: - label: ":unlock: Unlock secrets, launch pipelines" plugins: diff --git a/.buildkite/pipelines/main/launch_unsigned_builders.yml b/.buildkite/pipelines/main/launch_unsigned_builders.yml index 6e9f0f0d8fa23b..f978b0c48ed77d 100644 --- a/.buildkite/pipelines/main/launch_unsigned_builders.yml +++ b/.buildkite/pipelines/main/launch_unsigned_builders.yml @@ -15,15 +15,16 @@ steps: - label: ":buildkite: Launch unsigned builders" commands: | - # First, we launch the `whitespace` builder, because we want that builder to finish as quickly as possible. + # 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 - # Next, we launch the miscellaneous builders in alphabetical order. + # Launch the miscellaneous builders in alphabetical order. buildkite-agent pipeline upload .buildkite/pipelines/main/misc/doctest.yml buildkite-agent pipeline upload .buildkite/pipelines/main/misc/embedding.yml buildkite-agent pipeline upload .buildkite/pipelines/main/misc/llvmpasses.yml - # Finally, we launch the platform builders (`package_*`) and (`tester_*`) in alphabetical order. - buildkite-agent pipeline upload .buildkite/pipelines/main/platforms/linux64.yml + # Launch all of the platform builders. + bash .buildkite/pipelines/main/platforms/platforms.sh package_linux + bash .buildkite/pipelines/main/platforms/platforms.sh tester_linux agents: queue: julia diff --git a/.buildkite/pipelines/main/misc/doctest.yml b/.buildkite/pipelines/main/misc/doctest.yml index 0a5dc29bcb1c7b..e1af8d7cd839f4 100644 --- a/.buildkite/pipelines/main/misc/doctest.yml +++ b/.buildkite/pipelines/main/misc/doctest.yml @@ -3,7 +3,6 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: "doctest" key: doctest @@ -31,6 +30,3 @@ steps: echo "--- Run Julia doctests" JULIA_NUM_THREADS=1 make -C doc doctest=true timeout_in_minutes: 45 - notify: - - github_commit_status: - context: "doctest" diff --git a/.buildkite/pipelines/main/misc/embedding.yml b/.buildkite/pipelines/main/misc/embedding.yml index 087ca0f68eb3d6..dc5e80e85d0653 100644 --- a/.buildkite/pipelines/main/misc/embedding.yml +++ b/.buildkite/pipelines/main/misc/embedding.yml @@ -3,7 +3,6 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: "embedding" key: "embedding" @@ -20,15 +19,11 @@ steps: - "/cache/repos:/cache/repos" commands: | prefix="/tmp/prefix" - echo "+++ Build julia, deploy to $${prefix}" - make -j$${JULIA_NUM_CORES} JULIA_PRECOMPILE=0 prefix=$${prefix} install + 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}" - mkdir -p "$${embedding_output}" - make -j$${JULIA_NUM_CORES} -C test/embedding JULIA="$${prefix}/bin/julia" BIN="$${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 - notify: - - github_commit_status: - context: "embedding" diff --git a/.buildkite/pipelines/main/misc/llvmpasses.yml b/.buildkite/pipelines/main/misc/llvmpasses.yml index a012ace41acffa..921f39c5fb3601 100644 --- a/.buildkite/pipelines/main/misc/llvmpasses.yml +++ b/.buildkite/pipelines/main/misc/llvmpasses.yml @@ -3,7 +3,6 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: "analyzegc" key: "analyzegc" @@ -18,15 +17,11 @@ steps: - "/cache/repos:/cache/repos" commands: | echo "--- Install in-tree LLVM dependencies" - make -j$${JULIA_NUM_CORES} -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind + make -j$${JULIA_CPU_THREADS:?} -C deps install-llvm install-clang install-llvm-tools install-libuv install-utf8proc install-unwind echo "+++ run clangsa/analyzegc" - make -j$${JULIA_NUM_CORES} -C test/clangsa - make -j$${JULIA_NUM_CORES} -C src analyzegc + make -j$${JULIA_CPU_THREADS:?} -C test/clangsa + make -j$${JULIA_CPU_THREADS:?} -C src analyzegc timeout_in_minutes: 60 - notify: - - github_commit_status: - context: "analyzegc" - - label: "llvmpasses" key: "llvmpasses" plugins: @@ -41,12 +36,9 @@ steps: - "/cache/repos:/cache/repos" commands: | echo "--- make release" - make -j$${JULIA_NUM_CORES} release JULIA_PRECOMPILE=0 + make -j$${JULIA_CPU_THREADS:?} release JULIA_PRECOMPILE=0 echo "--- make src/install-analysis-deps" - make -j$${JULIA_NUM_CORES} -C src install-analysis-deps + make -j$${JULIA_CPU_THREADS:?} -C src install-analysis-deps echo "+++ make test/llvmpasses" - make -j$${JULIA_NUM_CORES} -C test/llvmpasses + make -j$${JULIA_CPU_THREADS:?} -C test/llvmpasses timeout_in_minutes: 60 - notify: - - github_commit_status: - context: "llvmpasses" diff --git a/.buildkite/pipelines/main/misc/whitespace.yml b/.buildkite/pipelines/main/misc/whitespace.yml index 3f9bf13421d8e0..89231b80cc48dd 100644 --- a/.buildkite/pipelines/main/misc/whitespace.yml +++ b/.buildkite/pipelines/main/misc/whitespace.yml @@ -3,7 +3,6 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: "whitespace" key: "whitespace" @@ -15,9 +14,9 @@ steps: rootfs_treehash: "8c33c341a864852629b8aac01a6eb6a79b73570e" workspaces: - "/cache/repos:/cache/repos" - commands: | - make -j$${JULIA_NUM_CORES} check-whitespace timeout_in_minutes: 10 notify: - github_commit_status: context: "whitespace" + commands: | + make -j$${JULIA_CPU_THREADS:?} check-whitespace diff --git a/.buildkite/pipelines/main/platforms/linux64.yml b/.buildkite/pipelines/main/platforms/linux64.yml deleted file mode 100644 index ad5d32a20b3a03..00000000000000 --- a/.buildkite/pipelines/main/platforms/linux64.yml +++ /dev/null @@ -1,95 +0,0 @@ -agents: - queue: "julia" - # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing - sandbox.jl: "true" - os: "linux" - -steps: - - label: "package_linux64" - key: package_linux64 - plugins: - - JuliaCI/julia#v1: - # Drop default "registries" directory, so it is not persisted from execution to execution - persist_depot_dirs: packages,artifacts,compiled - version: 1.6 - - staticfloat/sandbox#v1: - rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v3.1/package_linux.x86_64.tar.gz - rootfs_treehash: "8c33c341a864852629b8aac01a6eb6a79b73570e" - uid: 1000 - gid: 1000 - workspaces: - # Include `/cache/repos` so that our `git` version introspection works. - - "/cache/repos:/cache/repos" - commands: | - echo "--- Print the short and long commit hashes" - SHORT_COMMIT_LENGTH=10 - SHORT_COMMIT=`echo $$BUILDKITE_COMMIT | cut -c1-$$SHORT_COMMIT_LENGTH` - JULIA_DIRECTORY_NAME="julia-$$SHORT_COMMIT" - 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 Julia directory name will be $$JULIA_DIRECTORY_NAME" - echo "The artifact filename will be $$ARTIFACT_FILENAME" - - echo "--- Build Julia from source" - make -j 6 - make release - make install - - echo "--- Make sure that the working directory is clean" - if [ -z "$(git status --short)" ]; then echo "INFO: The working directory is clean."; else echo "ERROR: The working directory is dirty."; echo "Output of git status:"; git status; exit 1; fi - - echo "--- Print Julia version info" - ./julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' - - echo "--- Compress build artifacts" - ls -ld $$JULIA_DIRECTORY_NAME/ - rm -rf $$ARTIFACT_FILENAME - tar czf $$ARTIFACT_FILENAME $$JULIA_DIRECTORY_NAME/ - ls -l $$ARTIFACT_FILENAME - - echo "--- Upload build artifacts" - buildkite-agent artifact upload $$ARTIFACT_FILENAME - timeout_in_minutes: 60 - notify: - - github_commit_status: - context: "package_linux64" - - # TODO: uncomment the following lines in order to enable the `tester_linux64` builder - # - label: "tester_linux64" - # key: tester_linux64 - # depends_on: package_linux64 - # plugins: - # - JuliaCI/julia#v1: - # version: 1.6 - # - staticfloat/sandbox#v1: - # # TODO: use a separate `tester_linux` image, instead of using the `package_linux` image. - # rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/v3.1/package_linux.x86_64.tar.gz - # rootfs_treehash: "8c33c341a864852629b8aac01a6eb6a79b73570e" - # uid: 1000 - # gid: 1000 - # workspaces: - # # Include `/cache/repos` so that our `git` version introspection works. - # - "/cache/repos:/cache/repos" - # env: - # JULIA_SHELL: "/bin/bash" - # commands: | - # echo "--- Download build artifacts" - # rm -rf julia-linux64.tar.gz - # buildkite-agent artifact download julia-linux64.tar.gz . - # - # echo "--- Extract build artifacts" - # rm -rf julia-artifact/ - # tar xzf julia-linux64.tar.gz julia-artifact/ - # - # echo "--- Print Julia version info" - # julia-artifact/bin/julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' - # - # echo "--- Run the Julia test suite" - # unset JULIA_DEPOT_PATH - # julia-artifact/bin/julia .buildkite/utilities/rr/rr_capture.jl julia-artifact/bin/julia -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)' - # timeout_in_minutes: 120 - # notify: - # - github_commit_status: - # context: "tester_linux64" diff --git a/.buildkite/pipelines/main/platforms/package_linux.arches b/.buildkite/pipelines/main/platforms/package_linux.arches new file mode 100644 index 00000000000000..d83bd798242acc --- /dev/null +++ b/.buildkite/pipelines/main/platforms/package_linux.arches @@ -0,0 +1,6 @@ +# ARCH ARCH_LABEL ROOTFS_ARCH TIMEOUT ROOTFS_TAG ROOTFS_TREE +# aarch64 aarch64 aarch64 60 v3.2 0566841e29f0f9880541c26a6595fd5ce0beb5ff +# armv7l armv7l armv7l 60 v3.2 fb359370b052a47ce5c84cc6b4a7a03ed7053b25 +32 32 i686 60 v3.2 209c4db679a515befd7fb50ecc6bfbecf7ec3d32 +# ppc64le ppc64le powerpc64le 60 v3.2 c03a0158b19d48ac84b426834fce0d3584cdd0c7 +64 64 x86_64 60 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7 diff --git a/.buildkite/pipelines/main/platforms/package_linux.yml b/.buildkite/pipelines/main/platforms/package_linux.yml new file mode 100644 index 00000000000000..a054390bb2c0cc --- /dev/null +++ b/.buildkite/pipelines/main/platforms/package_linux.yml @@ -0,0 +1,49 @@ +agents: + queue: "julia" + # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing + sandbox.jl: "true" + os: "linux" +steps: + - label: "package_linux${ARCH_LABEL?}" + key: package_linux${ARCH_LABEL?} + plugins: + - JuliaCI/julia#v1: + # Drop default "registries" directory, so it is not persisted from execution to execution + persist_depot_dirs: packages,artifacts,compiled + version: 1.6 + - staticfloat/sandbox#v1: + rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/${ROOTFS_TAG?}/package_linux.${ROOTFS_ARCH?}.tar.gz + rootfs_treehash: "${ROOTFS_TREE?}" + uid: 1000 + gid: 1000 + workspaces: + # Include `/cache/repos` so that our `git` version introspection works. + - "/cache/repos:/cache/repos" + timeout_in_minutes: ${TIMEOUT?} + commands: | + echo "--- Print the full and short commit hashes" + SHORT_COMMIT_LENGTH=10 + SHORT_COMMIT=`echo $${BUILDKITE_COMMIT:?} | 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 artifact filename will be: $${ARTIFACT_FILENAME:?}" + + echo "--- Build Julia from source" + rm -rf $${ARTIFACT_FILENAME:?} + make -j 8 + + echo "--- Make sure that the working directory is clean" + if [ -z "$(git status --short)" ]; then echo "INFO: The working directory is clean."; else echo "ERROR: The working directory is dirty."; echo "Output of git status:"; git status; exit 1; fi + + echo "--- Print Julia version info" + ./julia -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' + + echo "--- Create build artifacts" + make -j 8 binary-dist + ls -l $${ARTIFACT_FILENAME:?} + + echo "--- Upload build artifacts" + buildkite-agent artifact upload $${ARTIFACT_FILENAME:?} diff --git a/.buildkite/pipelines/main/platforms/platforms.sh b/.buildkite/pipelines/main/platforms/platforms.sh new file mode 100755 index 00000000000000..d58daeb2a9929c --- /dev/null +++ b/.buildkite/pipelines/main/platforms/platforms.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +PLATFORM="$1" + +cat "$SCRIPT_DIR/$PLATFORM.arches" | tr -s ' ' | while read _line; do + # Remove whitespace from the beginning and end of each line + line=`echo $_line | tr -s ' '` + + # Skip all lines that begin with `#` + if [[ $line == \#* ]]; then + continue + fi + + export ARCH=`echo $line | cut -d ' ' -f 1` + export ARCH_LABEL=`echo $line | cut -d ' ' -f 2` + export ROOTFS_ARCH=`echo $line | cut -d ' ' -f 3` + export TIMEOUT=`echo $line | cut -d ' ' -f 4` + export ROOTFS_TAG=`echo $line | cut -d ' ' -f 5` + export ROOTFS_TREE=`echo $line | cut -d ' ' -f 6` + echo "Launching: $PLATFORM $ARCH $ARCH_LABEL $ROOTFS_ARCH $TIMEOUT" + buildkite-agent pipeline upload "$SCRIPT_DIR/$PLATFORM.yml" +done diff --git a/.buildkite/pipelines/main/platforms/tester_linux.arches b/.buildkite/pipelines/main/platforms/tester_linux.arches new file mode 100644 index 00000000000000..7d8e8ba607533c --- /dev/null +++ b/.buildkite/pipelines/main/platforms/tester_linux.arches @@ -0,0 +1,8 @@ +# ARCH ARCH_LABEL ROOTFS_ARCH TIMEOUT ROOTFS_TAG ROOTFS_TREE +# aarch64 aarch64 aarch64 60 v3.2 0566841e29f0f9880541c26a6595fd5ce0beb5ff +# armv7l armv7l armv7l 60 v3.2 fb359370b052a47ce5c84cc6b4a7a03ed7053b25 +32 32 i686 60 v3.2 209c4db679a515befd7fb50ecc6bfbecf7ec3d32 +# ppc64le ppc64le powerpc64le 60 v3.2 c03a0158b19d48ac84b426834fce0d3584cdd0c7 +64 64_rr x86_64 180 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7 +64 64_st x86_64 60 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7 +64 64_mt x86_64 60 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7 diff --git a/.buildkite/pipelines/main/platforms/tester_linux.yml b/.buildkite/pipelines/main/platforms/tester_linux.yml new file mode 100644 index 00000000000000..3a71599ad6f0aa --- /dev/null +++ b/.buildkite/pipelines/main/platforms/tester_linux.yml @@ -0,0 +1,72 @@ +agents: + queue: "julia" + # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing + sandbox.jl: "true" + os: "linux" +steps: + - label: "tester_linux${ARCH_LABEL?}" + key: tester_linux${ARCH_LABEL?} + depends_on: package_linux${ARCH?} + plugins: + - JuliaCI/julia#v1: + # Drop default "registries" directory, so it is not persisted from execution to execution + persist_depot_dirs: packages,artifacts,compiled + version: 1.6 + - staticfloat/sandbox#v1: + rootfs_url: https://github.com/JuliaCI/rootfs-images/releases/download/${ROOTFS_TAG?}/package_linux.${ROOTFS_ARCH?}.tar.gz + rootfs_treehash: "${ROOTFS_TREE?}" + uid: 1000 + gid: 1000 + workspaces: + # Include `/cache/repos` so that our `git` version introspection works. + - "/cache/repos:/cache/repos" + env: + JULIA_SHELL: "/bin/bash" + timeout_in_minutes: ${TIMEOUT?} + commands: | + 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:?}" + 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:?}" + echo "The Julia directory name will be: $${JULIA_DIR:?}" + echo "The Julia binary will be: $${JULIA_BINARY:?}" + + echo "--- Download build artifacts" + rm -rf $${ARTIFACT_FILENAME:?} + buildkite-agent artifact download $${ARTIFACT_FILENAME:?} . + + echo "--- Extract build artifacts" + rm -rf $${JULIA_DIR:?}/ + tar xzf $${ARTIFACT_FILENAME:?} $${JULIA_DIR:?}/ + + echo "--- Print Julia version info" + $${JULIA_BINARY:?} -e 'using InteractiveUtils; InteractiveUtils.versioninfo()' + echo "JULIA_CPU_THREADS is: $${JULIA_CPU_THREADS:?}" + $${JULIA_BINARY:?} -e '@info "" Sys.CPU_THREADS' + + echo "--- Run the Julia test suite" + unset JULIA_DEPOT_PATH + export JULIA_UNDER_RR="$${JULIA_BINARY:?} .buildkite/utilities/rr/rr_capture.jl $${JULIA_BINARY:?}" + + if [[ "$${BUILDKITE_STEP_KEY:?}" == "tester_linux64_rr" ]]; then + # For the `rr` job, we disable multi-threading. + export JULIA_NUM_THREADS=1 + $${JULIA_UNDER_RR:?} -e 'Base.runtests(["all"]; ncores = parse(Int, ENV["JULIA_RRCAPTURE_NUM_CORES"]))' + elif [[ "$${BUILDKITE_STEP_KEY:?}" == "tester_linux64_st" ]]; then + # "_st" = single-threaded + export JULIA_NUM_THREADS=1 + $${JULIA_BINARY:?} -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)' + elif [[ "$${BUILDKITE_STEP_KEY:?}" == "tester_linux64_mt" ]]; then + # "_mt" = multi-threaded + export JULIA_NUM_THREADS=16 + # TODO: don't skip any tests + $${JULIA_BINARY:?} -e 'Base.runtests(["all", "--skip", "Distributed"]; ncores = Sys.CPU_THREADS)' + else + $${JULIA_BINARY:?} -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)' + fi diff --git a/.buildkite/pipelines/scheduled/0_webui.yml b/.buildkite/pipelines/scheduled/0_webui.yml index 3aa1b575316d81..61324d13d0ca12 100644 --- a/.buildkite/pipelines/scheduled/0_webui.yml +++ b/.buildkite/pipelines/scheduled/0_webui.yml @@ -4,7 +4,6 @@ agents: queue: "julia" sandbox.jl: "true" - steps: - label: ":unlock: Unlock secrets, launch pipelines" plugins: diff --git a/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml b/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml index b1e2eaff614972..f5d93264f7aacd 100644 --- a/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml +++ b/.buildkite/pipelines/scheduled/coverage/coverage_linux64.yml @@ -3,7 +3,6 @@ agents: # Only run on `sandbox.jl` machines (not `docker`-isolated ones) since we need nestable sandboxing sandbox.jl: "true" os: "linux" - steps: - label: ":unlock: :coverage: Run coverage test" plugins: diff --git a/.buildkite/utilities/rr/rr_capture.jl b/.buildkite/utilities/rr/rr_capture.jl index 07d57f31ff29cf..5d60377a72bb6e 100644 --- a/.buildkite/utilities/rr/rr_capture.jl +++ b/.buildkite/utilities/rr/rr_capture.jl @@ -1,44 +1,94 @@ -using Dates -using Pkg -using Tar - -if Base.VERSION < v"1.6" - throw(ErrorException("The `rr_capture.jl` script requires Julia 1.6 or greater")) -end - -if length(ARGS) < 1 - throw(ErrorException("Usage: rr_capture.jl [command...]")) +import Dates +import Pkg +import Tar + +function get_bool_from_env(name::AbstractString, default_value::Bool) + value = get(ENV, name, "$(default_value)") |> strip |> lowercase + result = parse(Bool, value)::Bool + return result end -const TIMEOUT = 2 * 60 * 60 # timeout in seconds +const is_buildkite = get_bool_from_env("BUILDKITE", false) +const always_save_rr_trace = get_bool_from_env("JULIA_ALWAYS_SAVE_RR_TRACE", false) -# We only use `rr` on the `tester_linux64` builder -const use_rr_if_builder_is = "tester_linux64" - -const run_id = get(ENV, "BUILDKITE_JOB_ID", "unknown") -const shortcommit = get(ENV, "BUILDKITE_COMMIT", "unknown") -const builder = get(ENV, "BUILDKITE_STEP_KEY", use_rr_if_builder_is) -const use_rr = builder == use_rr_if_builder_is +function get_from_env(name::AbstractString) + if is_buildkite + value = ENV[name] + else + value = get(ENV, name, "") + end + result = convert(String, strip(value))::String + return result +end -@info "" run_id shortcommit builder use_rr -@info "" ARGS +function my_exit(process::Base.Process) + wait(process) + + @info( + "", + process.exitcode, + process.termsignal, + ) + + # Pass the exit code back up + if process.termsignal != 0 + ccall(:raise, Cvoid, (Cint,), process.termsignal) + + # If for some reason the signal did not cause an exit, we'll exit manually. + # We need to make sure that we exit with a non-zero exit code. + if process.exitcode != 0 + exit(process.exitcode) + else + exit(1) + end + end + exit(process.exitcode) +end -# if !use_rr # TODO: uncomment this line -if true # TODO: delete this line - @info "We will not run the tests under rr" - p = run(`$ARGS`) - exit(p.exitcode) +if Base.VERSION < v"1.6" + throw(ErrorException("The `$(basename(@__FILE__))` script requires Julia 1.6 or greater")) end -@info "We will run the tests under rr" +if length(ARGS) < 1 + throw(ErrorException("Usage: julia $(basename(@__FILE__)) [command...]")) +end -const num_cores = min(Sys.CPU_THREADS, 8, parse(Int, get(ENV, "JULIA_TEST_NUM_CORES", "8")) + 1) -@info "" num_cores +@info "We will run the command under rr" + +const build_number = get_from_env("BUILDKITE_BUILD_NUMBER") +const job_name = get_from_env("BUILDKITE_STEP_KEY") +const commit_full = get_from_env("BUILDKITE_COMMIT") +const commit_short = first(commit_full, 10) +const timeout_minutes = 120 +const JULIA_TEST_NUM_CORES = get(ENV, "JULIA_TEST_NUM_CORES", "8") +const julia_test_num_cores_int = parse(Int, JULIA_TEST_NUM_CORES) +const num_cores = min( + 8, + Sys.CPU_THREADS, + julia_test_num_cores_int + 1, +) + +ENV["JULIA_RRCAPTURE_NUM_CORES"] = "$(num_cores)" + +@info( + "", + build_number, + job_name, + commit_full, + commit_short, + timeout_minutes, + num_cores, +) + +const dumps_dir = joinpath(pwd(), "dumps") +const temp_parent_dir = joinpath(pwd(), "temp_for_rr") + +mkpath(dumps_dir) +mkpath(temp_parent_dir) proc = nothing -new_env = copy(ENV) -mktempdir() do dir +mktempdir(temp_parent_dir) do dir Pkg.activate(dir) Pkg.add("rr_jll") Pkg.add("Zstd_jll") @@ -68,18 +118,22 @@ mktempdir() do dir # Start asynchronous timer that will kill `rr` @async begin - sleep(TIMEOUT) + sleep(timeout_minutes * 60) # If we've exceeded the timeout and `rr` is still running, kill it. if isopen(proc) - println(stderr, "\n\nProcess timed out. Signalling `rr` for force-cleanup!") + println(stderr, "\n\nProcess timed out (with a timeout of $(timeout_minutes) minutes). Signalling `rr` for force-cleanup!") kill(proc, Base.SIGTERM) - # Give `rr` a chance to cleanup - sleep(60) + # Give `rr` a chance to cleanup and upload. + # Note: this time period includes the time to upload the `rr` trace files + # as Buildkite artifacts, so make sure it is long enough to allow the + # uploads to finish. + cleanup_minutes = 30 + sleep(cleanup_minutes * 60) if isopen(proc) - println(stderr, "\n\n`rr` failed to cleanup within one minute, killing and exiting immediately!") + println(stderr, "\n\n`rr` failed to cleanup and upload within $(cleanup_minutes) minutes, killing and exiting immediately!") kill(proc, Base.SIGKILL) exit(1) end @@ -87,11 +141,10 @@ mktempdir() do dir end # Wait for `rr` to finish, either through naturally finishing its run, or `SIGTERM`. - # If we have to `SIGKILL` wait(proc) + process_failed = !success(proc) - # On a non-zero exit code, upload the `rr` trace - if !success(proc) + if process_failed || always_save_rr_trace || is_buildkite println(stderr, "`rr` returned $(proc.exitcode), packing and uploading traces...") if !isdir(joinpath(dir, "rr_traces")) @@ -113,22 +166,34 @@ mktempdir() do dir run(ignorestatus(`$(rr_path) pack --pack-dir=$pack_dir $(trace_dirs)`)) # Tar it up - mkpath("dumps") - datestr = Dates.format(now(), dateformat"yyyy-mm-dd_HH_MM_SS") - dst_path = "dumps/rr-run_$(run_id)-gitsha_$(shortcommit)-$(datestr).tar.zst" + mkpath(dumps_dir) + date_str = Dates.format(Dates.now(), Dates.dateformat"yyyy_mm_dd_HH_MM_SS") + dst_file_name = string( + "rr", + "--build_$(build_number)", + "--$(job_name)", + "--commit_$(commit_short)", + "--$(date_str)", + ".tar.zst", + ) + dst_full_path = joinpath(dumps_dir, dst_file_name) zstd_jll.zstdmt() do zstdp - tarproc = open(`$zstdp -o $dst_path`, "w") + tarproc = open(`$(zstdp) -o $(dst_full_path)`, "w") Tar.create(dir, tarproc) close(tarproc.in) end + + @info "The `rr` trace file has been saved to: $(dst_full_path)" + if is_buildkite + @info "Since this is a Buildkite run, we will upload the `rr` trace file." + cd(dumps_dir) do + run(`buildkite-agent artifact upload $(dst_file_name)`) + end + end end + end end -# Pass the exit code back up to Buildkite -if proc.termsignal != 0 - ccall(:raise, Cvoid, (Cint,), proc.termsignal) - exit(1) # Just in case the signal did not cause an exit -else - exit(proc.exitcode) -end +@info "Finished running the command under rr" +my_exit(proc)