From 8f23d8b8639807b92f4193cdd44df497193a324d Mon Sep 17 00:00:00 2001 From: Jacob MacDonald <jakemac@google.com> Date: Thu, 3 May 2018 11:16:14 -0700 Subject: [PATCH] add build stages for travis (#815) --- .travis.yml | 47 +++++++++++++++++-------------------- tool/dartfmt_and_analyze.sh | 9 +++++++ 2 files changed, 30 insertions(+), 26 deletions(-) create mode 100755 tool/dartfmt_and_analyze.sh diff --git a/.travis.yml b/.travis.yml index 8d0ebb7b..7aae45cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,38 @@ language: dart sudo: required -# We require PhantomJS 2.x, which is only available on Trusty. -dist: trusty - dart: - dev env: FORCE_TEST_EXIT=true -# Content shell needs these fonts. addons: - apt: - packages: - - ttf-kochi-mincho - - ttf-kochi-gothic - - ttf-dejavu - - ttf-indic-fonts - - fonts-tlwg-garuda - -before_install: - - mkdir -p bin - - export PATH="$PATH:`pwd`/bin/" - - ln -s `which chromium-browser` bin/google-chrome - -dart_task: - - dartfmt - - dartanalyzer - # Split the tests into five shards to help parallelize them across Travis workers. - - test: --preset travis --total-shards 5 --shard-index 0 - - test: --preset travis --total-shards 5 --shard-index 1 - - test: --preset travis --total-shards 5 --shard-index 2 - - test: --preset travis --total-shards 5 --shard-index 3 - - test: --preset travis --total-shards 5 --shard-index 4 + chrome: stable + + +jobs: + include: + - stage: analyze_and_format + script: tool/dartfmt_and_analyze.sh + - stage: unit_test + script: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 0 + - stage: unit_test + script: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 1 + - stage: unit_test + script: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 2 + - stage: unit_test + script: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 3 + - stage: unit_test + script: xvfb-run -s "-screen 0 1024x768x24" pub run test --preset travis --total-shards 5 --shard-index 4 # Only building master means that we don't run two builds for each pull request. branches: only: [master, /feature\..*/] +stages: + - analyze_and_format + - unit_test + cache: directories: - $HOME/.pub-cache diff --git a/tool/dartfmt_and_analyze.sh b/tool/dartfmt_and_analyze.sh new file mode 100755 index 00000000..5caf3ae9 --- /dev/null +++ b/tool/dartfmt_and_analyze.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +pub get || exit $ + +EXIT_CODE=0 +dartfmt -n --set-exit-if-changed . || EXIT_CODE=$? +dartanalyzer . || EXIT_CODE=$? + +exit $EXIT_CODE -- GitLab