Skip to content

Commit

Permalink
unittests: fine-tune the check for whether we are in CI
Browse files Browse the repository at this point in the history
The $CI environment variable may be generally set by Github or Gitlab
actions, and is not a reliable indicator of whether we are running "CI".
It could also, for an absolutely random example that didn't *just
happen*, be Alpine Linux's attempt to enable the Meson testsuite in
their packaging, which... uses Gitlab CI.

In this case, we do want to perform normal skipping on not-found
requirements. Instead of checking for $CI, check for $MESON_CI_JOBNAME
as we already use that in all of our own CI jobs for various reasons.

This makes it easier for linux distros to package Meson without
accumulating hacks like "run the testsuite using `env -u CI`".
  • Loading branch information
eli-schwartz authored and nirbheek committed Feb 14, 2022
1 parent 37be39b commit 4274e0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- env:
CPPFLAGS: "-I/usr/local/include"
LDFLAGS: "-L/usr/local/lib"
MESON_CI_JOBNAME: unittests-appleclang
MESON_UNIT_TEST_BACKEND: ninja
# These cannot evaluate anything, so we cannot set PATH or SDKROOT here
run: |
Expand Down
2 changes: 1 addition & 1 deletion unittests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def is_ci():
if 'CI' in os.environ:
if 'MESON_CI_JOBNAME' in os.environ:
return True
return False

Expand Down

0 comments on commit 4274e0f

Please sign in to comment.