Have the $CI environment variable set by default

Many continuous integration services like GitLab and Travis-CI have the $CI environment variable set in their execution environments. Some tools such as Python pipenv for example will check for the presence of the $CI variable and automatically configure settings approriate for a CI runtime environment.

10 Likes

+1

Some tests should only be run on CI, others never on CI. Some tests should only selected or not on certain CIs.

Please include one called CI plus another to identify as GitHub Actions.

Here’s a summary of the truthy env vars from some popular CIs:

  • AppVeyor: CI, APPVEYOR
  • Azure Pipelines: TF_BUILD
  • CircleCI: CI, CIRCLECI
  • GitLab CI/CD: CI, CI_SERVER, GITLAB_CI
  • Travis CI: CI, CONTINUOUS_INTEGRATION, TRAVIS

Docs:

3 Likes

We already have GITHUB_ACTIONS, GITHUB_WORKFLOW, GITHUB_WORKSPACE, GITHUB_SHA, and about a dozen of others to make sure we’re running under GitHub, so this part is covered IMHO. Only CI is missing :slight_smile:

3 Likes

Thanks, CI would still be good.

Here’s the docs about those (and it’s GITHUB_ACTION without an S):

https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables

There’s two distinct values here.  GITHUB_ACTION is the name of the action that’s running, if any (and there may not be one).  GITHUB_ACTIONS is always set to show that you’re running within GitHub Actions.

3 Likes

Thanks for clarifying. Please could you add GITHUB_ACTIONS to the the docs?

https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables

2 Likes

Yes, an update is coming soon.  Thanks!

2 Likes