mirror of
https://github.com/rickbarrette/stopwatch.git
synced 2026-04-02 01:41:58 -04:00
travis
This commit is contained in:
33
.travis.yml
Normal file
33
.travis.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
sudo: false
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.4.10
|
||||
- 2.5.8
|
||||
- 2.6.6
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
addons:
|
||||
postgresql: "9.6"
|
||||
|
||||
env:
|
||||
- REDMINE_VER=4.0-stable
|
||||
- REDMINE_VER=4.1-stable
|
||||
- REDMINE_VER=master
|
||||
|
||||
install: "echo skip bundle install"
|
||||
|
||||
before_script:
|
||||
- psql -c 'create database travis_ci_test;' -U postgres
|
||||
|
||||
script:
|
||||
- export TESTSPACE=`pwd`/testspace
|
||||
- export NAME_OF_PLUGIN=stopwatch
|
||||
- export PATH_TO_PLUGIN=`pwd`
|
||||
- export PATH_TO_REDMINE=$TESTSPACE/redmine
|
||||
- mkdir $TESTSPACE
|
||||
- cp test/support/* $TESTSPACE/
|
||||
- bash -x ./travis.sh
|
||||
|
||||
5
test/support/additional_environment.rb
Normal file
5
test/support/additional_environment.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# for travis debugging
|
||||
# config.logger = Logger.new(STDOUT)
|
||||
# config.logger.level = Logger::INFO
|
||||
# config.log_level = :info
|
||||
|
||||
8
test/support/database.yml.travis
Normal file
8
test/support/database.yml.travis
Normal file
@@ -0,0 +1,8 @@
|
||||
test:
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
pool: 5
|
||||
database: travis_ci_test
|
||||
user: postgres
|
||||
|
||||
|
||||
75
travis.sh
Normal file
75
travis.sh
Normal file
@@ -0,0 +1,75 @@
|
||||
#/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ ! "$TESTSPACE" = /* ]] ||
|
||||
[[ ! "$PATH_TO_REDMINE" = /* ]] ||
|
||||
[[ ! "$REDMINE_VER" = * ]] ||
|
||||
[[ ! "$NAME_OF_PLUGIN" = * ]] ||
|
||||
[[ ! "$PATH_TO_PLUGIN" = /* ]];
|
||||
then
|
||||
echo "You should set"\
|
||||
" TESTSPACE, PATH_TO_REDMINE, REDMINE_VER"\
|
||||
" NAME_OF_PLUGIN, PATH_TO_PLUGIN"\
|
||||
" environment variables"
|
||||
echo "You set:"\
|
||||
"$TESTSPACE"\
|
||||
"$PATH_TO_REDMINE"\
|
||||
"$REDMINE_VER"\
|
||||
"$NAME_OF_PLUGIN"\
|
||||
"$PATH_TO_PLUGIN"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export RAILS_ENV=test
|
||||
|
||||
export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
|
||||
export REDMINE_GIT_TAG=$REDMINE_VER
|
||||
export BUNDLE_GEMFILE=$PATH_TO_REDMINE/Gemfile
|
||||
|
||||
# checkout redmine
|
||||
git clone $REDMINE_GIT_REPO $PATH_TO_REDMINE
|
||||
cd $PATH_TO_REDMINE
|
||||
if [ ! "$REDMINE_GIT_TAG" = "master" ];
|
||||
then
|
||||
git checkout -b $REDMINE_GIT_TAG origin/$REDMINE_GIT_TAG
|
||||
fi
|
||||
|
||||
# create a link to the backlogs plugin
|
||||
ln -sf $PATH_TO_PLUGIN plugins/$NAME_OF_PLUGIN
|
||||
|
||||
mv $TESTSPACE/database.yml.travis config/database.yml
|
||||
mv $TESTSPACE/additional_environment.rb config/
|
||||
|
||||
cat << EOF > lib/tasks/00_nowarnings.rake
|
||||
require 'rake/testtask'
|
||||
|
||||
module NoWarnings
|
||||
def define(*_)
|
||||
self.warning = false
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
Rake::TestTask.prepend NoWarnings
|
||||
EOF
|
||||
|
||||
# install gems
|
||||
bundle install
|
||||
|
||||
# run redmine database migrations
|
||||
bundle exec rake db:migrate
|
||||
|
||||
# run plugin database migrations
|
||||
bundle exec rake redmine:plugins:migrate
|
||||
|
||||
# install redmine database
|
||||
#bundle exec rake redmine:load_default_data REDMINE_LANG=en
|
||||
|
||||
bundle exec rake db:structure:dump
|
||||
|
||||
# run tests
|
||||
# bundle exec rake TEST=test/unit/role_test.rb
|
||||
bundle exec rake redmine:plugins:test NAME=$NAME_OF_PLUGIN
|
||||
|
||||
|
||||
Reference in New Issue
Block a user