Problem working with GH workflow file

The single line ending is replaced into whitespace, and the double line ending is replaced into a single line ending in a workflow configuration file. This bug is for Windows runner. I’ve not tested other versions of Windows, but at least in the 2019 version, I had this problem.

This is the part of the workflow file which causes error:


...
        mkdir -p packages
        
        cmake -G "Visual Studio 16 2019" -A x64 -S. -Bbuild \
              -DBUILD_TESTING=true \
              -DDOXYGEN_GENERATE=false \
              -DNO_BUILD=false \
              -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
              -DPACKAGE_TYPE=NIGHTLY \
              -DPACKAGE_GENERATE=true \
              -DPACKAGE_GENERATOR=TGZ \
              -DBUILD_FAT32=true

        cmake --build build --config ${{env.BUILD_TYPE}} --target all_build run_tests
        cd build
        cpack
        cpack -P ZIP
        cpack -P NSIS64
        cp openfsl-* ../packages/
        cd ..
        rm -rf build
...

And the same part in the workflow log:


cmake -G "Visual Studio 16 2019" -A Win32 -S. -Bbuild \ -DBUILD_TESTING=true \ -DDOXYGEN_GENERATE=false \ -DNO_BUILD=false \ -DCMAKE_BUILD_TYPE=Release \ -DPACKAGE_TYPE=NIGHTLY \ -DPACKAGE_GENERATE=true \ -DPACKAGE_GENERATOR=TGZ \ -DBUILD_FAT32=true
  cmake --build build --config Release --target all_build run_tests  cd build  cpack  cpack -P ZIP cpack -P NSIS  cp openfsl-* ../packages/  cd ..  rm -rf build

As you can see, the newline character is replaced into whitespace.

Link to the log

Or is this my mistake?

You are missing a | to make it a literal block that preserves line breaks:

    - name: Build for target x86 with MSVC
      run: 
        cmake ...

It should be run: |

1 Like