From 3c1882d2b42d1a627f6452f029a8668bb405128c Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 28 Mar 2017 14:15:52 -0400 Subject: [PATCH] chore(travis): move deploy command to a separate script (#1224) We're passing a shell conditional to `deploy.script`, however Travis CI seems to get confused about this in the deploy section, causing GNU/Linux to run `make publish-aws-s3` directly on the Travis CI build instead of in the Docker container, which causes the deployment to eventually fail because of missing dependencies. According to Travis CI: > `deploy.script` must be a scalar pointing to an executable file or > command. See https://travis-ci.org/resin-io/etcher/jobs/214723725 for a failure example. We also move the Appveyor deploy script to a separate file for symmetry purposes. Signed-off-by: Juan Cruz Viotti --- .gitattributes | 1 + .travis.yml | 10 +++------- appveyor.yml | 2 +- scripts/ci/deploy-appveyor.bat | 26 ++++++++++++++++++++++++++ scripts/ci/deploy-travis.sh | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 8 deletions(-) create mode 100755 scripts/ci/deploy-appveyor.bat create mode 100755 scripts/ci/deploy-travis.sh diff --git a/.gitattributes b/.gitattributes index 0fc5b641..69f141f2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -17,6 +17,7 @@ LICENSE text Makefile text *.md text *.sh text +*.bat text *.svg text *.yml text diff --git a/.travis.yml b/.travis.yml index cbe455c9..fa70c6ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,7 +37,7 @@ before_install: install: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ./scripts/build/docker/run-command.sh -r ${TARGET_ARCH} -s ${PWD} -c "make info && make electron-develop"; + ./scripts/build/docker/run-command.sh -r "${TARGET_ARCH}" -s "${PWD}" -c "make info && make electron-develop"; else pip install codespell==1.9.2 awscli; npm install -g bower asar; @@ -48,7 +48,7 @@ install: script: - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ./scripts/build/docker/run-command.sh -r ${TARGET_ARCH} -s ${PWD} -c "make sanity-checks && xvfb-run --server-args=$XVFB_ARGS npm test"; + ./scripts/build/docker/run-command.sh -r "${TARGET_ARCH}" -s "${PWD}" -c "make sanity-checks && xvfb-run --server-args=$XVFB_ARGS npm test"; else make sanity-checks && npm test; fi @@ -56,11 +56,7 @@ script: deploy: provider: script skip_cleanup: true - script: if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ./scripts/build/docker/run-command.sh -r ${TARGET_ARCH} -s ${PWD} -c "make publish-aws-s3"; - else - make publish-aws-s3; - fi + script: scripts/ci/deploy-travis.sh on: branch: master diff --git a/appveyor.yml b/appveyor.yml index 97b28ad4..8dc7794f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,7 +42,7 @@ test_script: - cmd: npm test deploy_script: - - cmd: IF %APPVEYOR_REPO_BRANCH%==master (make publish-aws-s3) + - cmd: .\scripts\ci\deploy-appveyor.bat notifications: diff --git a/scripts/ci/deploy-appveyor.bat b/scripts/ci/deploy-appveyor.bat new file mode 100755 index 00000000..7cf1bead --- /dev/null +++ b/scripts/ci/deploy-appveyor.bat @@ -0,0 +1,26 @@ +@echo off + +:: Copyright 2017 resin.io +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +IF "%APPVEYOR_REPO_BRANCH%"=="" ( + ECHO This script is only meant to run in Appveyor CI 1>&2 + EXIT /B 1 +) + +IF %APPVEYOR_REPO_BRANCH%==master ( + make publish-aws-s3 +) + +EXIT /B %ERRORLEVEL% diff --git a/scripts/ci/deploy-travis.sh b/scripts/ci/deploy-travis.sh new file mode 100755 index 00000000..15219693 --- /dev/null +++ b/scripts/ci/deploy-travis.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +### +# Copyright 2017 resin.io +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +### + +set -e +set -u + +./scripts/build/check-dependency.sh make + +if [ -z "$TRAVIS_OS_NAME" ]; then + echo "This script is only meant to run in Travis CI" 1>&2 + exit 1 +fi + +if [ "$TRAVIS_OS_NAME" == "linux" ]; then + ./scripts/build/docker/run-command.sh -r "$TARGET_ARCH" -s "$(pwd)" -c "make publish-aws-s3" +else + make publish-aws-s3 +fi