github-action icon indicating copy to clipboard operation
github-action copied to clipboard

Logging: add folding sections for each stage

Open danielbeardsley opened this issue 3 years ago • 2 comments

Github actions supports creating folding and collapsing sections of the log via specially formatted log lines. They provide functions to spt these out.

Here, we wrap each major stage in a folding log section. This enables a viewer to more easily skip (collapse) sections that aren't currently of interest. This is especially helpful if the build command is verbose for instance.

danielbeardsley avatar Jan 21 '22 22:01 danielbeardsley

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 21 '22 22:01 CLAassistant

i would love to see this change merged - would really help with log noise during debugging

jazanne avatar Jun 01 '22 19:06 jazanne

It's a simple change that significantly improves the logs when using this action.

danielbeardsley avatar Jan 17 '23 05:01 danielbeardsley

Cool @danielbeardsley! Can you link this working in an action run to confirm a visual?

jaffrepaul avatar Jan 19 '23 16:01 jaffrepaul

We don't use cypress any more on this project, but folded sections in the logs look like this (an unrelated project):

image

danielbeardsley avatar Jan 19 '23 23:01 danielbeardsley

branch iFixit/github-action/tree/group-logs is showing that it is 282 commits behind the master branch. It should be rebased on master so that current checks are run.

(It seems that there is no branch protection with the setting "Require branches to be up to date before merging" enabled. That would be something to consider in general.)

It would be good to have a test case to run this against to show logs before this PR and logs after. That would mean something which exercises the following code:

logGroup("Restore cache and install", installMaybe)
  .then(logGroup("Build", buildAppMaybe))
  .then(logGroup("Start Servers", startServersMaybe))
  .then(logGroup("Wait...", waitOnMaybe))
  .then(logGroup("Running tests", runTests))

@danielbeardsley Are you thinking of providing more contribution here or do you want to hand over?

MikeMcC399 avatar Jan 23 '23 13:01 MikeMcC399

I've rebased on master, but I'm kinda done here as we don't use cypress at the moment. So, if anyone wants to pick this up and add a test, please do so.

danielbeardsley avatar Jan 23 '23 17:01 danielbeardsley

@danielbeardsley

I was interested to see this working, so I processed your source file https://github.com/iFixit/github-action/blob/group-logs/index.js with

npm run format
npm run build

which puts it into https://github.com/cypress-io/github-action/blob/master/dist/index.js where it can run.

I then ran the .github/workflows/example-basic.yml workflow against it.

The results are in https://github.com/MikeMcC399/github-action/actions/runs/3989854574 and unfortunately it fails

image

Is there somebody who could pick up this PR and get it working?

MikeMcC399 avatar Jan 23 '23 19:01 MikeMcC399

  • The dist/index.js in this PR, which is what is used for the test execution, is unchanged. Therefore the PR checks are passing. This is misleading.

  • See issue https://github.com/cypress-io/github-action/issues/706 proposing a check for this problem.

MikeMcC399 avatar Jan 23 '23 19:01 MikeMcC399

@danielbeardsley

Thank you for continuing with this effort! I did copy your commit to try it again and it now fails in a different place. 🙁

The PR is in any case incomplete. It needs:

npm run format
npm run build

to be executed locally on Ubuntu and the results committed to the PR branch.

MikeMcC399 avatar Jan 24 '23 07:01 MikeMcC399

@danielbeardsley

Have you decided if you want to continue with this PR?

It does need /dist/index.js to be updated with the npm run format / npm run build commands. To test the results automatically you would need to be approved by @jaffrepaul so that the workflows can run their tests. Based on my results, when I copied your changes, the tests will fail.

If you don't want to continue, then I would suggest to either set the PR to Draft state in the hope that somebody else might volunteer to pick it up, or close it.

MikeMcC399 avatar Jan 30 '23 10:01 MikeMcC399

Sorry, yes, I'm quite busy, I don't want to invest more time into this. Anyone is welcome to pick it up.

Seems like I can't make it into a draft (only repo owners can do it)

danielbeardsley avatar Jan 30 '23 17:01 danielbeardsley

@danielbeardsley

Seems like I can't make it into a draft (only repo owners can do it)

You should be able to change the status to Draft (see Converting a pull request to a draft) since you are the Author of the PR.

"People with write permissions to a repository and pull request authors can change the stage of a pull request."

MikeMcC399 avatar Jan 30 '23 17:01 MikeMcC399

Closing.

There hasn't been any progress made on this PR in the last 10 months. It is still incomplete and non-working.

Perhaps somebody will be able to base a new PR on this idea in the future?

MikeMcC399 avatar Nov 05 '23 18:11 MikeMcC399