chore: ensure npm run sass was ran and the results committed (#1121)

We recently encountered a UI regression caused by forgetting to commit
the generated CSS files.

The solution is to make the CI servers run `npm run sass` and check if
there are unstaged files afterwards. If so, the tests halt.

In order to avoid duplication between Travis CI and Appveyor CI, this
logic has been encoded into a bash script at `scripts/ci`.

See: https://github.com/resin-io/etcher/pull/1120
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
Juan Cruz Viotti 2017-02-23 11:20:47 -04:00 committed by GitHub
parent f4c92676a9
commit 96a9b65ea7
3 changed files with 18 additions and 1 deletions

View File

@ -54,9 +54,10 @@ install:
script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
npm test;
./scripts/ci/ensure-staged-sass.sh;
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
./scripts/build/docker/run-command.sh -r ${TARGET_ARCH} -s ${PWD} -c "xvfb-run --server-args=$XVFB_ARGS npm test";
./scripts/build/docker/run-command.sh -r ${TARGET_ARCH} -s ${PWD} -c "xvfb-run --server-args=$XVFB_ARGS npm test && ./scripts/ci/ensure-staged-sass.sh";
fi
notifications:

View File

@ -43,6 +43,7 @@ build: off
test_script:
- node --version
- npm --version
- bash .\scripts\ci\ensure-staged-sass.sh
- cmd: npm test
notifications:

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
set -u
npm run sass
# From http://stackoverflow.com/a/9393642/1641422
if [[ -n $(git status -s) ]]; then
echo "There are unstaged sass changes. Please commit the result of:" 1>&2
echo ""
echo " npm run sass" 1>&2
echo ""
exit 1
fi