From 4274e0f42a9673df981dd7a7a456f4d4fcfe5452 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 31 Jan 2022 15:59:16 -0500 Subject: unittests: fine-tune the check for whether we are in CI 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`". --- .github/workflows/macos.yml | 1 + unittests/helpers.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d60244be4..8b60b7584 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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: | diff --git a/unittests/helpers.py b/unittests/helpers.py index bf06bdc13..0945384bf 100644 --- a/unittests/helpers.py +++ b/unittests/helpers.py @@ -17,7 +17,7 @@ from run_tests import get_fake_env def is_ci(): - if 'CI' in os.environ: + if 'MESON_CI_JOBNAME' in os.environ: return True return False -- cgit v1.2.3