Imported from 612f25c533/travis-ci
This commit is contained in:
Lukas Reschke 2016-06-27 13:45:15 +02:00
Родитель 78607a8369
Коммит 22c8d5d897
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9AB0ADB949B6898C
5 изменённых файлов: 414 добавлений и 0 удалений

62
before_install.sh Executable file
Просмотреть файл

@ -0,0 +1,62 @@
#!/bin/bash
#
# ownCloud
#
# @author Thomas Müller
# @copyright 2014 Thomas Müller thomas.mueller@tmit.eu
#
set -e
WORKDIR=$PWD
APP_NAME=$1
CORE_BRANCH=$2
DB=$3
echo "Work directory: $WORKDIR"
echo "Database: $DB"
cd ..
git clone --depth 1 -b $CORE_BRANCH https://github.com/nextcloud/server
cd core
git submodule update --init
cd apps
cp -R ../../$APP_NAME/ .
cd $WORKDIR
if [ "$DB" == "mysql" ] ; then
echo "Setting up mysql ..."
mysql -e 'create database oc_autotest;'
mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud'";
mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost'";
mysql -e "SELECT User FROM mysql.user;"
fi
if [ "$DB" == "pgsql" ] ; then
createuser -U travis -s oc_autotest
fi
if [ "$DB" == "oracle" ] ; then
if [ ! -f before_install_oracle.sh ]; then
wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install_oracle.sh
fi
bash ./before_install_oracle.sh
fi
#
# copy custom php.ini settings
#
wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/custom.ini
if [ $(phpenv version-name) != 'hhvm' ]; then
phpenv config-add custom.ini
fi
#
# copy install script
#
cd ../core
if [ ! -f core_install.sh ]; then
wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/core_install.sh
fi
bash ./core_install.sh $DB

139
before_install_oracle.sh Executable file
Просмотреть файл

@ -0,0 +1,139 @@
#!/bin/bash
# Script performs non-interactive installation of Oracle XE 10g on Debian
#
# Based on oracle10g-update.sh from HTSQL project:
# https://bitbucket.org/prometheus/htsql
#
# Modified by Mateusz Loskot <mateusz@loskot.net>
# Changes:
# - Add fake swap support (backup /usr/bin/free manually anyway!)
#
# Modified by Peter Butkovic <butkovic@gmail.com> to enable i386 install on amd64 architecture (precise 64)
# based on: http://www.ubuntugeek.com/how-to-install-oracle-10g-xe-in-64-bit-ubuntu.html
#
# set -ex
#
# Utilities
#
function free_backup()
{
# Multiple copies to be on safe side
sudo cp /usr/bin/free /root
sudo mv /usr/bin/free /usr/bin/free.original
}
function free_restore()
{
sudo cp /usr/bin/free.original /usr/bin/free
}
# Install fake free
# http://www.axelog.de/2010/02/7-oracle-ee-refused-to-install-into-openvz/
free_backup
sudo tee /usr/bin/free <<EOF > /dev/null
#!/bin/sh
cat <<__eof
total used free shared buffers cached
Mem: 1048576 327264 721312 0 0 0
-/+ buffers/cache: 327264 721312
Swap: 2000000 0 2000000
__eof
exit
EOF
sudo chmod 755 /usr/bin/free
#
# ok, bc, is the dependency that is required by DB2 as well => let's remove it from oracle xe dependencies and provide 64bit one only
#
sudo apt-get update
#sudo apt-get -qq --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
# Install the Oracle 10g dependant packages
sudo apt-get install -qq --force-yes libc6:i386
# travis needs the "apt-transport-https" to enable https transport
sudo apt-get install -qq bc apt-transport-https
# add Oracle repo + key (please note https is a must here, otherwise "apt-get update" fails for this repo with the "Undetermined error")
sudo bash -c 'echo "deb https://oss.oracle.com/debian/ unstable main non-free" >/etc/apt/sources.list.d/oracle.list'
wget -q https://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
sudo apt-get --allow-unauthenticated update -qq
# only download the package, to manually install afterwards
sudo apt-get install -qq --force-yes -d oracle-xe-universal:i386
sudo apt-get install -qq --force-yes libaio:i386
# remove key + repo (to prevent failures on next updates)
sudo apt-key del B38A8516
sudo bash -c 'rm -rf /etc/apt/sources.list.d/oracle.list'
sudo apt-get update -qq
sudo apt-get autoremove -qq
# remove bc from the dependencies of the oracle-xe-universal package (to keep 64bit one installed)
mkdir /tmp/oracle_unpack
dpkg-deb -x /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb /tmp/oracle_unpack
cd /tmp/oracle_unpack
dpkg-deb --control /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb
sed -i "s/,\ bc//g" /tmp/oracle_unpack/DEBIAN/control
mkdir /tmp/oracle_repack
dpkg -b /tmp/oracle_unpack /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
# install Oracle 10g with the fixed dependencies, to prevent i386/amd64 conflicts on bc package
sudo dpkg -i --force-architecture /tmp/oracle_repack/oracle-xe-universal_fixed_10.2.0.1-1.1_i386.deb
# Fix the problem when the configuration script eats the last
# character of the password if it is 'n': replace IFS="\n" with IFS=$'\n'.
sudo sed -i -e s/IFS=\"\\\\n\"/IFS=\$\'\\\\n\'/ /etc/init.d/oracle-xe
# change shebang of nls_lang.sh
sudo sed -i 's/#!\/bin\/sh/#!\/bin\/bash/' /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
# Configure the server; provide the answers for the following questions:
# The HTTP port for Oracle Application Express: 8080
# A port for the database listener: 1521
# The password for the SYS and SYSTEM database accounts: admin
# Start the server on boot: yes
sudo /etc/init.d/oracle-xe configure <<END
8080
1521
admin
admin
y
END
# Load Oracle environment variables so that we could run `sqlplus`.
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
# Increase the number of connections.
echo "ALTER SYSTEM SET PROCESSES=40 SCOPE=SPFILE;" | \
sqlplus -S -L sys/admin AS SYSDBA
# Set Oracle environment variables on login.
cat <<END >>~/.bashrc
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
END
free_restore
# build php module
git clone https://github.com/DeepDiver1975/oracle_instant_client_for_ubuntu_64bit.git instantclient
cd instantclient
sudo bash -c 'printf "\n" | python system_setup.py'
sudo mkdir -p /usr/lib/oracle/11.2/client64/rdbms/
sudo ln -s /usr/include/oracle/11.2/client64/ /usr/lib/oracle/11.2/client64/rdbms/public
sudo apt-get install -qq --force-yes libaio1
if [ "$TRAVIS_PHP_VERSION" == "7" ] ; then
printf "/usr/lib/oracle/11.2/client64\n" | pecl install oci8
else
printf "/usr/lib/oracle/11.2/client64\n" | pecl install oci8-2.0.10
fi
cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# add travis user to oracle user group - necessary for execution of sqlplus
sudo adduser travis dba

183
core_install.sh Executable file
Просмотреть файл

@ -0,0 +1,183 @@
#!/bin/bash
#
# ownCloud
#
# @author Thomas Müller
# @copyright 2014 Thomas Müller thomas.mueller@tmit.eu
#
set -e
DATABASENAME=oc_autotest
DATABASEUSER=oc_autotest
ADMINLOGIN=admin
BASEDIR=$PWD
DBCONFIGS="sqlite mysql pgsql oracle"
PHPUNIT=$(which phpunit)
# set oracle home if it is not set
TRAVIS_ORACLE_HOME="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server"
[ -z "$ORACLE_HOME" ] && ORACLE_HOME=$TRAVIS_ORACLE_HOME
if [ $1 ]; then
FOUND=0
for DBCONFIG in $DBCONFIGS; do
if [ $1 = $DBCONFIG ]; then
FOUND=1
break
fi
done
if [ $FOUND = 0 ]; then
echo -e "Unknown database config name \"$1\"\n" >&2
print_syntax
exit 2
fi
fi
# use tmpfs for datadir - should speedup unit test execution
DATADIR=$BASEDIR/data-autotest
echo "Using database $DATABASENAME"
# create autoconfig for sqlite, mysql and postgresql
cat > ./tests/autoconfig-sqlite.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'sqlite',
'dbtableprefix' => 'oc_',
'adminlogin' => '$ADMINLOGIN',
'adminpass' => 'admin',
'directory' => '$DATADIR',
);
DELIM
cat > ./tests/autoconfig-mysql.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'mysql',
'dbtableprefix' => 'oc_',
'adminlogin' => '$ADMINLOGIN',
'adminpass' => 'admin',
'directory' => '$DATADIR',
'dbuser' => '$DATABASEUSER',
'dbname' => '$DATABASENAME',
'dbhost' => 'localhost',
'dbpass' => 'owncloud',
);
DELIM
cat > ./tests/autoconfig-pgsql.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'pgsql',
'dbtableprefix' => 'oc_',
'adminlogin' => '$ADMINLOGIN',
'adminpass' => 'admin',
'directory' => '$DATADIR',
'dbuser' => '$DATABASEUSER',
'dbname' => '$DATABASENAME',
'dbhost' => 'localhost',
'dbpass' => '',
);
DELIM
cat > ./tests/autoconfig-oracle.php <<DELIM
<?php
\$AUTOCONFIG = array (
'installed' => false,
'dbtype' => 'oci',
'dbtableprefix' => 'oc_',
'adminlogin' => '$ADMINLOGIN',
'adminpass' => 'admin',
'directory' => '$DATADIR',
'dbuser' => '$DATABASENAME',
'dbname' => 'XE',
'dbhost' => 'localhost',
'dbpass' => 'owncloud',
'loglevel' => 0,
);
DELIM
function execute_tests {
echo "Setup environment for $1 testing ..."
# back to root folder
cd $BASEDIR
# revert changes to tests/data
git checkout tests/data/*
# reset data directory
rm -rf $DATADIR
mkdir $DATADIR
cp tests/preseed-config.php config/config.php
if [ "$1" == "oracle" ] ; then
echo "Load Oracle environment variables so that we can run 'sqlplus'."
. $ORACLE_HOME/bin/oracle_env.sh
echo "create the database"
sqlplus -s -l / as sysdba <<EOF
create user $DATABASENAME identified by owncloud;
alter user $DATABASENAME default tablespace users
temporary tablespace temp
quota unlimited on users;
grant create session
, create table
, create procedure
, create sequence
, create trigger
, create view
, create synonym
, alter session
to $DATABASENAME;
exit;
EOF
fi
# copy autoconfig
cp $BASEDIR/tests/autoconfig-$1.php $BASEDIR/config/autoconfig.php
# trigger installation
echo "INDEX"
php -f index.php
echo "END INDEX"
#test execution
cd tests
#php -f enable_all.php
}
#
# start test execution
#
if [ -z "$1" ]
then
# run all known database configs
for DBCONFIG in $DBCONFIGS; do
execute_tests $DBCONFIG
done
else
execute_tests $1 $2 $3
fi
# show environment
echo "owncloud configuration:"
cat $BASEDIR/config/config.php
echo "data directory:"
ls -ll $DATADIR
echo "owncloud.log:"
[ -f "$DATADIR/owncloud.log" ] && cat $DATADIR/owncloud.log
[ -f "$BASEDIR/data/owncloud.log" ] && cat $BASEDIR/data/owncloud.log
cd $BASEDIR

5
custom.ini Normal file
Просмотреть файл

@ -0,0 +1,5 @@
always_populate_raw_post_data = -1
mbstring.func_overload = 0
always_populate_raw_post_data = -1
default_charset = 'UTF-8'
output_buffering = off

25
setup_databases.sh Executable file
Просмотреть файл

@ -0,0 +1,25 @@
#!/bin/bash
#
# ownCloud
#
# @author Thomas Müller
# @copyright 2014 Thomas Müller thomas.mueller@tmit.eu
#
DB=$1
if [ "$DB" == "mysql" ] ; then
mysql -e 'create database oc_autotest;'
mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY 'owncloud'";
mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost'";
fi
if [ "$DB" == "pgsql" ] ; then
createuser -U travis -s oc_autotest
fi
if [ "$DB" == "oracle" ] ; then
if [ ! -f before_install_oracle.sh ]; then
wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install_oracle.sh
fi
bash ./before_install_oracle.sh
fi