Commit 652e8ffa4cffd00a34a5eb262ad725b3dc1064eb
1 parent
6787d6ea
Exists in
master
and in
29 other branches
CI: Use new gitlab-ci.yml and add .travis.yml
Showing
6 changed files
with
70 additions
and
56 deletions
Show diff stats
... | ... | @@ -0,0 +1,24 @@ |
1 | +before_install: | |
2 | + - mkdir -p tmp/pids log | |
3 | + - script/noosfero-plugins disableall | |
4 | + - bundle check || bundle install | |
5 | +# database | |
6 | + - cp config/database.yml.gitlab-ci config/database.yml | |
7 | + - dropdb gitlab_ci_test | |
8 | + - createdb gitlab_ci_test | |
9 | + - bundle exec rake db:schema:load | |
10 | + - bundle exec rake db:migrate | |
11 | + | |
12 | +units: | |
13 | + script: 'bundle exec rake test:units' | |
14 | +functionals: | |
15 | + script: 'bundle exec rake test:functionals' | |
16 | +integration: | |
17 | + script: 'bundle exec rake test:integration' | |
18 | +cucumber: | |
19 | + script: 'bundle exec rake cucumber' | |
20 | +selenium: | |
21 | + script: 'bundle exec rake selenium' | |
22 | +plugins: | |
23 | + script: 'bundle exec rake test:noosfero_plugins' | |
24 | + | ... | ... |
... | ... | @@ -0,0 +1,35 @@ |
1 | +language: ruby | |
2 | +rvm: | |
3 | +# for 2.2 support we need to upgrade the pg gem | |
4 | + - 2.1.6 | |
5 | + | |
6 | +before_install: | |
7 | +# dependencies | |
8 | + - sudo apt-get update | |
9 | + - sudo apt-get -y install po4a iso-codes tango-icon-theme pidgin-data openjdk-6-jre curl wget | |
10 | + - sudo apt-get -y install libmagickwand-dev libpq-dev libreadline-dev libsqlite3-dev libxslt1-dev | |
11 | +# selenium support | |
12 | + - export DISPLAY=:99.0 | |
13 | + - sh -e /etc/init.d/xvfb start | |
14 | + | |
15 | +before_script: | |
16 | + - mkdir -p tmp/pids log | |
17 | + - script/noosfero-plugins disableall | |
18 | + - bundle check || bundle install | |
19 | +# database | |
20 | + - cp config/database.yml.travis config/database.yml | |
21 | + - psql -c 'create database myapp_test;' -U postgres | |
22 | + - bundle exec rake db:schema:load | |
23 | + - bundle exec rake db:migrate | |
24 | + | |
25 | +env: | |
26 | + - TASK=test:units | |
27 | + - TASK=test:functionals | |
28 | + - TASK=test:integration | |
29 | + - TASK=cucumber | |
30 | + - TASK=selenium | |
31 | + - TASK=test:noosfero_plugins | |
32 | + | |
33 | +script: | |
34 | + - bundle exec rake $TASK | |
35 | + | ... | ... |
Gemfile
script/gitlab-ci
... | ... | @@ -1,56 +0,0 @@ |
1 | -#!/usr/bin/env ruby | |
2 | - | |
3 | -# These just forward the signals to the whole process group and | |
4 | -# then immediately exit. | |
5 | -pgid = Process.getpgid Process.pid | |
6 | -Signal.trap(:TERM) { Process.kill(:TERM, -pgid); exit } | |
7 | -Signal.trap(:INT) { Process.kill(:INT, -pgid); exit } | |
8 | - | |
9 | -def run command, options = {} | |
10 | - command = "#{command} 2>&1 > /dev/null" if options[:output] == false | |
11 | - #command = "time #{command}" unless options[:runtime] == false | |
12 | - puts "== #{command}" | |
13 | - system command | |
14 | -end | |
15 | - | |
16 | -@id = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join | |
17 | -@db = "gitlab-ci-#{@id}" | |
18 | - | |
19 | -def config | |
20 | - require 'yaml' | |
21 | - db_config = { | |
22 | - 'adapter' => 'postgresql', 'encoding' => 'unicode', | |
23 | - 'database' => @db, 'username' => ENV['USER'], | |
24 | - } | |
25 | - File.write 'config/database.yml', YAML.dump('test' => db_config, 'development' => db_config) | |
26 | -end | |
27 | - | |
28 | -def prepare | |
29 | - run("createdb #{@db}") and | |
30 | - run('mkdir -p tmp/pids log') and | |
31 | - run('bundle check || bundle install') and | |
32 | - run('rake db:schema:load', output: false) and | |
33 | - run('script/noosfero-plugins disableall') and | |
34 | - run('rake db:migrate') | |
35 | -end | |
36 | - | |
37 | -def test | |
38 | - %w[ | |
39 | - test:units | |
40 | - test:functionals | |
41 | - test:integration | |
42 | - cucumber | |
43 | - test:noosfero_plugins | |
44 | - ].each do |task| | |
45 | - run "rake #{task}" | |
46 | - end | |
47 | -end | |
48 | - | |
49 | -def cleanup | |
50 | - run "dropdb #{@db}" | |
51 | -end | |
52 | - | |
53 | -ret = config and prepare and test | |
54 | -cleanup | |
55 | - | |
56 | -exit (if ret == true then 0 else 1 end) |