Skip to content

Commit

Permalink
CI (Buildkite): Add package_linux and tester_linux for more Linux…
Browse files Browse the repository at this point in the history
… architectures
  • Loading branch information
DilumAluthge committed Sep 15, 2021
1 parent 3794f9a commit e5fc5a8
Show file tree
Hide file tree
Showing 10 changed files with 349 additions and 141 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipelines/experimental/0_webui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ steps:
# 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
5 changes: 3 additions & 2 deletions .buildkite/pipelines/main/launch_unsigned_builders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ steps:
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
# Finally, we 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
95 changes: 0 additions & 95 deletions .buildkite/pipelines/main/platforms/linux64.yml

This file was deleted.

6 changes: 6 additions & 0 deletions .buildkite/pipelines/main/platforms/package_linux.arches
Original file line number Diff line number Diff line change
@@ -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
53 changes: 53 additions & 0 deletions .buildkite/pipelines/main/platforms/package_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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
notify:
- github_commit_status:
context: "package_linux$ARCH_LABEL"
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
24 changes: 24 additions & 0 deletions .buildkite/pipelines/main/platforms/platforms.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions .buildkite/pipelines/main/platforms/tester_linux.arches
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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_mt i686 60 v3.2 209c4db679a515befd7fb50ecc6bfbecf7ec3d32
32 32_st i686 60 v3.2 209c4db679a515befd7fb50ecc6bfbecf7ec3d32
# ppc64le ppc64le powerpc64le 60 v3.2 c03a0158b19d48ac84b426834fce0d3584cdd0c7
64 64_mt x86_64 60 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
64 64_st x86_64 60 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
64 64_rr_mt x86_64 180 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
64 64_rr_st x86_64 180 v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
73 changes: 73 additions & 0 deletions .buildkite/pipelines/main/platforms/tester_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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
notify:
- github_commit_status:
context: "tester_linux$ARCH_LABEL"
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 "--- Run the Julia test suite"
unset JULIA_DEPOT_PATH
# TODO: do not skip any test sets
if [[ "$$BUILDKITE_STEP_KEY" == "tester_linux64_rr_mt" ]]; then
export JULIA_NUM_THREADS=16
$$JULIA_BINARY .buildkite/utilities/rr/buildkite.jl $$JULIA_BINARY -e 'Base.runtests(["all", "--skip", "cmdlineargs"]; ncores = parse(Int, ENV["JULIA_RRCAPTURE_NUM_CORES"]))'
elif [[ "$$BUILDKITE_STEP_KEY" == "tester_linux64_rr_st" ]]; then
export JULIA_NUM_THREADS=1
$$JULIA_BINARY .buildkite/utilities/rr/buildkite.jl $$JULIA_BINARY -e 'Base.runtests(["all"]; ncores = parse(Int, ENV["JULIA_RRCAPTURE_NUM_CORES"]))'
elif [[ "$$BUILDKITE_STEP_KEY" == "tester_linux64_st" ]]; then
export JULIA_NUM_THREADS=1
$$JULIA_BINARY -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)'
elif [[ "$$BUILDKITE_STEP_KEY" == "tester_linux32_st" ]]; then
export JULIA_NUM_THREADS=1
$$JULIA_BINARY -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)'
else
export JULIA_NUM_THREADS=16
$$JULIA_BINARY -e 'Base.runtests(["all"]; ncores = Sys.CPU_THREADS)'
fi
47 changes: 47 additions & 0 deletions .buildkite/utilities/rr/buildkite.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
if length(ARGS) < 1
throw(ErrorException("Usage: julia $(basename(@__FILE__)) [command...]"))
end

const is_buildkite = tryparse(Bool, lowercase(strip(get(ENV, "BUILDKITE", "")))) === true
if !is_buildkite
msg = string(
"The `$(basename(@__FILE__))` script only works on Buildkite. ",
"If you are running locally, you should use the `rr_capture.jl` script instead.",
)
throw(ErrorException(msg))
end

# We only use `rr` on certain Buildkite jobs
const rr_job_list = String[
# "tester_linux64",
# "tester_linux64_mt",
# "tester_linux64_st",
"tester_linux64_rr",
"tester_linux64_rr_mt",
"tester_linux64_rr_st",
]
const this_job = ENV["BUILDKITE_STEP_KEY"]

if !(this_job in rr_job_list)
@info "We will not run the tests under rr" this_job rr_job_list
run(`$ARGS`)
@info "Finished running the tests (not under rr)"
exit(0)
end

@info "This Buildkite job is in the list of `rr` jobs" this_job rr_job_list

const env_mappings = Dict{String, String}()
env_mappings["JULIA_RRCAPTURE_BUILD_NUMBER"] = ENV["BUILDKITE_BUILD_NUMBER"]
env_mappings["JULIA_RRCAPTURE_COMMIT"] = ENV["BUILDKITE_COMMIT"]
env_mappings["JULIA_RRCAPTURE_JOB_NAME"] = this_job
env_mappings["JULIA_RRCAPTURE_IS_BUILDKITE"] = "true"

rr_capture = joinpath(@__DIR__, "rr_capture.jl")

cmd = addenv(
`$(Base.julia_cmd().exec[1]) $(rr_capture) $ARGS`,
env_mappings,
)

run(cmd)
Loading

0 comments on commit e5fc5a8

Please sign in to comment.