2018-02-04 02:02:27 +01:00
|
|
|
## Testing
|
|
|
|
|
2016-11-06 09:33:42 +01:00
|
|
|
# Set the language to Ruby so that we can run sass-spec tests.
|
|
|
|
language: ruby
|
2018-03-16 21:22:55 +01:00
|
|
|
|
|
|
|
# Note: we're currently pinned to Dart 2.0.0-dev.36.0 because dart2js doesn't
|
|
|
|
# support configuration-specific imports with the new front-end.
|
2016-11-06 09:33:42 +01:00
|
|
|
env:
|
2016-12-03 00:44:06 +01:00
|
|
|
# Language specs, defined in sass/sass-spec
|
2018-03-16 21:22:55 +01:00
|
|
|
- TASK=specs DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
|
2018-02-04 04:42:33 +01:00
|
|
|
- TASK=specs DART_CHANNEL=stable DART_VERSION=latest
|
|
|
|
- TASK=specs DART_CHANNEL=stable DART_VERSION=latest ASYNC=true
|
|
|
|
|
|
|
|
# Unit tests, defined in test/.
|
2018-03-16 21:22:55 +01:00
|
|
|
- TASK=tests DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
|
2018-02-04 04:42:33 +01:00
|
|
|
- TASK=tests DART_CHANNEL=stable DART_VERSION=latest
|
2018-03-16 21:22:55 +01:00
|
|
|
- TASK=tests DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0 NODE_VERSION=stable
|
|
|
|
- TASK=tests DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0 NODE_VERSION=v6.9.1
|
|
|
|
- TASK=tests DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0 NODE_VERSION=v4.6.2
|
2018-02-04 04:42:33 +01:00
|
|
|
|
|
|
|
# Miscellaneous checks.
|
2018-03-16 21:22:55 +01:00
|
|
|
- TASK=analyze DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
|
|
|
|
- TASK=format DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
|
2016-11-06 09:33:42 +01:00
|
|
|
|
|
|
|
rvm:
|
|
|
|
- 2.3.1
|
|
|
|
|
2016-12-10 02:28:08 +01:00
|
|
|
# Only building master means that we don't run two builds for each pull request.
|
|
|
|
branches:
|
2018-02-04 02:51:39 +01:00
|
|
|
only: [master, "/^feature\\..*/", "/^\\d+\\.\\d+\\.\\d+([+-].*)?$/"]
|
2016-12-10 02:28:08 +01:00
|
|
|
|
2016-11-06 09:33:42 +01:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- $HOME/.pub-cache
|
|
|
|
|
|
|
|
install:
|
2016-12-03 00:44:06 +01:00
|
|
|
- bold=$(tput bold)
|
|
|
|
- none=$(tput sgr0)
|
|
|
|
|
|
|
|
# Install the Dart SDK.
|
2017-10-06 03:46:10 +02:00
|
|
|
- curl -o dart.zip "https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_VERSION/sdk/dartsdk-linux-x64-release.zip"
|
2016-11-06 09:33:42 +01:00
|
|
|
- unzip dart.zip
|
|
|
|
- export PATH="$PATH:`pwd`/dart-sdk/bin"
|
|
|
|
- pub get
|
2016-11-13 06:56:39 +01:00
|
|
|
|
2016-12-03 00:44:06 +01:00
|
|
|
# Install the Node SDK if we're running Node tests.
|
|
|
|
- if-node() { if [ ! -z "$NODE_VERSION" ]; then "$@"; fi }
|
|
|
|
- if-node . "$HOME/.nvm/nvm.sh"
|
|
|
|
- if-node nvm install "$NODE_VERSION"
|
|
|
|
- if-node nvm use "$NODE_VERSION"
|
2018-03-10 02:16:00 +01:00
|
|
|
- if-node pub run grinder before_test
|
2016-12-03 00:44:06 +01:00
|
|
|
|
|
|
|
# Download sass-spec and install its dependencies if we're running specs.
|
2016-11-13 06:56:39 +01:00
|
|
|
- if-specs() { if [ "$TASK" = specs ]; then "$@"; fi }
|
|
|
|
- if-specs export sass_spec_ref=`tool/sass-spec-ref.sh`
|
|
|
|
- if-specs git init sass-spec
|
|
|
|
- if-specs git -C sass-spec fetch git://github.com/sass/sass-spec "$sass_spec_ref" --depth 1
|
|
|
|
- if-specs git -C sass-spec checkout FETCH_HEAD
|
|
|
|
- if-specs bundle install --gemfile=sass-spec/Gemfile --jobs=3 --retry=3
|
2016-11-06 09:33:42 +01:00
|
|
|
|
2016-11-11 02:11:29 +01:00
|
|
|
script:
|
2016-11-13 06:56:39 +01:00
|
|
|
- if [ "$TASK" = analyze ]; then
|
2016-12-03 00:44:06 +01:00
|
|
|
echo "${bold}Analzing Dart code.$none";
|
2017-01-08 23:31:26 +01:00
|
|
|
dartanalyzer --fatal-warnings lib/ test/ tool/;
|
2016-11-13 06:56:39 +01:00
|
|
|
elif [ "$TASK" = format ]; then
|
2016-12-03 00:44:06 +01:00
|
|
|
echo "${bold}Ensuring Dart code is formatted.$none";
|
2016-11-13 06:56:39 +01:00
|
|
|
./tool/assert-formatted.sh;
|
2016-12-03 00:44:06 +01:00
|
|
|
elif [ "$TASK" = tests ]; then
|
|
|
|
if [ -z "$NODE_VERSION" ]; then
|
|
|
|
echo "${bold}Running Dart tests against $(dart --version &> /dev/stdout).$none";
|
2018-02-02 02:00:27 +01:00
|
|
|
if [ "$DART_CHANNEL" = dev ]; then
|
2018-02-02 02:00:48 +01:00
|
|
|
pub run test -p vm -x node;
|
2018-02-02 02:00:27 +01:00
|
|
|
else
|
2018-02-02 02:00:48 +01:00
|
|
|
pub run test -p vm -x dart2 -x node;
|
2018-02-02 02:00:27 +01:00
|
|
|
fi
|
2016-12-03 00:44:06 +01:00
|
|
|
else
|
|
|
|
echo "${bold}Running Node tests against Node $(node --version).$none";
|
2018-02-02 02:00:27 +01:00
|
|
|
if [ "$DART_CHANNEL" = dev ]; then
|
2018-02-02 04:17:41 +01:00
|
|
|
pub run test -j 2 -t node;
|
2018-02-02 02:00:27 +01:00
|
|
|
else
|
2018-02-02 04:17:41 +01:00
|
|
|
pub run test -j 2 -x dart2 -t node;
|
2018-02-02 02:00:27 +01:00
|
|
|
fi
|
2016-12-03 00:44:06 +01:00
|
|
|
fi;
|
2016-11-13 06:56:39 +01:00
|
|
|
else
|
2016-12-03 00:44:06 +01:00
|
|
|
echo "${bold}Running sass-spec against $(dart --version &> /dev/stdout).$none";
|
2017-11-11 00:47:25 +01:00
|
|
|
if [ "$ASYNC" = true ]; then
|
|
|
|
extra_args=--dart-args --async;
|
|
|
|
fi;
|
|
|
|
(cd sass-spec; bundle exec sass-spec.rb --dart .. $extra_args);
|
2016-11-11 02:11:29 +01:00
|
|
|
fi
|
2018-02-04 02:02:27 +01:00
|
|
|
|
|
|
|
## Deployment
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
include:
|
2018-02-05 01:21:45 +01:00
|
|
|
- stage: deploy
|
2018-02-05 01:23:09 +01:00
|
|
|
if: (type IN (push, api)) AND (repo = sass/dart-sass) AND tag =~ ^\d+\.\d+\.\d+([+-].*)?$
|
2018-03-16 21:22:55 +01:00
|
|
|
env: DART_CHANNEL=dev DART_VERSION=2.0.0-dev.36.0
|
2018-02-05 01:21:45 +01:00
|
|
|
script: skip # Don't run tests
|
2018-02-04 02:02:27 +01:00
|
|
|
|
2018-02-05 01:21:45 +01:00
|
|
|
deploy:
|
2018-03-03 03:28:26 +01:00
|
|
|
# Deploy to GitHub, npm, pub, Homebrew, and Chocolatey.
|
2018-02-05 01:21:45 +01:00
|
|
|
provider: script
|
|
|
|
script: tool/deploy.sh
|
2018-02-04 07:35:20 +01:00
|
|
|
|
2018-03-03 03:28:26 +01:00
|
|
|
# Don't clean up the Dart SDK.
|
|
|
|
skip_cleanup: true
|
|
|
|
|
2018-02-05 01:21:45 +01:00
|
|
|
# This causes the deploy to only be build when a tag is pushed. This
|
|
|
|
# is because the `tag` attribute in `if:` statements has a different
|
|
|
|
# understanding of the "current tag" than this, which uses the
|
|
|
|
# `TRAVIS_TAG` environment variable. `if:` statements check whether a
|
|
|
|
# tag exists that refers to the current commit, whereas `TRAVIS_TAG`
|
|
|
|
# checks whether the current build was caused by a tag.
|
|
|
|
#
|
|
|
|
# We check `if:` because it avoids unnecessary build steps, and
|
|
|
|
# `on: {tags: true}` ensures that we only deploy on the build caused
|
|
|
|
# by pushing a tag, not the build caused by pushing master.
|
|
|
|
on: {tags: true}
|