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

Use GitHub Actions diagnostics flag in CI #453

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Arlodotexe
Copy link
Member

Using the guidance in https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging, this PR disables verbose diagnostic logging in CI except when "Enable Debug Logging" is checked on a rerun.

@Arlodotexe Arlodotexe self-assigned this Jul 9, 2024
@Arlodotexe
Copy link
Member Author

Found an issue:

The workflow is not valid. .github/workflows/build.yml (Line: 21, Col: 23): Unrecognized named-value: 'env'. Located at position 1 within expression: env.ACTIONS_RUNNER_DEBUG

Docs aren't specific about which variable this is stored in, a search on github suggested env but this seems to not be the case. Will try github instead.

@Arlodotexe Arlodotexe enabled auto-merge (squash) July 9, 2024 22:09
@Arlodotexe
Copy link
Member Author

Let's squash this one.

@Arlodotexe
Copy link
Member Author

Arlodotexe commented Jul 10, 2024

That's odd, the random test failure we usually only see on WinUI 3 has happened on UWP now:

The active test run was aborted. Reason: Unable to communicate with test host process.
Closing app with package full name '7af355f7-0c20-4a39-9b71-8cf779ccfa82_1.0.0.0_x64__1v6rh0sdhj24c'.
Results File: C:\a\Windows\Windows\TestResults\UWP.trx

The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from.
The test running when the crash occurred: 
ConvertersExperiment.Tests.Test_BoolToObjectConverter.Test_ConvertBackCollapseWithNegateTrue

Linking #347 and rerunning.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

So, can we test turning the flag on now that it has run first, where's the checkbox for that?

And then are the logs just the normal logs or are there extras elsewhere we should know about?

.github/workflows/build.yml Outdated Show resolved Hide resolved
@michael-hawker
Copy link
Member

Yeah, so was just checking, it shows up with a confirmation dialog for failed jobs:
image
And all jobs:
image

I'm going to cancel this current run, then re-kick it with the toggle enabled so we can compare the two runs and check it's working as intended. 😊

@michael-hawker
Copy link
Member

Kicked off here: https://github.com/CommunityToolkit/Windows/actions/runs/9896968654 - looking good so far, will see if it picks that up from the env, will be nice to see that off by default to get some brevity back in our builds. We can at least use this to further tweak the amount of output we do too in the future. Nice!

@michael-hawker
Copy link
Member

@Arlodotexe so I see the debug info from GitHub, but it didn't seem to enable the flag?

image

It also feels like even when it's off the msbuild details are pretty huge, should we be minimal by default and on normal or detailed or something when the flag is on?

ENABLE_DIAGNOSTICS: true
# Debug logging enabled via GitHub UI during reruns or set as repo secret.
# See also https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging
ENABLE_DIAGNOSTICS: ${{ github.ACTIONS_RUNNER_DEBUG }}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, doesn't seem to be picking it up, should it just be a straight ACTIONS_RUNNER_DEBUG or secrets.ACTIONS_RUNNER_DEBUG ?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, just found this, it may just be ${{ runner.debug }} https://stackoverflow.com/questions/75434105/how-to-determine-if-the-github-action-is-running-with-debug-logging-enabled

From runner context doc - https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context - this seems to be what corresponds to the checkbox. Not sure what that other doc is about...

We should update the comment too

Copy link
Member Author

@Arlodotexe Arlodotexe Jul 11, 2024

Choose a reason for hiding this comment

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

Looking at the originally linked docs, I think I see why ACTIONS_RUNNER_DEBUG didn't enable verbose logging. From the docs:

Runner diagnostic logging provides additional log files that contain information about how a runner is executing a job. Two extra log files are added to the log archive:

  • The runner process log, which includes information about coordinating and setting up runners to execute jobs.
  • The worker process log, which logs the execution of a job.

Maybe we need to enable step debug logging instead via ACTIONS_STEP_DEBUG, which:

  • increases the verbosity of a job's logs during and after a job's execution.

As for the runner.debug context value, the docs for this seem to point to the same docs used before 🤔

We can try both, but let's start with ACTIONS_STEP_DEBUG and see if that works.

Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
ENABLE_DIAGNOSTICS: ${{ github.ACTIONS_RUNNER_DEBUG }}
ENABLE_DIAGNOSTICS: ${{ github.ACTIONS_STEP_DEBUG }}

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like ACTIONS_STEP_DEBUG didn't do it either, let's try runner.debug then

Copy link
Member Author

Choose a reason for hiding this comment

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

Posted here as well, but runner.debug didn't work as expected. runner isn't recognized.

@michael-hawker
Copy link
Member

@Arlodotexe WinUI 3 tests failed, I'll ask some folks what we can do or who we can ask for more assistance in root causing that for them.

Doesn't look like that flag did anything, though not sure if once checked it remains checked? Or did you kick off a run with it?

Otherwise, we should try the other runner context

@Arlodotexe
Copy link
Member Author

That's odd, I guess docs are outdated? Error message from last run:

[Invalid workflow file: .github/workflows/build.yml#L23](https://github.com/CommunityToolkit/Windows/actions/runs/10085654064/workflow)
The workflow is not valid. .github/workflows/build.yml (Line: 23, Col: 23): Unrecognized named-value: 'runner'. Located at position 1 within expression: runner.debug

ENABLE_DIAGNOSTICS: true
# Debug logging enabled via GitHub UI during reruns or set as repo secret.
# See also https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging
ENABLE_DIAGNOSTICS: ${{ runner.debug }}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is only available in the jobs section where the runner is used? As maybe it's per runner of a job vs. the whole workflow right? Otherwise, we should open an issue on https://github.com/actions/runner/issues as it's clearly listed in the documentation, just not with a great example...

@Arlodotexe Arlodotexe changed the title Use ACTIONS_RUNNER_DEBUG for diagnostics flag Use GitHub Actions diagnostics flag in CI Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants