summaryrefslogtreecommitdiff
path: root/ci/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'ci/scripts')
-rwxr-xr-xci/scripts/collect.sh7
-rwxr-xr-xci/scripts/ct-suite.sh28
-rwxr-xr-xci/scripts/dialyze.sh8
-rwxr-xr-xci/scripts/fetch_secondary_umbrellas.sh45
-rwxr-xr-xci/scripts/finish.sh5
-rwxr-xr-xci/scripts/package_generic_unix.sh14
-rwxr-xr-xci/scripts/rabbitmq_cli.sh49
-rwxr-xr-xci/scripts/tests.sh26
-rwxr-xr-xci/scripts/validate-workflow.sh26
-rwxr-xr-xci/scripts/xref.sh8
10 files changed, 216 insertions, 0 deletions
diff --git a/ci/scripts/collect.sh b/ci/scripts/collect.sh
new file mode 100755
index 0000000000..8ebbe0e8b4
--- /dev/null
+++ b/ci/scripts/collect.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -euo pipefail
+
+echo "Recording buildevents step finish for ${project} started at ${STEP_START}..."
+buildevents step ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-${project} ${STEP_START} ${project}
+echo "done."
diff --git a/ci/scripts/ct-suite.sh b/ci/scripts/ct-suite.sh
new file mode 100755
index 0000000000..a8e47c995c
--- /dev/null
+++ b/ci/scripts/ct-suite.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq/deps/$project
+
+! test -d ebin || touch ebin/*
+
+trap 'catch $?' EXIT
+
+catch() {
+ if [ "$1" != "0" ]; then
+ make ct-logs-archive && mv *-ct-logs-*.tar.xz /workspace/ct-logs/
+ fi
+}
+
+CMD=ct-${CT_SUITE}
+SECONDARY_UMBRELLA_ARGS=""
+if [[ "${SECONDARY_UMBRELLA_VERSION:-}" != "" ]]; then
+ CMD=ct-${CT_SUITE}-mixed-${SECONDARY_UMBRELLA_VERSION}
+ SECONDARY_UMBRELLA_ARGS="SECONDARY_UMBRELLA=/workspace/rabbitmq-${SECONDARY_UMBRELLA_VERSION} RABBITMQ_FEATURE_FLAGS="
+fi
+
+buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-${project} ${CMD} -- \
+ make ct-${CT_SUITE} \
+ FULL= \
+ FAIL_FAST=1 \
+ SKIP_AS_ERROR=1 ${SECONDARY_UMBRELLA_ARGS}
diff --git a/ci/scripts/dialyze.sh b/ci/scripts/dialyze.sh
new file mode 100755
index 0000000000..fbb8e6dc54
--- /dev/null
+++ b/ci/scripts/dialyze.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq/deps/$project
+
+buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-dialyze ${project} -- \
+ make dialyze
diff --git a/ci/scripts/fetch_secondary_umbrellas.sh b/ci/scripts/fetch_secondary_umbrellas.sh
new file mode 100755
index 0000000000..466ef4a765
--- /dev/null
+++ b/ci/scripts/fetch_secondary_umbrellas.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+set -euo pipefail
+
+refs="$@"
+
+for version in ${refs}; do
+ umbrella="umbrellas/$version"
+ if ! test -d "$umbrella" ||
+ ! make -C "$umbrella/deps/rabbit" test-dist; then
+ rm -rf "$umbrella"
+
+ # Fetch the master Umbrella; the final umbrellas are created from
+ # the master copy.
+ if ! test -d umbrellas/master; then
+ git config --global advice.detachedHead false
+ git clone \
+ https://github.com/rabbitmq/rabbitmq-public-umbrella.git \
+ umbrellas/master
+ make -C umbrellas/master co # To get RabbitMQ components.
+ fi
+
+ # We copy the master Umbrella and checkout the appropriate tag.
+ cp -a umbrellas/master "$umbrella"
+ git -C "$umbrella" checkout "master"
+ make -C "$umbrella" up BRANCH="$version"
+ # To remove third-party deps which were checked out when the
+ # projects were on the `master` branch. Thus, possibly not the
+ # version pinning we expect. We update the Umbrella one last time
+ # to fetch the correct third-party deps.
+ make -C "$umbrella" clean-3rd-party-repos
+ make -C "$umbrella" up
+ make -C "$umbrella/deps/rabbit" test-dist
+ rm -rf "$umbrella"/deps/rabbitmq_website
+ rm -rf "$umbrella"/deps/rabbitmq_prometheus/docker
+ rm -rf "$umbrella"/deps/*/{.git,test} "$umbrella"/.git
+ fi
+done
+
+for version in ${refs}; do
+ umbrella="umbrellas/$version"
+ mv ${umbrella} rabbitmq-${version}
+done
+
+rm -fr umbrellas
diff --git a/ci/scripts/finish.sh b/ci/scripts/finish.sh
new file mode 100755
index 0000000000..c6047e1681
--- /dev/null
+++ b/ci/scripts/finish.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -euo pipefail
+
+buildevents build ${GITHUB_RUN_ID} ${BUILD_START} ${BUILD_RESULT}
diff --git a/ci/scripts/package_generic_unix.sh b/ci/scripts/package_generic_unix.sh
new file mode 100755
index 0000000000..820821ab30
--- /dev/null
+++ b/ci/scripts/package_generic_unix.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq
+
+trap 'catch $?' EXIT
+
+catch() {
+ buildevents step ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-packaging ${STEP_START} packaging
+}
+
+buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-packaging package-generic-unix -- \
+ make package-generic-unix
diff --git a/ci/scripts/rabbitmq_cli.sh b/ci/scripts/rabbitmq_cli.sh
new file mode 100755
index 0000000000..d21608df22
--- /dev/null
+++ b/ci/scripts/rabbitmq_cli.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq/deps/$project
+
+trap 'catch $?' EXIT
+
+SPAN_ID=${GITHUB_RUN_ID}-${project}
+
+catch() {
+ buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} stop-node -- \
+ make stop-node -C ../.. \
+ DEPS_DIR=/workspace/rabbitmq/deps \
+ PLUGINS='rabbitmq_federation rabbitmq_stomp'
+
+ if [ "$1" != "0" ]; then
+ tar -c -f - /tmp/rabbitmq-test-instances/*/log | \
+ xz > /workspace/broker-logs/broker-logs.tar.xz
+ fi
+
+ buildevents step ${GITHUB_RUN_ID} ${SPAN_ID} ${STEP_START} ${project}
+}
+
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} make -- \
+ make DEPS_DIR=/workspace/rabbitmq/deps
+
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} start-background-broker -- \
+ make start-background-broker \
+ -C ../.. \
+ DEPS_DIR=/workspace/rabbitmq/deps \
+ PLUGINS='rabbitmq_federation rabbitmq_stomp'
+
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} rebar -- \
+ mix local.rebar --force
+
+# due to https://github.com/elixir-lang/elixir/issues/7699 we
+# "run" the tests, but skip them all, in order to trigger
+# compilation of all *_test.exs files before we actually run themq
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} compile-tests -- \
+ make tests \
+ MIX_TEST_OPTS="--exclude test" \
+ DEPS_DIR=/workspace/rabbitmq/deps
+
+# rabbitmq-diagnostics erlang-cookie-sources reads USER from then env
+export USER=$(whoami)
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} tests -- \
+ make tests \
+ DEPS_DIR=/workspace/rabbitmq/deps
diff --git a/ci/scripts/tests.sh b/ci/scripts/tests.sh
new file mode 100755
index 0000000000..abf4bc865d
--- /dev/null
+++ b/ci/scripts/tests.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq/deps/$project
+
+trap 'catch $?' EXIT
+
+SPAN_ID=${GITHUB_RUN_ID}-${project}
+
+catch() {
+ if [ "$1" != "0" ]; then
+ make ct-logs-archive && mv *-ct-logs-*.tar.xz /workspace/ct-logs/
+ fi
+
+ buildevents step ${GITHUB_RUN_ID} ${SPAN_ID} ${STEP_START} ${project}
+}
+
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} test-build -- \
+ make test-build
+
+buildevents cmd ${GITHUB_RUN_ID} ${SPAN_ID} tests -- \
+ make tests \
+ FULL= \
+ FAIL_FAST=1 \
+ SKIP_AS_ERROR=1
diff --git a/ci/scripts/validate-workflow.sh b/ci/scripts/validate-workflow.sh
new file mode 100755
index 0000000000..3614953ee3
--- /dev/null
+++ b/ci/scripts/validate-workflow.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd deps/${project}
+
+trap 'catch $?' EXIT
+
+catch() {
+ rm expected_suites.txt actual_suites.txt
+}
+
+touch expected_suites.txt
+for arg in "$@"; do
+ echo "test/${arg}_SUITE.erl" >> expected_suites.txt
+done
+sort -o expected_suites.txt expected_suites.txt
+
+touch actual_suites.txt
+for f in test/*_SUITE.erl; do
+ echo "$f" >> actual_suites.txt
+done
+sort -o actual_suites.txt actual_suites.txt
+
+set -x
+diff actual_suites.txt expected_suites.txt
diff --git a/ci/scripts/xref.sh b/ci/scripts/xref.sh
new file mode 100755
index 0000000000..5e37ca833d
--- /dev/null
+++ b/ci/scripts/xref.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -euo pipefail
+
+cd /workspace/rabbitmq/deps/$project
+
+buildevents cmd ${GITHUB_RUN_ID} ${GITHUB_RUN_ID}-xref ${project} -- \
+ make xref