Skip to content

Commit ce012c4

Browse files
Fix script and add verbose output
1 parent 9896c24 commit ce012c4

File tree

7 files changed

+32
-11
lines changed

7 files changed

+32
-11
lines changed

.github/workflows/test-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Collect test results
2020
id: test-results
21-
run: python scripts/test_ebuilds.py --collect-test-results --from-event
21+
run: python scripts/test_ebuilds.py -v --collect-test-results --from-event
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424

.github/workflows/test-ebuilds.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Build test matrix
5353
id: build-matrix
5454
run: |
55-
args=(--build-test-matrix)
55+
args=(-v --build-test-matrix)
5656
if [[ "${{ github.event_name == 'workflow_run' }}" == "true" ]]; then
5757
args+=(--new-ebuilds ${{ github.event.workflow_run.head_sha }} ${{ steps.resolve-refs.outputs.commit_hash }})
5858
else
@@ -94,7 +94,7 @@ jobs:
9494

9595
- name: Collect test results
9696
id: collect-test-results
97-
run: python scripts/test_ebuilds.py --collect-test-results
97+
run: python scripts/test_ebuilds.py -v --collect-test-results
9898
env:
9999
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100100

@@ -122,7 +122,7 @@ jobs:
122122

123123
- name: Prune ebuilds
124124
run: |
125-
python scripts/update_ebuilds.py --prune --prune-checked --commit --step-summary
125+
python scripts/update_ebuilds.py -v --prune --prune-checked --commit --step-summary
126126
git push
127127
env:
128128
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Collect test results
2020
id: test-results
21-
run: python scripts/test_ebuilds.py --collect-test-results --from-event
21+
run: python scripts/test_ebuilds.py -v --collect-test-results --from-event
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424

.github/workflows/test-stable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: Collect test results
2020
id: test-results
21-
run: python scripts/test_ebuilds.py --collect-test-results --from-event
21+
run: python scripts/test_ebuilds.py -v --collect-test-results --from-event
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424

.github/workflows/update-ebuilds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Update ebuilds
3333
id: update-ebuilds
3434
run: |
35-
python scripts/update_ebuilds.py --update --commit --step-summary
35+
python scripts/update_ebuilds.py -v --update --commit --step-summary
3636
git push
3737
3838
- name: Store HEAD commit hash

scripts/test_ebuilds.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ def build_test_matrix(mode, commits=None):
6363
key=lambda ebuild: [os.path.dirname(ebuild)] + version_key(ebuild)
6464
)
6565
name_to_channel = {
66-
f"www-client/{name}/": channel
66+
f"www-client/{make_name_from_channel(channel)[0]}/": channel
6767
for channel in CHANNELS
68-
for name, _ in make_name_from_channel(channel)
6968
}
7069

7170
for ebuild in new_ebuilds:
@@ -80,7 +79,7 @@ def build_test_matrix(mode, commits=None):
8079
else:
8180
raise ValueError(f"Invalid mode '{mode}'.")
8281

83-
set_output("test_matrix", json.dumps(matrix))
82+
return matrix
8483

8584

8685
def main():
@@ -115,17 +114,28 @@ def main():
115114
action="store_true",
116115
help="Obtain run ID from workflow_run event.",
117116
)
117+
parser.add_argument(
118+
"--verbose", "-v",
119+
action="store_true",
120+
help="Enable verbose output.",
121+
)
118122
args = parser.parse_args()
119123

120124
require_gha()
121125

122126
if args.build_test_matrix:
123127
mode = "new-ebuilds" if args.new_ebuilds else "latest-ebuilds"
124-
build_test_matrix(mode, commits=args.new_ebuilds or None)
128+
test_matrix = build_test_matrix(mode, commits=args.new_ebuilds or None)
129+
set_output("test_matrix", json.dumps(test_matrix))
130+
if args.verbose:
131+
print(json.dumps(test_matrix, indent=2))
132+
125133

126134
if args.collect_test_results:
127135
test_results = collect_test_results(from_event=args.from_event)
128136
set_output("test_results", json.dumps(test_results))
137+
if args.verbose:
138+
print(json.dumps(test_results, indent=2))
129139

130140

131141
if __name__ == "__main__":

scripts/update_ebuilds.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import argparse
77
import glob
88
import hashlib
9+
import json
910
import os
1011
import shutil
1112
import subprocess
@@ -278,6 +279,12 @@ def main():
278279
action="store_true",
279280
help="Write a GitHub step summary.",
280281
)
282+
parser.add_argument(
283+
"--verbose",
284+
"-v",
285+
action="store_true",
286+
help="Enable verbose output.",
287+
)
281288
args = parser.parse_args()
282289

283290
new_ebuilds = None
@@ -286,13 +293,17 @@ def main():
286293

287294
if args.update:
288295
new_ebuilds = update_ebuilds(repo_dir=repo_dir, commit_changes=args.commit)
296+
if args.verbose:
297+
print(json.dumps(new_ebuilds, indent=2))
289298

290299
if args.prune:
291300
pruned_ebuilds = prune_ebuilds(
292301
repo_dir=repo_dir,
293302
commit_changes=True,
294303
successful_channels_only=args.prune_checked,
295304
)
305+
if args.verbose:
306+
print(json.dumps(pruned_ebuilds, indent=2))
296307

297308
if args.step_summary:
298309
write_step_summary(new_ebuilds, pruned_ebuilds)

0 commit comments

Comments
 (0)