Skip to content

Commit e2fd850

Browse files
tzarcrodrigob
authored andcommitted
Add step summary output to CI builds, with failure logs. (qmk#20288)
1 parent aaf5be7 commit e2fd850

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

.github/workflows/ci_builds.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ jobs:
3939
- name: Run `qmk mass-compile` (keymap ${{ matrix.keymap }})
4040
run: |
4141
export NCPUS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
42-
qmk mass-compile -t -j $NCPUS -km ${{ matrix.keymap }}
42+
qmk mass-compile -t -j $NCPUS -km ${{ matrix.keymap }} -e DUMP_CI_METADATA=yes
43+
# Generate the step summary markdown
44+
./util/ci/generate_failure_markdown.sh > $GITHUB_STEP_SUMMARY
45+
# Truncate to a maximum of 1MB to deal with GitHub workflow limit
46+
truncate --size='<960K' $GITHUB_STEP_SUMMARY
4347
4448
- name: 'Upload artifacts'
4549
uses: actions/upload-artifact@v3

builddefs/build_keyboard.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
2929
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
3030
KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE)
3131

32+
ifeq ($(strip $(DUMP_CI_METADATA)),yes)
33+
$(info CI Metadata: KEYBOARD=$(KEYBOARD))
34+
$(info CI Metadata: KEYMAP=$(KEYMAP))
35+
endif
36+
3237
# Force expansion
3338
TARGET := $(TARGET)
3439

util/ci/generate_failure_markdown.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
this_script="$(realpath "${BASH_SOURCE[0]}")"
6+
script_dir="$(realpath "$(dirname "$this_script")")"
7+
qmk_firmware_dir="$(realpath "$script_dir/../../")"
8+
9+
dump_failure_info() {
10+
local failure_file="$1"
11+
local keyboard=$(cat "$failure_file" | grep 'CI Metadata: KEYBOARD=' | cut -d= -f2)
12+
local keymap=$(cat "$failure_file" | grep 'CI Metadata: KEYMAP=' | cut -d= -f2)
13+
echo "## ${keyboard}:${keymap}"
14+
echo "\`\`\`"
15+
cat "$failure_file" | sed -e $'s/\x1b\[[0-9;]*m//g' | grep -v "CI Metadata:" | grep -vP "(Entering|Leaving) directory"
16+
echo "\`\`\`"
17+
}
18+
19+
for failure_file in $(find "$qmk_firmware_dir/.build" -name 'failed.log.*' | sort); do
20+
dump_failure_info "$failure_file"
21+
done

0 commit comments

Comments
 (0)