I'm the asker of the question, and here are things I learned from this journey.
Don't waste your time trying to get travis CI to work locally. You'd be super-lucky to have travis-build (which is the library that converts travis scripts to bash) work with no problems for you. But it doesn't have to. For me I got ruby library errors out of the blue and couldn't debug it (maybe this is my ruby ignorance, but this depends on how much you want to invest debugging travis-build, if you can, because my error seemed to be not something I can fix).
The bottom line is: Just live with creating a new branch on github and push your work to it to test your changes, and then delete that branch.
A way I used to encapsulate the testing process and be able to test it locally, is that I don't use only travis to do the tests, but I use another set of Python scripts (or your preferred scripting language) inside the travis script. This way, you can use these scripts to test the complicated logic manually, and then you do something like this in the travis script:
install:
- python tests/install_ubuntu_packages.py
script:
- python tests/test_daemon_compile.py
- python tests/test_gui_compile.py
These scripts you can run individually in docker, super-cleanly, in a new environment, and they can contain complicated logic that needs to be tested locally. But the travis script itself is so simple that it's not worth testing locally.