How to use Travis CI with some files in gitignore? How to use Travis CI with some files in gitignore? flask flask

How to use Travis CI with some files in gitignore?


@dirn's comment of using a default settings.py file and then overriding some settings with encrypted environment variables on Travis is a good idea, certainly worth it if there are only a couple of differences.

However, if you can't be bothered or it's too complicated breaking up your settings, you could install the Ruby Travis command line client gem, which is useful for quite a few things.

With the client on your machine you can use Travis' file encryption feature to encrypt your whole settings.py file, and then commit the encrypted version (which will have an .enc file extension) to GitHub. Travis will then be able to decrypt the file during the CI run, as long as you add the right commands to the .travis.yml file, say in a before_install step. Detailed instructions are on the file encryption page.


I did a trick in .travis.ymlAfter commit and before Travis build, create the ignored file like this:

before_install:- cp .ignored.file.copy ignored.file

This way, the build will succeed without the actual gitignore-ed file.