From 60754250d9a741d1903106ca1b67710e678f3ad4 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Sun, 7 May 2017 17:35:22 -0400 Subject: [PATCH] chore: add ensure-npm-valid-dependencies.sh to sanity-checks make target (#1378) We forgot to do so on the PR that introduces this script. This commit also moves all the CI code to separate scripts. See: https://github.com/resin-io/etcher/pull/1371 Signed-off-by: Juan Cruz Viotti --- .travis.yml | 20 ++------- Makefile | 1 + appveyor.yml | 13 ++---- ...eploy-appveyor.bat => appveyor-deploy.bat} | 2 +- scripts/ci/appveyor-install.bat | 34 ++++++++++++++ scripts/ci/appveyor-test.bat | 25 +++++++++++ .../ci/{deploy-travis.sh => travis-deploy.sh} | 5 ++- scripts/ci/travis-install.sh | 45 +++++++++++++++++++ scripts/ci/travis-test.sh | 35 +++++++++++++++ 9 files changed, 151 insertions(+), 29 deletions(-) rename scripts/ci/{deploy-appveyor.bat => appveyor-deploy.bat} (96%) create mode 100755 scripts/ci/appveyor-install.bat create mode 100755 scripts/ci/appveyor-test.bat rename scripts/ci/{deploy-travis.sh => travis-deploy.sh} (87%) create mode 100755 scripts/ci/travis-install.sh create mode 100755 scripts/ci/travis-test.sh diff --git a/.travis.yml b/.travis.yml index e2be6c5c..63d428db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,30 +33,16 @@ os: - linux - osx -before_install: - - npm config set spin=false - install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ./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 cpplint; - brew install afsctool jq; - make info; - travis_wait make electron-develop; - fi + - travis_wait ./scripts/ci/travis-install.sh 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"; - else - make sanity-checks && npm test; - fi + - ./scripts/ci/travis-test.sh deploy: provider: script skip_cleanup: true - script: scripts/ci/deploy-travis.sh + script: scripts/ci/travis-deploy.sh on: branch: master diff --git a/Makefile b/Makefile index 7547f000..0f962c0d 100644 --- a/Makefile +++ b/Makefile @@ -544,6 +544,7 @@ sanity-checks: ./scripts/ci/ensure-all-node-requirements-available.sh ./scripts/ci/ensure-staged-sass.sh ./scripts/ci/ensure-npm-dependencies-compatibility.sh + ./scripts/ci/ensure-npm-valid-dependencies.sh ./scripts/ci/ensure-npm-shrinkwrap-versions.sh ./scripts/ci/ensure-all-file-extensions-in-gitattributes.sh ./scripts/ci/ensure-all-text-files-only-ascii.sh diff --git a/appveyor.yml b/appveyor.yml index 30501d4b..ab1a20ea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,28 +24,21 @@ matrix: install: - ps: Install-Product node $env:nodejs_version x64 - - npm install -g npm@4.4.4 - - choco install nsis -version 2.51 - - choco install jq - - choco install curl - set PATH=C:\Program Files (x86)\Windows Kits\8.1\bin\x86;%PATH% - set PATH=C:\Program Files (x86)\NSIS;%PATH% - set PATH=C:\MinGW\bin;%PATH% - set PATH=C:\MinGW\msys\1.0\bin;%PATH% - - pip install codespell==1.9.2 awscli cpplint - - make info - - make electron-develop + - .\scripts\ci\appveyor-install.bat build: off test_script: - node --version - npm --version - - make sanity-checks - - cmd: npm test + - cmd: .\scripts\ci\appveyor-test.bat deploy_script: - - cmd: .\scripts\ci\deploy-appveyor.bat + - cmd: .\scripts\ci\appveyor-deploy.bat notifications: diff --git a/scripts/ci/deploy-appveyor.bat b/scripts/ci/appveyor-deploy.bat similarity index 96% rename from scripts/ci/deploy-appveyor.bat rename to scripts/ci/appveyor-deploy.bat index 7cf1bead..0b09494b 100755 --- a/scripts/ci/deploy-appveyor.bat +++ b/scripts/ci/appveyor-deploy.bat @@ -20,7 +20,7 @@ IF "%APPVEYOR_REPO_BRANCH%"=="" ( ) IF %APPVEYOR_REPO_BRANCH%==master ( - make publish-aws-s3 + call make publish-aws-s3 ) EXIT /B %ERRORLEVEL% diff --git a/scripts/ci/appveyor-install.bat b/scripts/ci/appveyor-install.bat new file mode 100755 index 00000000..bd62ddf0 --- /dev/null +++ b/scripts/ci/appveyor-install.bat @@ -0,0 +1,34 @@ +@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 +) + +call npm config set spin=false +call npm install -g npm@4.4.4 + +call choco install nsis -version 2.51 +call choco install jq +call choco install curl + +call pip install codespell==1.9.2 awscli cpplint + +call make info +call make electron-develop + +EXIT /B %ERRORLEVEL% diff --git a/scripts/ci/appveyor-test.bat b/scripts/ci/appveyor-test.bat new file mode 100755 index 00000000..06799641 --- /dev/null +++ b/scripts/ci/appveyor-test.bat @@ -0,0 +1,25 @@ +@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 +) + +call make sanity-checks +call npm test + +EXIT /B %ERRORLEVEL% diff --git a/scripts/ci/deploy-travis.sh b/scripts/ci/travis-deploy.sh similarity index 87% rename from scripts/ci/deploy-travis.sh rename to scripts/ci/travis-deploy.sh index 15219693..e6568be4 100755 --- a/scripts/ci/deploy-travis.sh +++ b/scripts/ci/travis-deploy.sh @@ -27,7 +27,10 @@ if [ -z "$TRAVIS_OS_NAME" ]; then fi if [ "$TRAVIS_OS_NAME" == "linux" ]; then - ./scripts/build/docker/run-command.sh -r "$TARGET_ARCH" -s "$(pwd)" -c "make publish-aws-s3" + ./scripts/build/docker/run-command.sh \ + -r "$TARGET_ARCH" \ + -s "$(pwd)" \ + -c "make publish-aws-s3" else make publish-aws-s3 fi diff --git a/scripts/ci/travis-install.sh b/scripts/ci/travis-install.sh new file mode 100755 index 00000000..f5a828ff --- /dev/null +++ b/scripts/ci/travis-install.sh @@ -0,0 +1,45 @@ +#!/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 + +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 info && make electron-develop" +else + ./scripts/build/check-dependency.sh pip + ./scripts/build/check-dependency.sh brew + ./scripts/build/check-dependency.sh make + ./scripts/build/check-dependency.sh npm + + npm install -g npm@3.10.10 + npm config set spin=false + + pip install codespell==1.9.2 awscli cpplint + brew install afsctool jq + make info + make electron-develop +fi diff --git a/scripts/ci/travis-test.sh b/scripts/ci/travis-test.sh new file mode 100755 index 00000000..22aa732d --- /dev/null +++ b/scripts/ci/travis-test.sh @@ -0,0 +1,35 @@ +#!/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 + +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 sanity-checks && xvfb-run --server-args=$XVFB_ARGS npm test' +else + make sanity-checks + npm test +fi