Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group GitHub Actions logging messages #235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SimonLiu423
Copy link
Contributor

@SimonLiu423 SimonLiu423 commented Mar 6, 2025

Previously, the workflow used to test the code does not group log messages, possibly making the output too lengthy and hard to scroll on the web. Especially the logs generated by dudect/fixture.c, although it shows perfectly fine on local machines by rewriting previous lines in the terminal, github actions does not seem to support it.

The log grouping is done by adding ::group::{title} and ::endgroup:: which are mentioned in github docs. Another argument --group-output is added to scripts/driver.py to optionally enable grouping. Added another target test_ga in Makefile and replaced make test with it in github workflow. ("ga" is the abbreviation for "github actions")

@SimonLiu423 SimonLiu423 force-pushed the cicd/group-test-output branch from 6ba228c to 2fa9dde Compare March 6, 2025 10:34
Previously, the workflow used to test the code does not group log
messages, possibly making the output too lengthy and hard to scroll on
the web. Especially the logs generated by dudect/fixture.c, although
it shows perfectly fine on local machines by rewriting previous lines
in the terminal, github actions does not seem to support it.

The log grouping is done by adding "::group::{title}" and
"::endgroup::" which are mentioned in github docs. Another argument
"--group-output" is added to "scripts/driver.py" to optionally enable
grouping. Added another target "test_ga" in "Makefile" and replaced
"make test" with it in github workflow. ("ga" is the abbreviation for
"github actions")

Link: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#grouping-log-lines
Change-Id: I77d4455967b6d7e1d118049d91e67346f6dcdc1a
@SimonLiu423 SimonLiu423 force-pushed the cicd/group-test-output branch from 2fa9dde to 8ed2959 Compare March 12, 2025 07:02
Target "test_ga" for dedicated test workflow is removed. Instead, check
if environment variable GITHUB_ACTIONS is set to detect which
environment is running the test.

GITHUB_ACTIONS is set to "true" automatically when running CI workflow
on github actions. It is documented in the link below.

Link: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
Change-Id: I9359514623d96dfa387524a67c9de34d94b87c5c
@SimonLiu423 SimonLiu423 force-pushed the cicd/group-test-output branch from 8ed2959 to 46cad73 Compare March 12, 2025 07:08
@SimonLiu423 SimonLiu423 requested a review from jserv March 12, 2025 07:15
Comment on lines +65 to +69
$(Q)if [ -n "$$GITHUB_ACTIONS" ]; then \
scripts/driver.py -c --group-output; \
else \
scripts/driver.py -c; \
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this. The test driver should be aware of the environments.

@jserv jserv changed the title Group github action log lines Group GitHub Actions logging messages Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants