charmbracelet / glow

Render markdown on the CLI, with pizzazz! 💅🏻
MIT License
16.2k stars 353 forks source link

glow 1.5.0 test failure on linux build #454

Open chenrui333 opened 1 year ago

chenrui333 commented 1 year ago

👋 trying to build the latest release, but run into some build issue. The error log is as below:

test failure ``` ==> /home/linuxbrew/.linuxbrew/Cellar/glow/1.5.0/bin/glow test.md Error: glow: failed An exception occurred within a child process: Minitest::Assertion: Expected /\#\ header/ to match "\n\n". ```

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/4009756850/jobs/6885554006 relates to Homebrew/homebrew-core#121337

chenrui333 commented 1 year ago

It is super weird in the sense that we cannot reproduce outside CI.

muesli commented 1 year ago

I assume you're running this with the environment variable CI being set?

Due to some CIs incorrectly emulating a terminal (looking at you CircleCI), we added a check for this env-var, and upon presence assume we're not writing to a proper terminal. This will essentially disable color checks and styled output.

chenrui333 commented 1 year ago

I assume you're running this with the environment variable CI being set?

Due to some CIs incorrectly emulating a terminal (looking at you CircleCI), we added a check for this env-var, and upon presence assume we're not writing to a proper terminal. This will essentially disable color checks and styled output.

yeah, it only happens in the CI (which is essentially github hosted runner with ubuntu 22.04), but when I actually ssh to the runner, and I can actually run tests just fine there.

When you said environment variables need to be configured, what at the environment variables did you refer to?

muesli commented 1 year ago

Try to unset CI manually and see if it behaves: unset CI.

chenrui333 commented 1 year ago

I dont think we have CI set for any of the CI runs.

chenrui333 commented 1 year ago

Is there any way that we can pinpoint that is the issue. Say if I set the CI for my action run (my action run were successful but that was outside the regular homebrew PR flow), I should be able to reproduce it?

iMichka commented 1 year ago

CI is automatically set by Github Actions: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables

chenrui333 commented 1 year ago

it just works when directly running inside the linux runner

runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ env | grep "CI="
CI=true
runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ brew test -d -v  glow
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/glow.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/go.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/shared/git --version
==> Testing glow
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/glow.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gcc@11.rb
==> /home/linuxbrew/.linuxbrew/Cellar/glow/1.5.0/bin/glow test.md
runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$
chenrui333 commented 1 year ago

Same when I did unset CI

runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ unset CI
runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ env | grep "CI="
runner@fv-az357-374:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ brew test -d -v  glow
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/glow.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/go.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/shared/git --version
==> Testing glow
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/glow.rb
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gcc@11.rb
==> /home/linuxbrew/.linuxbrew/Cellar/glow/1.5.0/bin/glow test.md
caarlos0 commented 3 months ago

is this still a problem?

chenrui333 commented 3 months ago

yeah, still an issue per this PR build, https://github.com/Homebrew/homebrew-core/pull/176422

caarlos0 commented 3 months ago

per my tests here, I think this behavior change at some point, so now probably the best bet is to change the test case.

i did make it better respect colorprofiles, but it still will render the bolds and all that, even in ascii.

caarlos0 commented 3 months ago

ah, or you can force no tty:

glow -s notty test.md

CleanShot 2024-07-10 at 16 45 59@2x

chenrui333 commented 3 months ago

good to know, let me update the test :)

chenrui333 commented 3 months ago

still no luck

  ==> /home/linuxbrew/.linuxbrew/Cellar/glow/1.5.1/bin/glow -s notty /tmp/glow-test-20240710-10155-5zgmvy/test.md
  Error: glow: failed
  Error: glow: failed
  An exception occurred within a child process:
    Minitest::Assertion: Expected /\#\ header/ to match "\n\n".
caarlos0 commented 3 months ago

yeah, I think this is still the old version, it should work when the new one is released