epics-base / ci-scripts

Continuous Integration Scripts for EPICS Modules
Other
8 stars 18 forks source link

enable compiler color output if available #79

Closed dirk-zimoch closed 1 year ago

dirk-zimoch commented 1 year ago

Newer gcc and clang support colored warning and error messages. This makes it easier to find warning in the bulk of make output. Unfortunately, this is disabled by default in a CI environment like github workers, because the compiler only colorizes its output to a terminal, which is not the case here. But it can be enabled explicitly with the flag-fdiagnostics-color in both, gcc and clang, provided the compiler is new enough to support colors.

This merge requests enables the -fdiagnostics-colors flag if the (cross) compiler supports it. This is tested at the end of CONFIG, after the (cross) compiler has been set up. If other compilers support other flags to enable colors, those may be added later.

I have added this feature in this ci-scripts repo only and not in EPICS base, because I do not want to add -fdiagnostics-colors to "normal" compilations in user's environments, because they may break if color is added unexpectedly.

To see this feature in action, see https://github.com/epics-base/ci-scripts/actions/runs/5044562166/jobs/9047768964?pr=79#step:4:217 or my EPICS base run with this change enabled: https://github.com/dirk-zimoch/epics-base/actions/runs/5044238284

dirk-zimoch commented 1 year ago

Colors could be tuned setting the GCC_COLORS environment variable, if desired.

anjohnson commented 1 year ago

Core group: This looks okay, approved.

dirk-zimoch commented 1 year ago

Error free builds of EPICS base using this feature are here: 7.0: https://github.com/dirk-zimoch/epics-base/actions/runs/5044238284 3.15: https://github.com/dirk-zimoch/epics-base/actions/runs/5070554989