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

Log if tests are running in CI (rather than on local developer laptop) #27709

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Jan 9, 2025

This change follows on from #26973 - I was trying to work out how the Frontend test suite varies its behaviour between running locally on a developer's machine, and running in CI on GitHub Runner (there are some critical differences in behaviour, ie around the test database resources, where missing database resources should not be tolerated in CI, but should be freshly downloaded if missing in local development) - I couldn't work out where the CI="true" environment variable was coming from, and I thought maybe it wasn't being set, which was alarming!

@cemms1 kindly pointed me to the relevant documentation, which explains that the default environment variable CI is always set to true in GitHub Runners.

image

To make this a little clearer, I'm changing the code now to log an informative statement if we're running the tests in CI:

image

This message does not appear when running locally in a non-CI environment, to avoid exposing developers to unnecessary noise.

This change follows on from #26973, I was
trying to work out how the Frontend test suite varies its behaviour between running
locally on a developer's machine, and running in CI on GitHub Runner (there are some
critical differences in behaviour, ie around the test database resources, where missing
database resources should *not* be tolerated in CI, but should be freshly downloaded
if missing in local development) - I couldn't work out where the `CI="true"` environment
variable was coming from, and I thought maybe it wasn't getting set, which was alarming!

Charlotte Emms kindly pointed me to the relevant documentation, which explains that
the default environment variable `CI` is always set to true in GitHub Runners:

https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables

To make this a little clearer, I'm changing the code now to log an informative statement
if we're running the tests in CI.
@rtyley rtyley marked this pull request as ready for review January 9, 2025 16:24
@rtyley rtyley requested a review from a team as a code owner January 9, 2025 16:24
@prout-bot
Copy link
Collaborator

Seen on FRONTS-PROD, ADMIN-PROD (merged by @rtyley 11 minutes and 59 seconds ago)

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.

3 participants