rabbitmq-server/.github/workflows/test-make-target.yaml

170 lines
6.0 KiB
YAML

name: Test target (make)
on:
workflow_call:
inputs:
erlang_version:
required: true
type: string
elixir_version:
required: true
type: string
metadata_store:
required: true
type: string
mixed_clusters:
required: false
default: false
type: boolean
previous_version:
required: false
default: 'tags/v4.0.9'
type: string
make_target:
required: true
type: string
plugin:
required: true
type: string
# in almost all cases this should not be set and the ref that triggered
# the workflow will be used. however, mixed version tests for skip-version
# upgrades (eg. 3.13->4.2) need this because they run on scheduled
# and scheduled workflows get `main` as ref
ref:
required: false
type: string
description: 'Git ref (branch, tag, or SHA) to checkout'
jobs:
test:
name: ${{ inputs.plugin }} (${{ inputs.make_target }})
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
- name: FETCH TAGS
run: git fetch --tags
- name: EXTRACT ACTIVEMQ VERSION
if: inputs.plugin == 'amqp10_client'
run: |
awk '/^ACTIVEMQ_VERSION/ {print $1 "=" $3}' deps/amqp10_client/Makefile >> $GITHUB_ENV
- name: SETUP OTP & ELIXIR
uses: erlef/setup-beam@v1
with:
otp-version: ${{ inputs.erlang_version }}
elixir-version: ${{ inputs.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
# This currently only applies to Elixir; and can be safely
# restricted to the build jobs to avoid duplication in output.
disable_problem_matchers: true
# We install Erlang problem matchers from ci.erlang.mk.
- name: CHECKOUT ERLANG PROBLEM MATCHERS
uses: actions/checkout@v5
with:
repository: ninenines/ci.erlang.mk
path: ci.erlang.mk
- name: INSTALL ERLANG PROBLEM MATCHERS
run: echo "::add-matcher::ci.erlang.mk/.github/matchers/erlang-matchers.json"
- name: MIXED CLUSTERS - FETCH SIGNING KEYS
uses: dsaltares/fetch-gh-release-asset@master
if: inputs.mixed_clusters
with:
repo: rabbitmq/signing-keys
file: rabbitmq-release-signing-key.asc
- name: MIXED CLUSTERS - FETCH PREVIOUS VERSION
id: fetch_secondary_dist
uses: dsaltares/fetch-gh-release-asset@master
if: inputs.mixed_clusters
with:
version: ${{ inputs.previous_version }}
regex: true
file: "rabbitmq-server-generic-unix-\\d.+\\.tar\\.xz"
target: ./
- name: MIXED CLUSTERS - SETUP SECONDARY_DIST
if: inputs.mixed_clusters
run: |
ls -l rabbitmq-server-generic-unix-*.tar.xz*
archive_name=$(echo rabbitmq-server-generic-unix-*.tar.xz)
archive_version=$(echo $archive_name | sed -E -e 's/^rabbitmq-server-generic-unix-//' -e 's/\.tar\.xz$//')
gpg --import rabbitmq-release-signing-key.asc
gpg --verify $archive_name.asc $archive_name
tar xf $archive_name
echo "SECONDARY_DIST=${GITHUB_WORKSPACE}/rabbitmq_server-$archive_version" >> $GITHUB_ENV
- name: SETUP SLAPD (rabbitmq_auth_backend_ldap)
if: inputs.plugin == 'rabbitmq_auth_backend_ldap'
run: |
sudo apt-get update && \
sudo apt-get install -y \
ldap-utils \
slapd
sudo systemctl is-active --quiet apparmor.service && sudo systemctl stop apparmor.service
sudo systemctl disable apparmor.service
- name: RUN LOW VERSION ERLANG NODE IN DOCKER
if: inputs.make_target == 'ct-rabbit_fifo_prop'
run: |
# This version must be at least 1 major version lower than inputs.erlang_version
LOW_ERLANG_VERSION="26.2"
# Create ~/.erlang.cookie by starting a distributed node
erl -sname temp_node -eval 'halt().' -noshell
docker run -d --network host --name erlang_low_version erlang:${LOW_ERLANG_VERSION} \
erl -sname rabbit_fifo_prop@localhost -setcookie $(cat ~/.erlang.cookie) -noinput
- name: RESTORE ACTIVEMQ FROM CACHE
if: inputs.plugin == 'amqp10_client'
uses: actions/cache/restore@v4
id: cache-activemq-restore
with:
path: deps/amqp10_client/test/system_SUITE_data/apache-activemq-${{ env.ACTIVEMQ_VERSION }}-bin.tar.gz
key: activemq-${{ env.ACTIVEMQ_VERSION }}
- name: RUN TESTS
if: inputs.plugin != 'rabbitmq_cli'
run: |
sudo netstat -ntp
set -o pipefail
make -C deps/${{ inputs.plugin }} ${{ inputs.make_target }} RABBITMQ_METADATA_STORE=${{ inputs.metadata_store }} NON_DETERMINISTIC=1 2>&1 | sed "s/src\//deps\/${{ inputs.plugin }}\/src\//" | sed "s/test\//deps\/${{ inputs.plugin }}\/test\//" | sed "s/src\/enough\.erl:22:2:/IGNORED src\/enough.erl:22:2:/"
- name: CACHE ACTIVEMQ
uses: actions/cache/save@v4
if: inputs.plugin == 'amqp10_client' && steps.cache-activemq-restore.outputs.cache-hit != 'true'
with:
path: deps/amqp10_client/test/system_SUITE_data/apache-activemq-${{ env.ACTIVEMQ_VERSION }}-bin.tar.gz
key: activemq-${{ env.ACTIVEMQ_VERSION }}
# rabbitmq_cli needs a correct broker version for two of its tests.
# But setting PROJECT_VERSION makes other plugins fail.
- name: RUN TESTS (rabbitmq_cli)
if: inputs.plugin == 'rabbitmq_cli'
run: |
make -C deps/${{ inputs.plugin }} ${{ inputs.make_target }} RABBITMQ_METADATA_STORE=${{ inputs.metadata_store }} PROJECT_VERSION="4.1.0"
- name: UPLOAD TEST LOGS
if: always()
uses: actions/upload-artifact@v5
with:
name: CT logs (${{ inputs.plugin }} ${{ inputs.make_target }} OTP-${{ inputs.erlang_version }} ${{ inputs.metadata_store }}${{ inputs.mixed_clusters && ' mixed' || '' }})
path: |
logs/
deps/rabbitmq_cli/logs/
# !logs/**/log_private
if-no-files-found: ignore