Hi folks,
I’ve set up a runner on WIndows 10 with shell=powershell. In the gitlab-ci.yml I’m trying to invoke a command split over multiple lines. With powershell, you’re supposed to use the backtick (`) as the escape character, but it’s not working. For example, this build log, where the -G option is on a separate line, resulting in the error “Unexpected token ‘-G’ in expression or statement.”.
What’s the recommended way of doing multi-line commands in the YAML format? I thought the “- |” block I was using would be fine. Is there a better way to do things?
.win_configure: &win_configure
before_script:
- |
$ErrorActionPreference = "Stop"
cmd /c "call %VCVARSALL% & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
git clean -dxf
mkdir b
cd b
"$env:CMAKE" `
-G "$env:BUILD_SYSTEM" `
"-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE" `
"-DCMAKE_PREFIX_PATH:PATH=$env:CI_PROJECT_DIR/deps/dist" `
"-DCMAKE_INSTALL_PREFIX:PATH=$env:CI_PROJECT_DIR/dist" `
"-Ddoxygen:BOOL=$env:BUILD_DOXYGEN" `
"-Dextended-tests:BOOL=$env:BUILD_EXTENDED_TESTS" `
"-Dsphinx:BOOL=$env:BUILD_SPHINX" `
$env:DOXYGEN_TAGS `
"-DGTEST_ROOT:PATH=$env:GTEST_ROOT" `
..
Thanks all,
Roger