Recently, Travis CI — a continuous integration (CI) service for GitHub repos — announced early release support for the Windows operating system. Today, we’re announcing that Travis CI on Windows supports the Dart SDK, so you can run Dart build and test jobs on all three major desktop operating systems: Linux, Mac, and Windows.
Configuring Travis CI jobs for multiple operating systems
If you already use Travis CI to build or test your Dart code, you can easily run your jobs on all three operating systems. Just add (or extend) the
os: section in your repo’s
os: - linux - osx - windows
Then, whenever Travis CI runs, you’ll see entries for each test configuration running on each of the enabled operating systems. Here’s an example from the grpc-dart repo, after we added Windows to the test matrix:
Because Windows support on Travis CI is still in an early release stage, we recommend that you review the known issues before adding Windows to your Travis jobs.
Adding Travis CI test support to a project
If you don’t yet use Travis CI for testing Dart, it’s really easy to get started. The most minimal
.travis.yml file contains just one line:
This config is the equivalent of
pub run test.
List any additional tasks under the
dart_task: tag. These include running static analysis and code formatting checks (for full details, see the Travis documentation).
Here’s how to run static analysis, which checks your code for analysis errors:
language: dart dart_task: - dartanalyzer
Here’s how to make sure that all Dart files are correctly formatted:
language: dart dart_task: - dartfmt
If you have a more complicated repo with multiple Dart packages, you need a slightly more detailed setup. The
travis command in the mono_repo tool is one possible solution for creating this setup.
Alternatives to Travis CI
Travis CI is one of several popular providers of continuous integration. Others with support for the Dart SDK include AppVeyor (sample) and Codeship. For Flutter apps, options include NeverCode, CirrusCI, and Bitrise.
That’s it for now. We hope you enjoy this new CI support for Dart.