diff --git a/ci/buildkite-snap.yml b/ci/buildkite-snap.yml new file mode 100644 index 0000000000..4122f754d8 --- /dev/null +++ b/ci/buildkite-snap.yml @@ -0,0 +1,4 @@ +steps: + - command: "ci/snap.sh" + timeout_in_minutes: 30 + name: "snap [public]" diff --git a/ci/buildkite.yml b/ci/buildkite.yml index cafcf043bc..1a8e9a7adb 100644 --- a/ci/buildkite.yml +++ b/ci/buildkite.yml @@ -18,14 +18,16 @@ steps: limit: 2 agents: - "queue=cuda" - - command: "ci/snap.sh [public]" + - command: "ci/pr-snap.sh" timeout_in_minutes: 30 name: "snap [public]" - wait - - command: "ci/publish-crate.sh [public]" + - command: "ci/publish-crate.sh" timeout_in_minutes: 20 - name: "publish crate" - - command: "ci/hoover.sh [public]" + name: "publish crate [public]" + - command: "ci/hoover.sh" timeout_in_minutes: 20 - name: "clean agent" - + name: "clean agent [public]" + - trigger: "solana-snap" + branches: "master" + async: true diff --git a/ci/is-pr.sh b/ci/is-pr.sh new file mode 100755 index 0000000000..ad432dff08 --- /dev/null +++ b/ci/is-pr.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +# +# The standard BUILDKITE_PULL_REQUEST environment variable is always "false" due +# to how solana-ci-gate is used to trigger PR builds rather than using the +# standard Buildkite PR trigger. +# + +[[ $BUILDKITE_BRANCH =~ pull/* ]] diff --git a/ci/pr-snap.sh b/ci/pr-snap.sh new file mode 100755 index 0000000000..1e78e7d012 --- /dev/null +++ b/ci/pr-snap.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e +# +# Only run snap.sh for pull requests that modify files under /snap +# + +cd "$(dirname "$0")" + +if ./is-pr.sh; then + affected_files="$(buildkite-agent meta-data get affected_files)" + echo "Affected files in this PR: $affected_files" + if [[ ! ":$affected_files:" =~ :snap/ ]]; then + echo "Skipping snap build as no files under /snap were modified" + exit 0 + fi + exec ./snap.sh +else + echo "Skipping snap build as this is not a pull request" +fi diff --git a/ci/snap.sh b/ci/snap.sh index 8d68c77ec9..52a46a9683 100755 --- a/ci/snap.sh +++ b/ci/snap.sh @@ -3,7 +3,7 @@ cd "$(dirname "$0")/.." DRYRUN= -if [[ -z $BUILDKITE_BRANCH || $BUILDKITE_BRANCH =~ pull/* ]]; then +if [[ -z $BUILDKITE_BRANCH ]] || ./ci/is-pr.sh; then DRYRUN="echo" fi