Skip to content

Commit 84bed88

Browse files
.buildkite added
1 parent a4186c5 commit 84bed88

14 files changed

+295
-0
lines changed

.buildkite/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh_deploy.key

.buildkite/0_webui.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
agents:
2+
queue: "juliaecosystem"
3+
sandbox_capable: true
4+
5+
steps:
6+
- label: ":unlock: Launch tutorials build if hash check successful"
7+
branches: "!gh-pages"
8+
plugins:
9+
- staticfloat/cryptic#v2:
10+
signed_pipelines:
11+
- pipeline: .buildkite/launch_tutorials.yml
12+
signature_file: .buildkite/launch_tutorials.yml.signature
13+
inputs:
14+
- .buildkite/run_tutorial.yml
15+
- .buildkite/publish_tutorials_output.sh
16+
allow_hash_override: true
17+
command: "true"
18+
19+
- label: ":runner: Dynamically launch test suite"
20+
plugins:
21+
- staticfloat/forerunner:
22+
# This will create one job overall, throwing all path information away
23+
watch:
24+
- "src/**/*.jl"
25+
- "src/*.jl"
26+
- "**/*.toml"
27+
target: .buildkite/test_turing.yml
28+
target_type: simple

.buildkite/build_tutorial.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
echo "--- Instantiate"
6+
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.build()'
7+
8+
# Run tutorial
9+
echo "+++ Run tutorial for ${1}"
10+
julia --project=. weave_tutorials.jl "${1}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
# Ignore the unencrypted repo_key
3+
repo_key
4+
5+
# Ignore any agent keys (public or private) we have stored
6+
agent_key*
256 Bytes
Binary file not shown.

.buildkite/launch_test_turing.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
agents:
2+
queue: "juliaecosystem"
3+
sandbox_capable: true
4+
5+
steps:
6+
- label: ":runner: Dynamically launch test_turing"
7+
branches: "!gh-pages"
8+
plugins:
9+
- staticfloat/forerunner:
10+
# This will create one job overall, throwing all path information away
11+
watch:
12+
- "src/**/*.jl"
13+
- "src/*.jl"
14+
- "**/*.toml"
15+
target: .buildkite/test_turing.yml
16+
target_type: simple

.buildkite/launch_tutorials.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
agents:
2+
queue: "juliaecosystem"
3+
sandbox_capable: true
4+
5+
steps:
6+
- label: ":runner: Dynamically launch run_tutorial.yml"
7+
branches: "!gh-pages"
8+
env:
9+
BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET: ${BUILDKITE_PLUGIN_CRYPTIC_BASE64_SIGNED_JOB_ID_SECRET?}
10+
depends_on:
11+
plugins:
12+
- staticfloat/forerunner:
13+
# This will create one job per project
14+
watch:
15+
- tutorials/**/*.jmd
16+
- tutorials/**/*.toml
17+
path_processor: .buildkite/path_processors/project-coalescing
18+
target: .buildkite/run_tutorial.yml
19+
target_type: template
96 Bytes
Binary file not shown.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# When a `.jmd` file is modified, it gets rewritten by itself; but when a `.toml` file
4+
# (such as a `Project.toml` or a `Manifest.toml`) gets modified, we rebuild the entire
5+
# directory. To avoid double-building, we coalesce all changes here, by converting
6+
# changed files that end in `.toml` to their directory, then dropping all other files
7+
# within that folder.
8+
9+
# This will hold all files that need to be rebuilt, keyed by path and pointing to their
10+
# containing project
11+
declare -A FILES
12+
13+
# This will hold all projects that need to be rebuilt, and will allow us to suppress
14+
# values from FILES_TO_RUN
15+
declare -A PROJECTS
16+
17+
# Helper function to find the directory that contains the `Project.toml` for this file
18+
function find_project() {
19+
d="${1}"
20+
# We define a basecase, that the path must begin with `tutorials` and is not allowed
21+
# to move outside of that subtree.
22+
while [[ "${d}" =~ tutorials/.* ]]; do
23+
if [[ -f "${d}/Project.toml" ]]; then
24+
echo "${d}"
25+
return
26+
fi
27+
d="$(dirname "${d}")"
28+
done
29+
}
30+
31+
# For each file, find its project, then if its a `.jmd` file, we add it to `FILES`
32+
# If it's a `.toml` file, we add it to `PROJECTS`.
33+
for f in "$@"; do
34+
proj=$(find_project "${f}")
35+
if [[ -z "${proj}" ]]; then
36+
buildkite-agent annotate "Unable to find project for ${f}" --style "error"
37+
continue
38+
fi
39+
40+
if [[ "${f}" == *.jmd ]]; then
41+
FILES["${f}"]="${proj}"
42+
elif [[ "${f}" == *.toml ]]; then
43+
PROJECTS["${proj}"]=1
44+
else
45+
buildkite-agent annotate "Unknown weave type for file ${f}" --style "error"
46+
fi
47+
done
48+
49+
# We're going to emit the project directories first:
50+
BUILD_TARGETS="${!PROJECTS[@]}"
51+
52+
# But we're also going to emit any single files whose projects are _not_ contained
53+
# in the projects we're already building
54+
for f in "${!FILES[@]}"; do
55+
proj=${FILES[$f]}
56+
if ! [ ${PROJECTS[$proj]+x} ]; then
57+
BUILD_TARGETS="${BUILD_TARGETS} ${f}"
58+
fi
59+
done
60+
61+
# Output the build targets
62+
echo "${BUILD_TARGETS}"

.buildkite/pipeline.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
steps:
2+
- label: ":runner: Dynamically launch Pipelines"
3+
plugins:
4+
- staticfloat/forerunner:
5+
# This will create one job per project
6+
watch:
7+
- tutorials/**/*.jmd
8+
- tutorials/**/*.toml
9+
path_processor: .buildkite/path_processors/project-coalescing
10+
target: .buildkite/run_tutorial.yml
11+
target_type: template
12+
agents:
13+
queue: "juliacpu"
14+
fastcpu: true
15+
if: build.message !~ /\[skip ci\]/

0 commit comments

Comments
 (0)