git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] ci(github): also mark up compile errors

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 9, 2022, 11:32 UTC
Message-ID
<19d6e34f038121b927cdfacc3c4ae5abd1791415.1654774347.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1253.git.1654774347.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When GCC produces those helpful errors, we will want to present them in the GitHub workflow runs in the most helpful manner. To that end, we want to use workflow commands to render errors and warnings: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

In the previous commit, we ensured that grouping is used for the build in all jobs, and this allows us to piggy-back onto the `group` function to transmogrify the output.

Note: If `set -o pipefail` was available, we could do this in a little
more elegant way. But since some of the steps are run using `dash`, we
have to do a little `{ ...; echo $? >exit.status; } | ...` dance.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 ci/lib.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ci/lib.sh b/ci/lib.sh
index 2f6d9d26e40..b747e34842c 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -29,8 +29,14 @@ else
 		set +x
 		begin_group "$1"
 		shift
-		"$@"
-		res=$?
+		# work around `dash` not supporting `set -o pipefail`
+		{
+			"$@" 2>&1
+			echo $? >exit.status
+		} |
+		sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2 line=\3::\1/'
+		res=$(cat exit.status)
+		rm exit.status
 		end_group
 		return $res
 	}
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Ævar Arnfjörð Bjarmason
Message 3 of 11 in “ci(GitHub): mark up compile errors, too”
  1. 0/2 ci(GitHub): mark up compile errors, tooJohannes Schindelin via GitGitGadget, Jun 9, 2022
  2. 1/2 ci(github): use grouping also in the `win-build` jobJohannes Schindelin via GitGitGadget, Jun 9, 2022
  3. 2/2 ci(github): also mark up compile errorsJohannes Schindelin via GitGitGadget, Jun 9, 2022
  4. Ævar Arnfjörð BjarmasonJun 9, 2022
  5. Junio C HamanoJun 10, 2022
  6. Junio C HamanoJun 9, 2022
  7. 0/2 ci(GitHub): mark up compile errors, tooJohannes Schindelin via GitGitGadget, Jun 13, 2022
  8. 2/2 ci(github): also mark up compile errorsJohannes Schindelin via GitGitGadget, Jun 13, 2022
  9. 1/2 ci(github): use grouping also in the `win-build` jobJohannes Schindelin via GitGitGadget, Jun 13, 2022
  10. Junio C HamanoJun 13, 2022
  11. Ævar Arnfjörð BjarmasonJun 13, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.