rely on caching stage on travis

pull/6680/head
Jens Ulferts 6 years ago
parent 2ec5a92a22
commit 413139d65c
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 132
      .travis.yml
  2. 4
      config/initializers/assets.rb
  3. 49
      script/ci_cache_prepare.sh
  4. 16
      script/ci_runner.sh
  5. 20
      script/ci_setup.sh

@ -49,6 +49,8 @@ cache:
directories:
- frontend/node_modules
- public/assets
- app/assets/javascripts/bundles
- app/assets/javascripts/locales
branches:
only:
@ -61,37 +63,7 @@ env:
- CI=true
- RAILS_ENV=test
matrix:
- "TEST_SUITE=npm"
- "TEST_SUITE=spec_legacy DB=mysql GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=spec_legacy DB=postgres GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=cucumber DB=mysql GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=cucumber DB=postgres GROUP_SIZE=1 GROUP=1"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=specs DB=mysql GROUP_SIZE=4 GROUP=4"
- "TEST_SUITE=specs DB=postgres GROUP_SIZE=4 GROUP=4"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=1"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=2"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=3"
- "TEST_SUITE=features DB=mysql GROUP_SIZE=4 GROUP=4"
- "TEST_SUITE=features DB=postgres GROUP_SIZE=4 GROUP=4"
before_install:
# Install pandoc for testing textile migration
- travis_retry sudo apt-get update -qq
- travis_retry sudo apt-get install -qq pandoc
@ -106,11 +78,101 @@ before_install:
bundler_args: --binstubs --without development production docker
before_script:
- bash script/ci_setup.sh $TEST_SUITE $DB
script:
- bash script/ci_runner.sh
stages:
- prepare cache
- test
jobs:
include:
- stage: prepare cache
name: 'Prepare cache'
script:
- bash script/ci_cache_prepare.sh
- stage: test
name: 'npm'
script:
- bash script/ci_setup.sh npm
- bash script/ci_runner.sh npm
- name: 'spec_legacy (1/1) - mysql'
script:
- bash script/ci_setup.sh spec_legacy mysql
- bash script/ci_runner.sh spec_legacy 1 1
- name: 'spec_legacy (1/1) - postgresql'
script:
- bash script/ci_setup.sh spec_legacy postgres
- bash script/ci_runner.sh spec_legacy 1 1
- name: 'cucumber (1/1) - mysql'
script:
- bash script/ci_setup.sh cucumber mysql
- bash script/ci_runner.sh cucumber 1 1
- name: 'cucumber (1/1) - postgresql'
script:
- bash script/ci_setup.sh cucumber postgres
- bash script/ci_runner.sh cucumber 1 1
- name: 'unit specs (1/4) - mysql'
script:
- bash script/ci_setup.sh specs mysql
- bash script/ci_runner.sh specs 4 1
- name: 'unit specs (1/4) - postgresql'
script:
- bash script/ci_setup.sh specs postgres
- bash script/ci_runner.sh specs 4 1
- name: 'unit specs (2/4) - mysql'
script:
- bash script/ci_setup.sh specs mysql
- bash script/ci_runner.sh specs 4 2
- name: 'unit specs (2/4) - postgresql'
script:
- bash script/ci_setup.sh spec postgres
- bash script/ci_runner.sh specs 4 2
- name: 'unit specs (3/4) - mysql'
script:
- bash script/ci_setup.sh specs mysql
- bash script/ci_runner.sh specs 4 3
- name: 'unit specs (3/4) - postgresql'
script:
- bash script/ci_setup.sh specs postgres
- bash script/ci_runner.sh specs 4 3
- name: 'unit specs (4/4) - mysql'
script:
- bash script/ci_setup.sh specs mysql
- bash script/ci_runner.sh specs 4 4
- name: 'unit specs (4/4) - postgresql'
script:
- bash script/ci_setup.sh specs postgres
- bash script/ci_runner.sh specs 4 4
- name: 'feature specs (1/4) - mysql'
script:
- bash script/ci_setup.sh features mysql
- bash script/ci_runner.sh features 4 1
- name: 'feature specs (1/4) - postgresql'
script:
- bash script/ci_setup.sh features postgres
- bash script/ci_runner.sh features 4 1
- name: 'feature specs (2/4) - mysql'
script:
- bash script/ci_setup.sh features mysql
- bash script/ci_runner.sh features 4 2
- name: 'feature specs (2/4) - postgresql'
script:
- bash script/ci_setup.sh features postgres
- bash script/ci_runner.sh features 4 2
- name: 'feature specs (3/4) - mysql'
script:
- bash script/ci_setup.sh features mysql
- bash script/ci_runner.sh features 4 3
- name: 'feature specs (3/4) - postgresql'
script:
- bash script/ci_setup.sh features postgres
- bash script/ci_runner.sh features 4 3
- name: 'feature specs (4/4) - mysql'
script:
- bash script/ci_setup.sh features mysql
- bash script/ci_runner.sh features 4 4
- name: 'feature specs (4/4) - postgresql'
script:
- bash script/ci_setup.sh features postgres
- bash script/ci_runner.sh features 4 4
addons:

@ -1,4 +1,8 @@
OpenProject::Application.configure do
# Do not start the whole rails application
# and especially do not require a db to exist.
config.assets.initialize_on_precompile = false
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
config.assets.precompile += %w(

@ -0,0 +1,49 @@
#!/bin/bash
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
run() {
echo $1;
eval $1;
echo $2;
eval $2;
}
run "mysql -u root -e \"CREATE DATABASE IF NOT EXISTS travis_ci_test DEFAULT CHARACTER SET = 'utf8' DEFAULT COLLATE 'utf8_general_ci';\""
run "mysql -u root -e \"GRANT ALL ON travis_ci_test.* TO 'travis'@'localhost';\""
run "cp script/templates/database.travis.mysql.yml config/database.yml"
run "bundle exec rake db:migrate"
run "for i in {1..3}; do npm install && break || sleep 15; done"
run "bundle exec rails assets:precompile assets:clean"
run "cp -rp config/frontend_assets.manifest.json public/assets/frontend_assets.manifest.json"

@ -27,7 +27,12 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
# script/ci_runner.sh
# $1 = TEST_SUITE
# $2 = GROUP_SIZE
# $3 = GROUP
#!/bin/sh
set -e
@ -38,7 +43,7 @@ export CI_SEED=$(git rev-parse HEAD | tr -d 'a-z' | cut -b 1-5 | tr -d '0')
# by rails assets:precompile
export OPENPROJECT_CLI_PROXY=''
case "$TEST_SUITE" in
case "$1" in
npm)
npm test
;;
@ -48,11 +53,14 @@ case "$TEST_SUITE" in
exec bundle exec rspec -I spec_legacy -o "--seed $CI_SEED" spec_legacy
;;
specs)
bin/parallel_test --type rspec -o "--seed $CI_SEED" -n $GROUP_SIZE --only-group $GROUP --pattern '^spec/(?!features\/)' spec
bin/parallel_test --type rspec -o "--seed $CI_SEED" -n $2 --only-group $3 --pattern '^spec/(?!features\/)' spec
;;
features)
bin/parallel_test --type rspec -o "--seed $CI_SEED" -n $GROUP_SIZE --only-group $GROUP --pattern '^spec\/features\/' spec
bin/parallel_test --type rspec -o "--seed $CI_SEED" -n $2 --only-group $3 --pattern '^spec\/features\/' spec
;;
cucumber)
bin/parallel_test --type cucumber -n $2 --only-group $3 features
;;
*)
bundle exec rake parallel:$TEST_SUITE
bundle exec rake parallel:$1
esac

@ -55,25 +55,9 @@ if [ $1 != 'npm' ]; then
run "bundle exec rake db:migrate"
fi
run "for i in {1..3}; do npm install && break || sleep 15; done"
if [ $1 = 'npm' ]; then
run "for i in {1..3}; do npm install && break || sleep 15; done"
echo "No asset compilation required"
elif [ $1 != 'specs' ] && [ $1 != 'spec_legacy' ]; then
run "bundle exec rails assets:precompile"
else
# fake result of npm/asset run
run "mkdir -p public/assets/frontend/"
run "touch public/assets/frontend/runtime.js"
run "touch public/assets/frontend/vendor.js"
run "touch public/assets/frontend/main.js"
run "touch public/assets/frontend/styles.js"
run "touch public/assets/frontend/styles.css"
run "mkdir -p app/assets/javascripts/bundles"
run "touch app/assets/javascripts/bundles/openproject-legacy-app.js"
run "mkdir -p app/assets/javascripts/locales"
run "touch app/assets/javascripts/locales/en.js"
fi
run "cp -rp public/assets/frontend_assets.manifest.json config/frontend_assets.manifest.json"

Loading…
Cancel
Save