Skip to content

Commit 422ef89

Browse files
committed
CI: Enable Erlang problem matchers
In order to get the right subdirectory for GH to find our files we use `sed` to modify paths in the output. We use `pipefail` to make sure failures are propagated. We use `NON_DETERMINISTIC` to make sure our paths are full and not just the file.erl. We disable styling in non-parallel CT runs. This is needed in order to pick up errors. Currently these errors will not be annotated directly in PRs, a pending OTP PR will improve that. Parallel CT runs write GH annotations directly.
1 parent 1c264fa commit 422ef89

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ jobs:
5454
# restricted to the build jobs to avoid duplication in output.
5555
disable_problem_matchers: true
5656

57+
# We install Erlang problem matchers from ci.erlang.mk.
58+
- name: CHECKOUT ERLANG PROBLEM MATCHERS
59+
uses: actions/checkout@v4
60+
with:
61+
repository: ninenines/ci.erlang.mk
62+
path: ci.erlang.mk
63+
64+
- name: INSTALL ERLANG PROBLEM MATCHERS
65+
run: echo "::add-matcher::ci.erlang.mk/.github/matchers/erlang-matchers.json"
66+
5767
- name: MIXED CLUSTERS - FETCH SIGNING KEYS
5868
uses: dsaltares/fetch-gh-release-asset@master
5969
if: inputs.mixed_clusters
@@ -120,7 +130,8 @@ jobs:
120130
if: inputs.plugin != 'rabbitmq_cli'
121131
run: |
122132
sudo netstat -ntp
123-
make -C deps/${{ inputs.plugin }} ${{ inputs.make_target }} RABBITMQ_METADATA_STORE=${{ inputs.metadata_store }}
133+
set -o pipefail
134+
make -C deps/${{ inputs.plugin }} ${{ inputs.make_target }} RABBITMQ_METADATA_STORE=${{ inputs.metadata_store }} NON_DETERMINISTIC=1 | sed "s/src\//deps\/${{ inputs.plugin }}\/src\//" | sed "s/test\//deps\/${{ inputs.plugin }}\/test\//"
124135
125136
- name: CACHE ACTIVEMQ
126137
uses: actions/cache/save@v4

deps/rabbit_common/mk/rabbitmq-early-plugin.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ CT_OPTS += -kernel net_ticktime 5
3636
#
3737
# cth_styledout
3838
# This hook will change the output of common_test to something more
39-
# concise and colored.
39+
# concise and colored. Not used on GitHub Actions except in parallel CT.
4040

41+
ifndef GITHUB_ACTIONS
4142
CT_HOOKS += cth_styledout
43+
endif
4244
TEST_DEPS += cth_styledout
4345

4446
ifdef CONCOURSE

deps/rabbitmq_ct_helpers/src/ct_master_fork.erl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,14 +723,28 @@ master_print_summary_for(Title,List) ->
723723
_ = case List of
724724
[] -> ok;
725725
_ ->
726-
Chars = [
726+
Chars = [[
727+
master_format_gh_anno(Reason),
727728
io_lib:format("Node: ~w~nCase: ~w:~w~nReason: ~p~n~n",
728729
[Node, Suite, FuncOrGroup, Reason])
729-
|| {Node, Suite, FuncOrGroup, Reason} <- List],
730+
] || {Node, Suite, FuncOrGroup, Reason} <- List],
730731
log(all,Title,Chars,[])
731732
end,
732733
ok.
733734

735+
master_format_gh_anno({error, {{exception, Reason, [{Mod, Fun, Arity, Loc}|_]}, _}}) ->
736+
%% We use .github because that file exists in our repository
737+
%% so GH will still put annotations in pull requests even
738+
%% if we don't have the real file name.
739+
File = proplists:get_value(file, Loc, ".github"),
740+
Line = proplists:get_value(line, Loc, 0),
741+
io_lib:format("::error file=~s,line=~b::~w:~tw/~b: ~w~n",
742+
[File, Line, Mod, Fun, Arity, Reason]);
743+
master_format_gh_anno(Reason) ->
744+
%% Do the bare minimum if we don't know the error reason.
745+
io_lib:format("::error file=.github,line=0::~w~n",
746+
[Reason]).
747+
734748
update_queue(take,Node,From,Lock={Op,Resource},Locks,Blocked) ->
735749
%% Locks: [{{Operation,Resource},Node},...]
736750
%% Blocked: [{{Operation,Resource},Node,WaitingPid},...]

0 commit comments

Comments
 (0)