diff --git a/.travis.yml b/.travis.yml index cecdf03f3b5..31dc2440c90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,50 +1,76 @@ sudo: required -language: generic +language: ruby + +rvm: + - 2.4.4 services: - docker + - redis-server + +addons: + mariadb: '10.2' + +cache: + directories: + - $PWD/vendor/.bundle/ + - $PWD/public/lib/ git: depth: false env: global: - - COMPOSE_FILE=./containers/docker-compose-testing.yml - CI=true - matrix: - - TASK="rake test:all" - - TASK="rails test test/unit" - - TASK="rails test test/functional" - - TASK="rails test test/integration" - - TASK="rails test:system" + - GENERATE_REPORT=true + - RAILS_ENV=test -branches: - only: - - master - - unstable - - codecov +before_install: + - sudo wget https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip + - sudo unzip chromedriver_linux64.zip -d /usr/local/bin/ + - sudo chmod +x /usr/local/bin/chromedriver + - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & install: - rm -rf test/reports - cp config/database.yml.example config/database.yml - cp db/schema.rb.example db/schema.rb - - docker-compose build - - docker-compose up -d - - docker-compose exec web sleep 15 # wait until mysql is up - - netstat -ltpn - - docker-compose exec web bash -c "rake db:setup" - - docker-compose exec web bash -c "rake db:migrate" - - docker-compose exec web bash -c "rake assets:precompile" - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash -c "docker-compose exec web gem install danger danger-junit google-cloud-storage"; fi' - -script: - - docker-compose exec web bash -c 'echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json' # needs to be a path to a json file, so we shuffle... - - docker-compose exec web bash -c "GENERATE_REPORT=true $TASK" - - if [ $TASK != "rake test:all" ]; then - echo -e '' > output.xml; - tail -n +2 -q ./test/reports/TEST*.xml >> output.xml; + - bundle config set path 'vendor/.bundle/' + - bundle install + - if [ $RAILS_ENV != 'production' ]; then + yarn check || yarn install; fi - - if [ $TRAVIS_PULL_REQUEST != "false" ]; then - docker-compose exec web danger --verbose; + - mysql -e "CREATE DATABASE plots;"; + - bundle exec rake db:schema:load + - bundle exec rake db:migrate + - if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then + gem install danger danger-junit google-cloud-storage; fi + - echo "$GOOGLE_APPLICATION_CREDENTIALS_JSON" > /tmp/credentials.json # needs to be a path to a json file, so we shuffle... + +jobs: + include: + - name: "Unit Tests" + script: bundle exec rails test test/unit + - name: "Functional Tests" + script: bundle exec rails test test/functional + - name: "Integration Tests" + script: bundle exec rails test test/integration + - name: "System Tests" + script: bundle exec rails test:system > /dev/null + - name: "Docker Builds" + script: docker build -t plots2 . + +after_script: + - echo -e '' > output.xml; + - tail -n +2 -q ./test/reports/TEST*.xml >> output.xml + - if [ $TRAVIS_PULL_REQUEST == "true" ]; then + bundle exec danger --verbose; + fi + +branches: + only: + - master + - unstable + - codecov diff --git a/Dockerfile b/Dockerfile index 28e941bda3c..67b906dcfc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,8 @@ RUN wget https://github.com/webnicer/chrome-downloads/raw/master/x64.deb/google- WORKDIR /tmp ADD Gemfile /tmp/Gemfile ADD Gemfile.lock /tmp/Gemfile.lock -RUN bundle install --jobs=4 +RUN gem install bundler -v 1.17.3 && \ + bundle install --jobs=4 WORKDIR /app COPY Gemfile /app/Gemfile diff --git a/config/database.yml.example b/config/database.yml.example index 9b902873399..8cff562f46f 100644 --- a/config/database.yml.example +++ b/config/database.yml.example @@ -3,8 +3,8 @@ # Do not set this db to the same as development or production. test: adapter: mysql2 - username: plots - password: plots + username: root + password: database: plots encoding: utf8 host: 127.0.0.1