I’ve recently tried using Travis CI for Windows to build and test a C++ project.
While I got it to work, I’m struggling a bit with cleaning up the configuration and would appreciate help.
Here’s my current .yml file: https://github.com/zeux/meshoptimizer/blob/travis-windows/.travis.yml
Here’s the things I don’t like about it:
-
The script section is trying to combine two different scripts in one and looks horrible. I don’t want to use multi-line bash blocks because then Travis will consider each block as an atomic unit of execution and will, for example, time them separately. Is there a way to more cleanly split two different script invocations? I tried using conditional stages but couldn’t get them to work for some reason.
-
I’m forced to use
language: sh
instead ofcpp
because Windows doesn’t supportcpp
. Is there a way to still uselanguage: cpp
for Linux/macOS? -
The build matrix specification is weird. I need to exclude the default “windows” job to be able to add two new ones with custom macros. Can I just specify the matrix manually without having to remove default jobs?
The most important point I’d like help on is the first one. I tried defining stages like “script_unix” and “script_win” and conditionally including them based on the value of os
but I couldn’t get it to work with no errors and I’m not sure how to debug this.
edit: After reading documentation a few more times I now understand that I was confusing phases and stages. Phases don’t seem configurable in any way that is per OS or job. I could replicate the scripts in job setup but then I have to copy & paste their contents (if I still want Travis to individually execute and time separate lines). I’m beginning to think that this problem doesn’t have a solution, sadly.