From 23e048793401900c8d1768b4ffb0fc4ff623ef3e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 17 May 2024 15:13:11 -0400 Subject: ci: Surface compiler warnings/errors as GitHub actions messages --- .github/diag.sh | 16 ++++++++++++++++ .github/workflows/ci.yml | 14 +++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) create mode 100755 .github/diag.sh diff --git a/.github/diag.sh b/.github/diag.sh new file mode 100755 index 0000000..942487a --- /dev/null +++ b/.github/diag.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Copyright © Tavian Barnes +# SPDX-License-Identifier: 0BSD + +# Convert compiler diagnostics to GitHub Actions messages +# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message + +set -eu + +filter() { + sed -E 's/^(([^:]*):([^:]*):([^:]*): (warning|error): (.*))$/::\5 file=\2,line=\3,col=\4,title=Compiler \5::\6\ +\1/' +} + +"$@" 2> >(filter >&2) | filter diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d4196e..8011224 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - name: Run tests run: | - make -j$(nproc) distcheck + .github/diag.sh make -j$(nproc) distcheck - uses: actions/upload-artifact@v4 with: @@ -63,7 +63,7 @@ jobs: - name: Run tests run: | jobs=$(sysctl -n hw.ncpu) - make -j$jobs distcheck + .github/diag.sh make -j$jobs distcheck freebsd: name: FreeBSD @@ -87,7 +87,7 @@ jobs: pkgconf \ tcl-wrapper sudo mount -t fdescfs none /dev/fd - make -j$(nproc) distcheck + .github/diag.sh make -j$(nproc) distcheck - uses: actions/upload-artifact@v4 with: @@ -116,7 +116,7 @@ jobs: oniguruma jobs=$(sysctl -n hw.ncpu) ./configure MAKE=gmake - gmake -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" + .github/diag.sh gmake -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" - uses: actions/upload-artifact@v4 with: @@ -146,7 +146,7 @@ jobs: tcl-expect jobs=$(sysctl -n hw.ncpu) ./configure - make -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" + .github/diag.sh make -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" - uses: actions/upload-artifact@v4 with: @@ -182,7 +182,7 @@ jobs: chown -R action:action . jobs=$(sysctl -n hw.ncpu) sudo -u action ./configure - sudo -u action make -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" + sudo -u action .github/diag.sh make -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" - uses: actions/upload-artifact@v4 with: @@ -219,7 +219,7 @@ jobs: chown -R action:staff . jobs=$(getconf NPROCESSORS_ONLN) sudo -u action ./configure MAKE=gmake - sudo -u action gmake -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" + sudo -u action .github/diag.sh gmake -j$jobs check TEST_FLAGS="--sudo --verbose=skipped" - uses: actions/upload-artifact@v4 with: -- cgit v1.2.3