Commit 39855a9ce0a862d3cee500e244ea17594d5cb2fe

Authored by Tallys Martins
1 parent d673781e

Added travis CI

- Added travis.yml file
- Changes ci scripts to work with travis

Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
.gitmodules
1 1 [submodule "noosfero"]
2 2 path = noosfero
3   - url = http://softwarepublico.gov.br/gitlab/softwarepublico/noosfero.git
  3 + url = https://gitlab.com/softwarepublico/noosfero.git
... ...
.travis.yml 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +branches:
  2 + only:
  3 + - /^ci_.*$/
  4 + - master_noosfero
  5 +
  6 +#dist: trusty
  7 +language: ruby
  8 +rvm:
  9 + - 2.2
  10 + # ruby 2.3 works but isn't stable on travis
  11 +
  12 +addons:
  13 + apt:
  14 + packages:
  15 + - xvfb
  16 + - po4a
  17 + - iso-codes
  18 + - tango-icon-theme
  19 + - pidgin-data
  20 + # for gem extensions
  21 + - libmagickwand-dev
  22 + - libpq-dev
  23 + - libreadline-dev
  24 + - libsqlite3-dev
  25 + - libxslt1-dev
  26 +
  27 +# workaround for https://github.com/travis-ci/travis-ci/issues/4536
  28 +before_install:
  29 + - export GEM_HOME=$PWD/noosfero/vendor/bundle/ruby/2.2.0
  30 + - cd noosfero
  31 + - gem install bundler
  32 + - export BUNDLE_GEMFILE=$PWD/Gemfile
  33 +cache: bundler
  34 +
  35 +before_script:
  36 + - mkdir -p tmp/{pids,cache} log cache
  37 + - script/noosfero-plugins disableall
  38 + - cp config/database.yml.travis config/database.yml
  39 + - psql -c 'create database myapp_test;' -U postgres
  40 + - git checkout db/schema.rb
  41 + - bundle exec rake db:schema:load
  42 + - rake db:data:minimal
  43 + - bundle exec rake db:migrate &>/dev/null
  44 + - unlink plugins/software_communities || true
  45 + - unlink plugins/gov_user || true
  46 + - unlink plugins/spb_migrations || true
  47 + - unlink public/designs/themes/noosfero-spb-theme || true
  48 +
  49 +env:
  50 + - TASK=./../script/software_communities_ci.sh
  51 + - TASK="bundle exec rake test:units"
  52 + - TASK="bundle exec rake test:functionals"
  53 + - TASK="bundle exec rake test:integration"
  54 + - TASK="bundle exec rake cucumber LANG=en"
  55 + - TASK="bundle exec rake selenium"
  56 + - SLICE="1/4 TASK=bundle exec rake test:noosfero_plugins BUNDLE_OPTS=install"
  57 + - SLICE="2/4 TASK=bundle exec rake test:noosfero_plugins BUNDLE_OPTS=install"
  58 + - SLICE="3/4 TASK=bundle exec rake test:noosfero_plugins BUNDLE_OPTS=install"
  59 + - SLICE="4/4 TASK=bundle exec rake test:noosfero_plugins BUNDLE_OPTS=install"
  60 +
  61 +script:
  62 + - bash -c "$TASK"
  63 +
... ...
Gemfile
  1 +source 'https://rubygems.org'
1 2 gem 'chake', '>= 0.2.1'
... ...
script/gov_user_ci.sh
... ... @@ -14,12 +14,12 @@ functionals=$?
14 14  
15 15 printf "${GREEN}=================================\n"
16 16 printf "GovUserPlugin:SELENIUM${NC}\n"
17   -xvfb-run -a cucumber plugins/gov_user/features/* -p software_communities_selenium --format progress
  17 +ruby -S cucumber FEATURE=plugins/gov_user/features/* -p software_communities_selenium --format progress
18 18 selenium=$?
19 19  
20 20 printf "${GREEN}=================================\n"
21 21 printf "GovUserPlugin:CUCUMBER${NC}\n"
22   -xvfb-run -a cucumber plugins/gov_user/features/* -p software_communities --format progress
  22 +ruby -S cucumber FEATURE=plugins/gov_user/features/* -p software_communities --format progress
23 23 cucumber=$?
24 24  
25 25 if [ $units -ne 0 ] || [ $functionals -ne 0 ] || [ $selenium -ne 0 ] || [ $cucumber -ne 0 ]; then
... ...
script/plugins_spb_ci_setup.sh
... ... @@ -43,5 +43,3 @@ fi
43 43 printf "${GREEN}=================================\n"
44 44 printf "Running rake db:test:prepare${NC}\n"
45 45 bundle exec rake db:test:prepare
46   -
47   -exit 0
... ...
script/software_communities_ci.sh
1 1 RED='\033[1;31m'
2 2 GREEN='\033[1;32m'
3 3 NC='\033[0m'
  4 +current_path=$(pwd)
4 5  
  6 +printf "${GREEN}=================================\n"
  7 +printf "Enabling SPB plugins${NC}\n"
  8 +ln -s "$current_path/../src/noosfero-spb/software_communities/" plugins/software_communities
  9 +ln -s "$current_path/../src/noosfero-spb/gov_user/" plugins/gov_user
  10 +ln -s "$current_path/../src/noosfero-spb/spb_migrations/" plugins/spb_migrations
  11 +ln -s "$current_path/../src/noosfero-spb/noosfero-spb-theme" public/designs/themes/noosfero-spb-theme
  12 +
  13 +printf "${GREEN}=================================\n"
  14 +printf "Enabling Organization Ratings${NC}\n"
  15 +./script/noosfero-plugins enable organization_ratings
  16 +bundle exec rake db:migrate
  17 +ratings=$?
  18 +
  19 +printf "${GREEN}=================================\n"
  20 +printf "Enabling Gov User, Software Communities and SPB Migrations${NC}\n"
  21 +./script/noosfero-plugins enable software_communities gov_user
  22 +bundle exec rake db:migrate
  23 +gov_and_soft_plugins=$?
  24 +
  25 +
  26 +printf "${GREEN}=================================\n"
  27 +printf "Enabling SPB Migrations${NC}\n"
  28 +./script/noosfero-plugins enable spb_migrations
  29 +bundle exec rake db:migrate
  30 +spb_migrations=$?
  31 +
  32 +printf "${GREEN}=================================\n"
  33 +printf "Compiling translations${NC}\n"
  34 +rake noosfero:translations:compile &>/dev/null
  35 +translations=$?
  36 +
  37 +if [ $gov_and_soft_plugins -ne 0 ] || [ $ratings -ne 0 ] || [ $translations -ne 0 ] || [ $spb_migrations -ne 0 ]; then
  38 + printf "${RED}=================================\n"
  39 + printf "Error migrating SPB plugins!!n${NC}\n"
  40 + exit 1
  41 +fi
  42 +
  43 +printf "${GREEN}=================================\n"
  44 +printf "Running rake db:test:prepare${NC}\n"
  45 +bundle exec rake db:test:prepare
  46 +
  47 +# =======================================================================================
5 48 ./script/noosfero-plugins disable gov_user
6 49 printf "${GREEN}=================================\n"
7 50 printf "SoftwareCommunitiesPlugin:UNITS${NC}\n"
... ... @@ -15,12 +58,12 @@ functionals=$?
15 58  
16 59 printf "${GREEN}=================================\n"
17 60 printf "SoftwareCommunitiesPlugin:SELENIUM${NC}\n"
18   -xvfb-run -a cucumber plugins/software_communities/features/* -p software_communities_selenium --format progress
  61 +ruby -S cucumber --profile software_communities_selenium --format progress
19 62 selenium=$?
20 63  
21 64 printf "${GREEN}=================================\n"
22 65 printf "SoftwareCommunitiesPlugin:CUCUMBER${NC}\n"
23   -xvfb-run -a cucumber plugins/software_communities/features/* -p software_communities --format progress
  66 +ruby -S cucumber --profile software_communities --format progress
24 67 cucumber=$?
25 68  
26 69 if [ $units -ne 0 ] || [ $functionals -ne 0 ] || [ $selenium -ne 0 ] || [ $cucumber -ne 0 ]; then
... ... @@ -28,5 +71,3 @@ if [ $units -ne 0 ] || [ $functionals -ne 0 ] || [ $selenium -ne 0 ] || [ $cucum
28 71 printf "ERROR RUNNING SOFTWARE COMMUNITIES PLUGIN TESTS${NC}\n"
29 72 exit 1
30 73 fi
31   -
32   -exit 0
... ...