2016-11-15 13:36:26 +03:00
sudo : true
2019-06-26 11:35:52 +03:00
dist : xenial
2016-02-02 12:35:39 +03:00
2018-12-28 07:07:18 +03:00
language : generic
2016-08-17 11:18:57 +03:00
addons :
2017-08-13 15:59:57 +03:00
chrome : stable
2019-05-20 22:16:55 +03:00
2019-06-26 11:35:52 +03:00
services :
- xvfb
2018-11-25 11:48:42 +03:00
before_install :
- # start your web application and listen on `localhost`
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=5000 http://localhost &
2016-08-17 11:18:57 +03:00
2016-02-02 12:35:39 +03:00
cache :
directories :
2016-08-17 11:18:57 +03:00
- $HOME/.stack
- .stack-work
2018-12-10 01:02:03 +03:00
- back/.stack-work
2018-12-28 07:07:18 +03:00
- back/static/js # Needed so that bundle.js would persist to the
# "Push Docker image" stage and beyond - without it
# the backend doesn't work and the tests don't run.
2018-09-02 19:09:23 +03:00
timeout : 1000
2016-02-02 12:35:39 +03:00
2018-09-02 20:45:34 +03:00
jobs :
2016-02-02 12:35:39 +03:00
include :
2019-05-17 23:44:52 +03:00
- stage : "Build the frontend and upload a Docker image"
script :
2019-05-20 22:16:55 +03:00
# Build
2019-04-24 18:25:12 +03:00
- cd front
- npm install
- npm run build
- cd -
2019-05-20 22:16:55 +03:00
# Upload the Docker image
2019-05-17 23:44:52 +03:00
- |
if [ "$TRAVIS_EVENT_TYPE" = "push" ]; then
export BRANCH="$(echo "$TRAVIS_BRANCH" | tr '/' '-')"
make front/travis-docker "tag=$BRANCH--front"
docker login quay.io -u "$DOCKER_USER" -p "$DOCKER_PASS"
docker push "quay.io/aelve/guide:$BRANCH--front"
fi
2019-04-24 18:25:12 +03:00
2019-05-17 23:44:52 +03:00
- stage : "Build the backend and upload a Docker image"
2018-09-02 20:45:34 +03:00
before_script :
2019-05-20 22:16:55 +03:00
- sudo apt-get install -y libgmp-dev
2019-01-02 16:07:52 +03:00
- curl -sSL https://get.haskellstack.org/ | sh
2019-07-11 19:10:42 +03:00
# travis_retry works around https://github.com/commercialhaskell/stack/issues/4888
- travis_retry stack setup
2018-09-02 20:45:34 +03:00
script :
2019-05-20 22:16:55 +03:00
# Build
- stack --no-terminal build --test --no-run-tests --dependencies-only
- stack --no-terminal build --test --no-run-tests
# Upload the Docker image
2019-05-17 23:44:52 +03:00
- |
if [ "$TRAVIS_EVENT_TYPE" = "push" ]; then
export BRANCH="$(echo "$TRAVIS_BRANCH" | tr '/' '-')"
make back/travis-docker "tag=$BRANCH--back"
docker login quay.io -u "$DOCKER_USER" -p "$DOCKER_PASS"
docker push "quay.io/aelve/guide:$BRANCH--back"
fi
2019-05-20 22:16:55 +03:00
# Check that no new undocumented definitions are introduced. Our
# goal is full documented code with ZERO undocumented definitions.
# This check warns if a commit increases the amount of undocumented
# definitions (currently 251).
#
# First we unregister the package so that Haddocks would be rebuilt
# from scratch, then we build haddocks and count the lines for
# "missing documentation".
- stack --no-terminal exec -- ghc-pkg unregister guide
- stack --no-terminal build --test --no-run-tests --haddock --no-haddock-deps --haddock-arguments='--no-warnings' 2> haddock.log
2019-08-19 15:35:34 +03:00
- export undocumented=$(awk '/\(src\// {count++} END{print count}' haddock.log)
2019-05-17 23:44:52 +03:00
- |
2019-08-19 15:35:34 +03:00
echo "Undocumented definitions: $undocumented"
- |
if [ $undocumented -gt 251 ]; then
>&2 echo "FAIL: found $undocumented top-level undocumented definitions. The current limit is 251. Please, add Haddock comments to undocumented definitions!"
2019-05-17 23:44:52 +03:00
exit 1
fi
2019-05-20 22:16:55 +03:00
before_cache :
- rm -rf $HOME/.stack/programs # GHC is faster to install than to cache
2019-02-26 08:40:42 +03:00
2018-12-28 07:07:18 +03:00
- stage : "Test the backend"
before_script :
2019-06-26 11:35:52 +03:00
- sudo apt-get install -y libgmp-dev fluxbox
2019-01-02 16:07:52 +03:00
- curl -sSL https://get.haskellstack.org/ | sh
2019-07-11 19:10:42 +03:00
# travis_retry works around https://github.com/commercialhaskell/stack/issues/4888
- travis_retry stack setup
2018-09-02 20:45:34 +03:00
# Install chromedriver
2019-08-10 15:13:40 +03:00
- wget https://chromedriver.storage.googleapis.com/76.0.3809.68/chromedriver_linux64.zip
2018-09-02 20:45:34 +03:00
- unzip chromedriver_linux64.zip
- chmod +x chromedriver
- sudo mv -f chromedriver /usr/local/share/chromedriver
- sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
- sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
# Run selenium-server
2018-12-28 07:07:18 +03:00
- travis_retry wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar -O selenium.jar
- java -jar selenium.jar 2> /dev/null &
2018-09-02 20:45:34 +03:00
- sleep 15
script :
- stack --no-terminal test
2018-12-10 01:02:03 +03:00
- make back/test-db
2019-05-20 22:16:55 +03:00
before_cache :
- rm -rf $HOME/.stack/programs # GHC is faster to install than to cache
2017-01-31 03:18:33 +03:00
2019-04-24 18:25:12 +03:00
# - stage: "Test the frontend"
2019-01-05 14:08:42 +03:00
# - sleep 10
# - fluxbox >/dev/null 2>&1 &
# script:
# # Run testcafe e2e testing
# - npm run test
2018-10-31 00:09:40 +03:00
2017-01-31 03:18:33 +03:00
notifications :
slack :
secure : BgQpUYFmvXrf7HVBP/fefS/8UVwES800+fT+ufgJX8b2HMx2FvaWVsdv3ErKAryLE0B3fwmvforWugTdgLO3kq66YUgSt51SNQOBLkMVGubIoQsgvr3Ernu+Wpw1DyoMkXQH9q9O9rfCIc4IwkQCEHqu5SVRqdOd5px/CHFl/ktTI22JkT8ap/Be53qjlB2U2sWUf4GxYXq0V/gGF6fDwsUwTVKFb14RfSDrOgK5Vlce2GRf3gNr1C/j7A7EHIR/Z+rNd2hvv69cFw6TRc3s39QmP8XPe3SLZPIHTZ8vRveX1SZioMeEy747r5rHd9vylEjxWtVHhvP9fOt693+woXa8ZAl5uVRgB6S4mTWLZ+LAbqhaCmDGJYr9GrrBMoqWvJiMuBX3ZvHptsAc6O2l/fxZQU3otTE++SmHkhbyoDQkcPCjXPDUi/ZlnoLc5zfMAfApcsZZ8b9t47z12H0O4uDZd2YiNPiQJ1iUA6R879LH3pcxPB3RaoWsfXzv/klkKrU/V2K4SXD9j4/bmAFArlig+dar+Dm44L/a3/G7vbU1lQIa1bG0EqB36qgUS3UCkuy2ppti/JTHpkYx7HVF2BipoCjOVvfBl9G8RkvcQIhyuCfOGm7WL1TjrKVMccIEGJKhm7OO6wOZYCBfAI5zILxi8XEJAIvBm9NywhQlwxI=