Today I have a tip for your CI. I learned this tip from Jan Mikes.
A small tip that made my everyday work with CI more colorful.
phpunit.xml
?<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<!-- ... -->
</phpunit>
...but still missing the colored output?
For many years I've run Travis, Gitlab, and now Github Actions. I never knew the output could be readable for humans, so I always looked at the final checkmark for all the scripts.
It was ✅ or ❌.
When the CI runs the scripts:
scripts:
- composer install
- composer fix-cs
This was usually the output:
The colors came to my life. I could read again, and the output was the same as in local environment!
What happened? Did they fix something on Github Actions? Or composer (and all the other tools were) was fixed?
No, just one new word appeared:
scripts:
- - composer install
+ - composer install --ansi
{
"scripts": {
- "fix-cs": "vendor/bin/ecs check --fix"
+ "fix-cs": "vendor/bin/ecs check --fix --ansi"
}
}
Since then, I enjoy failed CI jobs more and find faster what went wrong.
Happy coding!
Do you learn from my contents or use open-source packages like Rector every day?
Consider supporting it on GitHub Sponsors.
I'd really appreciate it!