Skip to content

Commit c4683c4

Browse files
Enable verbose debugging when github actions etc. requests it (#59551)
1 parent bcb9a92 commit c4683c4

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Command-line option changes
3131
* The `JULIA_CPU_TARGET` environment variable now supports a `sysimage` keyword to match (or extend) the CPU target used to build the current system image ([#58970]).
3232
* The `--code-coverage=all` option now automatically throws away sysimage caches so that code coverage can be accurately measured on methods within the sysimage. It is thrown away after startup (and after startup.jl), before any user code is executed ([#59234])
3333
* New `--trace-eval` command-line option to show expressions being evaluated during top-level evaluation. Supports `--trace-eval=loc` or just `--trace-eval` (show location only), `--trace-eval=full` (show full expressions), and `--trace-eval=no` (disable tracing). Also adds `Base.TRACE_EVAL` global control that takes priority over the command-line option and can be set to `:no`, `:loc`, `:full`, or `nothing` (to use command-line setting). ([#57137])
34+
* Julia now automatically enables verbose debugging options (`--trace-eval` and `JULIA_TEST_VERBOSE`) when CI debugging has been triggered. i.e. via the "debug logging" UI toggle is enabled on github actions re-runs. Other platforms are supported too ([#59551])
3435

3536
Multi-threading changes
3637
-----------------------

base/client.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,20 @@ function exec_options(opts)
236236
global have_color = colored_text(opts)
237237
global is_interactive = (opts.isinteractive != 0)
238238

239+
# Enable verbose debugging options when requested by other frameworks
240+
debug_env_vars = (
241+
"RUNNER_DEBUG", # github actions when UI "debug logging" is enabled
242+
"CI_DEBUG_TRACE", # gitlab CI when UI "debug" toggle is enabled
243+
"SYSTEM_DEBUG", # azure pipelines when UI "System diagnostics" is enabled
244+
)
245+
for v in debug_env_vars
246+
if get_bool_env(v, false)
247+
Base.TRACE_EVAL = Base.TRACE_EVAL === :full ? :full : :loc # Enable --trace-eval (location only)
248+
ENV["JULIA_TEST_VERBOSE"] = "true" # Set JULIA_TEST_VERBOSE for this session
249+
break
250+
end
251+
end
252+
239253
# pre-process command line argument list
240254
arg_is_program = !isempty(ARGS)
241255
repl = !arg_is_program

doc/src/manual/environment-variables.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,15 @@ A few special features are supported:
537537

538538
Enable debug logging for a file or module, see [`Logging`](@ref man-logging) for more information.
539539

540+
### CI Debug Environment Variables
541+
542+
Julia automatically enables verbose debugging options when certain continuous integration (CI) debug environment variables are set. This improves the debugging experience when CI jobs are re-run with debug logging enabled, by automatically:
543+
544+
- Enabling `--trace-eval` (location mode) to show expressions being evaluated
545+
- Setting `JULIA_TEST_VERBOSE=true` to enable verbose test output
546+
547+
This allows developers to get detailed debugging information from CI runs without modifying their scripts or workflow files.
548+
540549
### [`JULIA_PROFILE_PEEK_HEAP_SNAPSHOT`](@id JULIA_PROFILE_PEEK_HEAP_SNAPSHOT)
541550

542551
Enable collecting of a heap snapshot during execution via the profiling peek mechanism.

0 commit comments

Comments
 (0)