Open asmeurer opened 4 weeks ago
The relevant code is
My assumption is that it fails because CI is not a TTY. But as you say, perhaps we can improve this logic.
A
Here is the logic from a Rust package https://github.com/zkat/is_ci/blob/main/src/lib.rs
This is used in the Rust supports-color package https://github.com/zkat/supports-color/blob/main/src/lib.rs
Describe the bug
This is a spinoff of https://github.com/sphinx-doc/sphinx/issues/13056
I have to add FORCE_COLOR=1 to my Makefile to force color output on CircleCI and GitHub Actions.
Here is an example of a build with the default options and no color output: https://github.com/Quansight-Labs/ndindex/actions/runs/11253438088/job/31288699625
Here is an example where I've set FORCE_COLOR=1 (from a different project): https://github.com/sympy/sympy/actions/runs/11484600101/job/31963800399
The color output makes things much easier to read, especially if there is a warning or error printed in red.
How to Reproduce
Run a Sphinx build on GitHub Actions
Environment Information
Sphinx extensions
No response
Additional context
We should investigate why this happens. It isn't clear to me if this is just a limitation of CI systems or if there is something else at play here. What do other tools that output color on CI do? Are they manually enabling color when they detect they are on GitHub Actions? Is the fact that Sphinx is run through
make
relevant?Obviously we don't want to unconditionally enable color output in Sphinx, especially when the output is a pipe.