forked from rabbitmq/rabbitmq-server
-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (169 loc) · 5.45 KB
/
test-plugin.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Test Plugin
on:
workflow_call:
inputs:
repo_cache_key:
required: true
type: string
plugin:
required: true
type: string
shard_index:
default: 0
type: number
shard_count:
default: 1
type: number
secrets:
REMOTE_CACHE_BUCKET_NAME:
required: true
REMOTE_CACHE_CREDENTIALS_JSON:
required: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
erlang_version:
- 26
metadata_store:
- mnesia
- khepri
include:
- erlang_version: 26
elixir_version: 1.15
timeout-minutes: 120
steps:
- name: LOAD REPO CACHE
uses: actions/cache/restore@v4
with:
key: ${{ inputs.repo_cache_key }}
path: /home/runner/repo-cache/
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: CONFIGURE OTP & ELIXIR
uses: erlef/[email protected]
with:
otp-version: ${{ matrix.erlang_version }}
elixir-version: ${{ matrix.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://cdn.jsdelivr.net/hex
- name: AUTHENTICATE TO GOOGLE CLOUD
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.REMOTE_CACHE_CREDENTIALS_JSON }}
- name: CONFIGURE BAZEL
run: |
if [ -n "${{ secrets.REMOTE_CACHE_BUCKET_NAME }}" ]; then
cat << EOF >> user.bazelrc
build --remote_cache=https://storage.googleapis.com/${{ secrets.REMOTE_CACHE_BUCKET_NAME }}
build --google_default_credentials
build --experimental_guard_against_concurrent_changes
EOF
fi
cat << EOF >> user.bazelrc
build --repository_cache=/home/runner/repo-cache/
build --color=yes
EOF
bazelisk info release
#! - name: Setup tmate session
#! uses: mxschmitt/action-tmate@v3
- uses: actions/setup-dotnet@v4
if: inputs.plugin == 'rabbit'
with:
dotnet-version: '3.1.x'
- name: deps/amqp10_client SETUP
if: inputs.plugin == 'amqp10_client'
run: |
# reduce sandboxing so that activemq works
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbit SETUP
if: inputs.plugin == 'rabbit'
run: |
# reduce sandboxing so that maven works
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_auth_backend_ldap SETUP
if: inputs.plugin == 'rabbitmq_auth_backend_ldap'
run: |
sudo apt-get update && \
sudo apt-get install -y \
apparmor-utils \
ldap-utils \
slapd
sudo aa-complain `which slapd`
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_mqtt SETUP
if: inputs.plugin == 'rabbitmq_mqtt'
run: |
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_peer_discovery_consul SETUP
if: inputs.plugin == 'rabbitmq_peer_discovery_consul'
run: |
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_stream SETUP
if: inputs.plugin == 'rabbitmq_stream'
run: |
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_stream_management SETUP
if: inputs.plugin == 'rabbitmq_stream_management'
run: |
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: deps/rabbitmq_tracing SETUP
if: inputs.plugin == 'rabbitmq_tracing'
run: |
cat << EOF >> user.bazelrc
build --strategy=TestRunner=local
EOF
- name: CLI COMPILE WARNINGS AS ERRORS
if: inputs.plugin == 'rabbitmq_cli'
run: |
bazel build //deps/rabbitmq_cli:compile_warnings_as_errors \
--verbose_failures
- name: COMPUTE TESTS IN SHARD
id: shard
run: |
bazelisk cquery \
'tests(//deps/${{ inputs.plugin }}/...) except attr("tags", "manual|mixed-version-cluster", //deps/...)' \
--output=label \
| awk '{print $1;}' > tests.log
split -da 3 -l $((`wc -l < tests.log`/${{ inputs.shard_count }})) tests.log shard
printf -v padded_index "%03d" ${{ inputs.shard_index }}
echo "file=shard$padded_index" | tee -a $GITHUB_OUTPUT
- name: RUN TESTS
if: inputs.plugin != 'rabbitmq_peer_discovery_aws'
run: |
echo "Tests in shard:"
cat ${{ steps.shard.outputs.file }}
echo ""
## WARNING:
## secrets must not be set in --test_env or --action_env,
## or otherwise logs must not be saved as artifacts.
## rabbit_ct_helpers or other code may log portions of the
## env vars and leak them
bazelisk test $(< ${{ steps.shard.outputs.file }}) \
--test_env RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }} \
--build_tests_only \
--verbose_failures
- name: UPLOAD TEST LOGS
if: always()
uses: actions/upload-artifact@v4
with:
name: bazel-testlogs-${{ inputs.plugin }}-${{ inputs.shard_index }}-${{ matrix.erlang_version }}-${{ matrix.metadata_store }}
path: |
bazel-testlogs/deps/${{ inputs.plugin }}/*