It seems to me if it takes you many hours to migrate your project from one CI provider to another you're doing things wrong.
Ultimately your .travis.yml file is a proprietary format for a service that you have no control over. You probably shouldn't have built your project's future on the assumption that it's always available.
Ideally you should have your own testing infrastructure in scripts or test frameworks. And your travis file shouldn't do much more than installing dependencies and running the stuff that's under your control. Put all the logic into the stuff you can control - and next time you find out that your favorite CI provider is no longer nice to you you simply use another one, the migration should not take more than a few minutes.
That's exactly how I have 95% of my travisfiles configured (15 or so lines to describe Travis config and install a couple deps, then '[testtool run]'. But I have over 200 projects to finish migrating.
Ultimately your .travis.yml file is a proprietary format for a service that you have no control over. You probably shouldn't have built your project's future on the assumption that it's always available.
Ideally you should have your own testing infrastructure in scripts or test frameworks. And your travis file shouldn't do much more than installing dependencies and running the stuff that's under your control. Put all the logic into the stuff you can control - and next time you find out that your favorite CI provider is no longer nice to you you simply use another one, the migration should not take more than a few minutes.