Your question relates to the YAML language standard, which is used in the configuration files of many CI/CD systems, including Travis CI, GitLab CI, GitHub Actions, and others. However, it's worth noting that not all CI/CD systems support the YAML standard fully, and they might also add their own extensions.
YAML has special block styles for handling line breaks. In your case, the folded block style, denoted by the “>
” symbol might be useful. It allows long lines to be broken up for readability while retaining the semantics of the original long line. Here's an example:
script:
- >
valgrind
--read-var-info=yes
--error-exitcode=1
--fullpath-after=
--track-origins=yes
--leak-check=full
--num-callers=20
--suppressions=$(pwd)/tests/zephir_parser.3.7.0.sup
$(phpenv which php)
-d variables_order=EGPCS
run-tests.php
-p $(which php)
-d extension=$(pwd)/modules/zephir_parser.so
-d variables_order=EGPCS
-g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP"
--offline
--show-diff
--set-timeout 120
In this style, each line break is replaced with a space. Indentation in each line will be ignored. A line break will be inserted at the end.
Note: The backslash “\
” must not be used here, as it will be treated as a line continuation. Thus, the following example is wrong:
script:
- >
valgrind \ # this line wrong
--read-var-info=yes
Otherwise it will be treated as valgrind \ --read-var-info=yes
.
However, it's important to note that different CI/CD systems may have their peculiarities in processing configuration files. For instance, GitHub Actions uses a line folding style (“>-
”), which allows long lines to be placed on multiple lines, but processes them as a single line. Here's an example:
- name: Configure (x64 Debug)
run: >-
cmake
-S .
-Bbuild
-DCMAKE_BUILD_TYPE=Debug
-DCPPCHECK=ON
-DWARNINGS_AS_ERRORS=ON
-DCMAKE_INSTALL_PREFIX=/opt/my-program
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
In this case, after processing, all lines are concatenated into one.
Note: With line folding lines are left aligned, using the same indentation at the beginning of the line.