Merge pull request #347 from sass/travis

Travis infrastructure improvements
This commit is contained in:
Natalie Weizenbaum 2018-06-06 14:14:26 -04:00 committed by GitHub
commit a319b84e6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 139 additions and 94 deletions

View File

@ -38,9 +38,6 @@ cache:
- $HOME/.pub-cache
install:
- bold=$(tput bold)
- none=$(tput sgr0)
# Install the Dart SDK.
- curl -o dart.zip "https://storage.googleapis.com/dart-archive/channels/$DART_CHANNEL/release/$DART_VERSION/sdk/dartsdk-linux-x64-release.zip"
- unzip dart.zip
@ -56,65 +53,31 @@ install:
# Download sass-spec and install its dependencies if we're running specs.
- if-specs() { if [ "$TASK" = specs ]; then "$@"; fi }
- if-specs export sass_spec_ref=`tool/sass-spec-ref.sh`
- if-specs export sass_spec_ref=`tool/travis/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
script:
- if [ "$TASK" = analyze ]; then
echo "${bold}Analzing Dart code.$none";
dartanalyzer --fatal-warnings lib/ test/ tool/;
elif [ "$TASK" = format ]; then
echo "${bold}Ensuring Dart code is formatted.$none";
./tool/assert-formatted.sh;
elif [ "$TASK" = tests ]; then
if [ -z "$NODE_VERSION" ]; then
echo "${bold}Running Dart tests against $(dart --version &> /dev/stdout).$none";
if [ "$DART_CHANNEL" = dev ]; then
pub run test -p vm -x node;
else
pub run test -p vm -x dart2 -x node;
fi
else
echo "${bold}Running Node tests against Node $(node --version).$none";
if [ "$DART_CHANNEL" = dev ]; then
pub run test -j 2 -t node;
else
pub run test -j 2 -x dart2 -t node;
fi
fi;
else
echo "${bold}Running sass-spec against $(dart --version &> /dev/stdout).$none";
if [ "$ASYNC" = true ]; then
extra_args=--dart-args --async;
fi;
(cd sass-spec; bundle exec sass-spec.rb --dart .. $extra_args);
fi
script: tool/travis/test.sh
## Deployment
jobs:
include:
# Deploy to GitHub.
- stage: deploy
if: &deploy-if
(type IN (push, api)) AND (repo = sass/dart-sass) AND tag =~ ^\d+\.\d+\.\d+([+-].*)?$
env:
env: &github-env
- DART_CHANNEL=dev DART_VERSION=latest GITHUB_USER=sassbot
# GITHUB_AUTH="..."
- secure: "AAP74aT+8SQmwGeHrCsZ7GgppvCCkDAZXszivocMy3Fi9gfMCLABBCh67pGINJX4VlLW7ftPF3xivlvgGu+e4ncXz9m9jIPZ9Iza3cW5jCnCgyRGZD98gwabIDFWiv4X9V2xnJA2p1ZuYBf8Sh3TTipUFBKMjlnxVxYkIOTud4rUss/htFhxVA/oFTo0ThTZwXuxJ+GRGTM4PcuHPJvPf18iRPs2AHFV6ZP51xgc3AsXC6Zyom5EJeX0yGj9zWQ0XCjnuFdGsI6G9jmkrmqgAXuUipgqAn0tjxPYp9R/1HqnBLD3Zbrvyi5pCiSFclU6CS6kTDbefzPOc5+zrnlkaolVeF8tQ+EhZiZqtLnpLYUz9bgknoFUapUN4N0R36sKBStdRv54+sMeoOzpQ8ep3PeZW5nWbak12wcrDx38ToWs6hQ4ycb0SQDZZatHsASpSu2nX8HwzZSDAZmsAdB+epPmgA0CBjWVG1ycmVnT6l3OopUmbaY3pXBNzFUXq5Fcd7Q39/MfrmHpyxSc3QVf8xNtUx9ggYtK0Kwx6dgykhNMVzFGZRVyQgwpaiyDqgMGEU2GQzzcJhgKo9+y1fDtdfj/cctmvJ2Fo1fkk+DMkEPUHGOVo6uKFnartky9iLm1WiHDMruJ6SIOJzAnb+TMBWQTSwI+F4wyEiRVR8Zv4uA="
# CHOCO_TOKEN="..."
- secure: "cW11kQYBBEElfVsc1pJfVEHOMYwt0ZK+9STZHwSPbAISlplIRnsimMN7TqCY2aLnkWXyUMU7DphIl9uQ86M4BT1bJopsHbapj27bFSlKWHlBSDB/xylFHywV41Yk5lMlr8DLMbsSzVahasyR34xS6HYIRlDpZ9TFiQuDQNJxQmqTZJg/FC+3nqCI7tyMKGkWc48ikTcmqDMHsG9CudG2u+Q3S9sLNXArh9T4tSnAyWkTvSrS05mvFx5tC83PcG9/VkioTId+VRSJchwTmCxDFDROrTikTXZMtYn8wMAQ2wQ34TQXNZMZ9uiHA6W0IuJV2EnYerJbqV2lrJq9xqZywKu6HW6i4GhrCvizALNFZx/N7s/10xuf3UcuWizYml/e0MYT+6t4ojTYBMKv+Cx+H2Y2Jdpvdn2ZAIl6LaU3pLw4OIPJ7aXjDwZd63MPxtwGwVLHbH7Zu+oUv1erIq5LtatuocGWipD8WdiMBQvyCuDRMowpLPoAbj+mevOf+xlY2Eym4tOXpxM7iY3lXFHROo5dQbhsARfVF9J1gl5PuYXvCjxqTfK/ef9t3ZoDbi57+yAJUWlZfWa5r1zKE8OS0pA8GfQRLom/Lt0wKVw4Xiofgolzd9pEHi4JpsYIQb8O+u1ACQU6nBCS87CGrQ+ylnzKfGUs0aW2K3gvbkg0LUg="
script: skip # Don't run tests
deploy:
# Deploy to GitHub, npm, pub, Homebrew.
provider: script
script: tool/deploy.sh
# Don't clean up the Dart SDK.
skip_cleanup: true
script: pub run grinder github_release
skip_cleanup: true # Don't clean up the Dart SDK.
# 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
@ -128,6 +91,49 @@ jobs:
# by pushing a tag, not the build caused by pushing master.
on: {tags: true}
# Deploy to npm.
- if: *deploy-if
env: DART_CHANNEL=dev DART_VERSION=latest
script: skip
deploy:
provider: script
script: tool/travis/deploy/npm.sh
skip_cleanup: true
on: {tags: true}
# Deploy to pub.
- if: *deploy-if
env: DART_CHANNEL=dev DART_VERSION=latest
script: skip
deploy:
provider: script
script: tool/travis/deploy/pub.sh
skip_cleanup: true
on: {tags: true}
# Deploy to Homebrew.
- if: *deploy-if
env: *github-env
script: skip
deploy:
provider: script
script: pub run grinder update_homebrew
skip_cleanup: true
on: {tags: true}
# Deploy to Chocolatey.
- if: *deploy-if
env:
- DART_CHANNEL=dev DART_VERSION=latest
# CHOCO_TOKEN="..."
- secure: "cW11kQYBBEElfVsc1pJfVEHOMYwt0ZK+9STZHwSPbAISlplIRnsimMN7TqCY2aLnkWXyUMU7DphIl9uQ86M4BT1bJopsHbapj27bFSlKWHlBSDB/xylFHywV41Yk5lMlr8DLMbsSzVahasyR34xS6HYIRlDpZ9TFiQuDQNJxQmqTZJg/FC+3nqCI7tyMKGkWc48ikTcmqDMHsG9CudG2u+Q3S9sLNXArh9T4tSnAyWkTvSrS05mvFx5tC83PcG9/VkioTId+VRSJchwTmCxDFDROrTikTXZMtYn8wMAQ2wQ34TQXNZMZ9uiHA6W0IuJV2EnYerJbqV2lrJq9xqZywKu6HW6i4GhrCvizALNFZx/N7s/10xuf3UcuWizYml/e0MYT+6t4ojTYBMKv+Cx+H2Y2Jdpvdn2ZAIl6LaU3pLw4OIPJ7aXjDwZd63MPxtwGwVLHbH7Zu+oUv1erIq5LtatuocGWipD8WdiMBQvyCuDRMowpLPoAbj+mevOf+xlY2Eym4tOXpxM7iY3lXFHROo5dQbhsARfVF9J1gl5PuYXvCjxqTfK/ef9t3ZoDbi57+yAJUWlZfWa5r1zKE8OS0pA8GfQRLom/Lt0wKVw4Xiofgolzd9pEHi4JpsYIQb8O+u1ACQU6nBCS87CGrQ+ylnzKfGUs0aW2K3gvbkg0LUg="
script: skip
deploy:
provider: script
script: pub run grinder update_chocolatey
skip_cleanup: true
on: {tags: true}
# Redeploy sass-lang.com when a build succeeds.
- stage: site
if: *deploy-if
@ -140,5 +146,5 @@ jobs:
provider: script
# Heroku doesn't have a public API endpoint for this yet, so we use the
# private endpoint instead.
script: tool/deploy-heroku.sh
script: tool/travis/deploy/heroku.sh
on: {tags: true}

View File

@ -1,46 +0,0 @@
#!/bin/bash -e
# Copyright 2018 Google Inc. Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
openssl aes-256-cbc -K $encrypted_d472b0f964cc_key -iv $encrypted_d472b0f964cc_iv -in tool/encrypted/credentials.tar.enc \
-out credentials.tar -d
mkdir -p ~/.pub-cache
tar xfO credentials.tar npm > ~/.npmrc
tar xfO credentials.tar pub > ~/.pub-cache/credentials.json
function travis_cmd() {
echo "\$ $@"
"$@"
}
travis_fold() {
local action=$1
local name=$2
echo -en "travis_fold:${action}:${name}\r"
}
travis_fold start github
travis_cmd pub run grinder github_release
travis_fold end github
travis_fold start npm
travis_cmd pub run grinder npm_release_package
travis_cmd npm publish build/npm
travis_cmd npm publish build/npm-old
travis_fold end npm
travis_fold start pub
travis_cmd pub lish --force
travis_fold end pub
travis_fold start homebrew
git config --local user.name "SassBot"
git config --local user.email "sass.bot.beep.boop@gmail.com"
travis_cmd pub run grinder update_homebrew
travis_fold end homebrew
travis_fold start chocolatey
travis_cmd pub run grinder update_chocolatey
travis_fold end chocolatey

View File

@ -1,2 +0,0 @@
╠ рЯ©≥ &+╢tп║к≤з
}└Ea╞зЗ x#²6ВЮj▌Y⌠ФН:╬÷г┴о├] П⌠^Wfh$8э▓;V╫Хы⌠ь▀╢ ╫1E

View File

@ -1 +0,0 @@
<>^M¨Ê·<C38A>Ž:˯ï2<9M£_<C2A3>ÆÖj¶ 'VÕêœaøÀ2áœNúuh¿ÂNªÅOß!ªœø*}ªÞ†ã#xŽe<C5BD>®\c9<E280BA>²

View File

@ -58,7 +58,13 @@ update_homebrew() async {
"--message",
"Update Dart Sass to $version"
],
workingDirectory: "build/homebrew-sass");
workingDirectory: "build/homebrew-sass",
runOptions: new RunOptions(environment: {
"GIT_AUTHOR_NAME": "Sass Bot",
"GIT_AUTHOR_EMAIL": "sass.bot.beep.boop@gmail.com",
"GIT_COMMITTER_NAME": "Sass Bot",
"GIT_COMMITTER_EMAIL": "sass.bot.beep.boop@gmail.com"
}));
var username = environment('GITHUB_USER');
var password = environment('GITHUB_AUTH');

13
tool/travis/deploy/npm.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash -e
# Copyright 2018 Google Inc. Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
source tool/travis/util.sh
decrypt_credentials
tar xfO credentials.tar npm > ~/.npmrc
travis_cmd pub run grinder npm_release_package
travis_cmd npm publish build/npm
travis_cmd npm publish build/npm-old

12
tool/travis/deploy/pub.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash -e
# Copyright 2018 Google Inc. Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
source tool/travis/util.sh
decrypt_credentials
mkdir -p ~/.pub-cache
tar xfO credentials.tar pub > ~/.pub-cache/credentials.json
travis_cmd pub lish --force

37
tool/travis/test.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash -e
# Copyright 2018 Google Inc. Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
bold=$(tput bold)
none=$(tput sgr0)
if [ "$TASK" = analyze ]; then
echo "${bold}Analzing Dart code.$none"
dartanalyzer --fatal-warnings lib/ test/ tool/
elif [ "$TASK" = format ]; then
echo "${bold}Ensuring Dart code is formatted.$none"
./tool/assert-formatted.sh
elif [ "$TASK" = tests ]; then
if [ -z "$NODE_VERSION" ]; then
echo "${bold}Running Dart tests against $(dart --version &> /dev/stdout).$none"
if [ "$DART_CHANNEL" = dev ]; then
pub run test -p vm -x node
else
pub run test -p vm -x dart2 -x node
fi
else
echo "${bold}Running Node tests against Node $(node --version).$none"
if [ "$DART_CHANNEL" = dev ]; then
pub run test -j 2 -t node
else
pub run test -j 2 -x dart2 -t node
fi
fi;
else
echo "${bold}Running sass-spec against $(dart --version &> /dev/stdout).$none"
if [ "$ASYNC" = true ]; then
extra_args="--dart-args --async"
fi;
(cd sass-spec; bundle exec sass-spec.rb --dart .. $extra_args)
fi

20
tool/travis/utils.sh Normal file
View File

@ -0,0 +1,20 @@
# Copyright 2018 Google Inc. Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# Decrypts the encrypted credentials using Travis's private key and saves them
# to credentials.tar.
function decrypt_credentials() {
openssl aes-256-cbc -K $encrypted_d472b0f964cc_key \
-iv $encrypted_d472b0f964cc_iv \
-in tool/travis/credentials.tar.enc \
-out credentials.tar -d
}
# Prints the invocation of a command and then runs that command, in the same way
# Travis's internal infrastructure does.
function travis_cmd() {
echo "\$ $@"
"$@"
}