diff options
author | Nick Brassel <nick@tzarc.org> | 2023-03-29 15:55:31 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 15:55:31 +1100 |
commit | 6bdbf77238166e25eb0888c85ad07f0b7dbf16bc (patch) | |
tree | 56533eb326b78411bf3b56621d5e9feb9f1702dd | |
parent | e2630f9b407fb27fab9b2d3e78849611ecb7bdfb (diff) |
Add step summary output to CI builds, with failure logs. (#20288)
-rw-r--r-- | .github/workflows/ci_builds.yml | 6 | ||||
-rw-r--r-- | builddefs/build_keyboard.mk | 5 | ||||
-rwxr-xr-x | util/ci/generate_failure_markdown.sh | 21 |
3 files changed, 31 insertions, 1 deletions
diff --git a/.github/workflows/ci_builds.yml b/.github/workflows/ci_builds.yml index 4dd4aec46a..92659f304d 100644 --- a/.github/workflows/ci_builds.yml +++ b/.github/workflows/ci_builds.yml @@ -39,7 +39,11 @@ jobs: - name: Run `qmk mass-compile` (keymap ${{ matrix.keymap }}) run: | export NCPUS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null) - qmk mass-compile -t -j $NCPUS -km ${{ matrix.keymap }} + qmk mass-compile -t -j $NCPUS -km ${{ matrix.keymap }} -e DUMP_CI_METADATA=yes + # Generate the step summary markdown + ./util/ci/generate_failure_markdown.sh > $GITHUB_STEP_SUMMARY + # Truncate to a maximum of 1MB to deal with GitHub workflow limit + truncate --size='<960K' $GITHUB_STEP_SUMMARY - name: 'Upload artifacts' uses: actions/upload-artifact@v3 diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index 7a5412ccd2..5fd61a96ce 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -29,6 +29,11 @@ KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD)) TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP) KEYBOARD_OUTPUT := $(BUILD_DIR)/obj_$(KEYBOARD_FILESAFE) +ifeq ($(strip $(DUMP_CI_METADATA)),yes) + $(info CI Metadata: KEYBOARD=$(KEYBOARD)) + $(info CI Metadata: KEYMAP=$(KEYMAP)) +endif + # Force expansion TARGET := $(TARGET) diff --git a/util/ci/generate_failure_markdown.sh b/util/ci/generate_failure_markdown.sh new file mode 100755 index 0000000000..5f21f06856 --- /dev/null +++ b/util/ci/generate_failure_markdown.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +this_script="$(realpath "${BASH_SOURCE[0]}")" +script_dir="$(realpath "$(dirname "$this_script")")" +qmk_firmware_dir="$(realpath "$script_dir/../../")" + +dump_failure_info() { + local failure_file="$1" + local keyboard=$(cat "$failure_file" | grep 'CI Metadata: KEYBOARD=' | cut -d= -f2) + local keymap=$(cat "$failure_file" | grep 'CI Metadata: KEYMAP=' | cut -d= -f2) + echo "## ${keyboard}:${keymap}" + echo "\`\`\`" + cat "$failure_file" | sed -e $'s/\x1b\[[0-9;]*m//g' | grep -v "CI Metadata:" | grep -vP "(Entering|Leaving) directory" + echo "\`\`\`" +} + +for failure_file in $(find "$qmk_firmware_dir/.build" -name 'failed.log.*' | sort); do + dump_failure_info "$failure_file" +done |