Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 7b0642d

Browse files
committed
Collapse Complement CI successful jobs (or try to)
1 parent c99b511 commit 7b0642d

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2022 The Matrix.org Foundation C.I.C.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
import sys
15+
16+
GROUP_START_PREFIX = "::group::"
17+
PASSING_CI_PREFIX = "✅"
18+
GROUP_END_PREFIX = "::endgroup::"
19+
20+
21+
def main() -> None:
22+
in_collapsed_block = False
23+
first_group_name = None
24+
last_group_name = None
25+
buffer = []
26+
27+
def flush_buffer() -> None:
28+
nonlocal buffer, in_collapsed_block
29+
30+
sys.stdout.write(f"::group::{first_group_name} ... {last_group_name}\n")
31+
for buffered_line in buffer:
32+
sys.stdout.write(buffered_line)
33+
34+
sys.stdout.write("::endgroup::\n")
35+
36+
in_collapsed_block = False
37+
buffer = []
38+
39+
for line in sys.stdin:
40+
if line.startswith(GROUP_START_PREFIX):
41+
group_name = line[len(GROUP_START_PREFIX) :]
42+
should_skip_block = group_name.startswith(PASSING_CI_PREFIX)
43+
44+
if in_collapsed_block and not should_skip_block:
45+
flush_buffer()
46+
elif in_collapsed_block and should_skip_block:
47+
last_group_name = group_name
48+
elif not in_collapsed_block and should_skip_block:
49+
first_group_name = group_name
50+
in_collapsed_block = True
51+
52+
if not in_collapsed_block:
53+
sys.stdout.write(line)
54+
55+
flush_buffer()
56+
57+
58+
if __name__ == "__main__":
59+
main()

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ jobs:
347347

348348
- run: |
349349
set -o pipefail
350-
POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
350+
POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt | python3 synapse/.ci/scripts/collapse_complement_logs.py
351351
shell: bash
352352
name: Run Complement Tests
353353
@@ -386,7 +386,7 @@ jobs:
386386

387387
- run: |
388388
set -o pipefail
389-
WORKERS=1 COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
389+
WORKERS=1 COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt | python3 synapse/.ci/scripts/collapse_complement_logs.py
390390
shell: bash
391391
name: Run Complement Tests
392392

0 commit comments

Comments
 (0)