Skip to content
Permalink
Browse files

disable sqlite and use mysql on appveyor (#442)

fixes #441
use getopenpetra.sh on appveyor

* appveyor: use mysql instead of sqlite

* don't show warning if service file does not exist

* prepare dev environment for appveyor

* fixes for mysql on appveyor

* try to get npm on appveyor

* need test database for running tests on appveyor
  • Loading branch information
tpokorra committed Jan 31, 2020
1 parent 38f9e86 commit 54291c702590b8e4e15fd596575108814613fb0a
@@ -1,28 +1,24 @@
# see http://www.appveyor.com/docs/appveyor-yml
image: Ubuntu1804
version: 1.0.{build}
platform: x86
stack: mysql, node 10
clone_depth: 1
init: []
environment:
APPVEYOR_NODE: installed
APPVEYOR_MONO: installed
APPVEYOR_MYSQL: installed
MYSQL_ROOT_PWD: Password12!
install:
#- sudo echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
#- sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/mono-official-stable.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
#- sudo apt-get -y install mono-devel mono-runtime
- sudo apt-get -y install nant nunit-console libsodium23 mono-xsp4 wget xfonts-75dpi
- wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb && sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
- wget https://github.com/openpetra/demo-databases/raw/UsedForNUnitTests/demoWith1ledger.yml.gz
# to avoid errors like: error CS0433: The imported type `System.CodeDom.Compiler.CompilerError' is defined multiple times
- sudo rm -f /usr/lib/mono/4.5-api/System.dll
# prepare the config file
- echo '<?xml version="1.0"?>' > OpenPetra.build.config
- echo '<project name="OpenPetra-userconfig">' >> OpenPetra.build.config
- echo ' <property name="DBMS.Type" value="sqlite"/>' >> OpenPetra.build.config
- echo ' <property name="DBMS.Password" value=""/>' >> OpenPetra.build.config
- echo ' <property name="Server.Port" value="9000"/>' >> OpenPetra.build.config
- echo '</project>' >> OpenPetra.build.config
platform: x86
#- sudo -E ln -s `which npm` /usr/bin/npm
#- sudo -E chown -R 1001:1001 "/home/appveyor/.npm"
#- sudo sed -i "s/\[mysqld\]/[mysqld]\nskip-name-resolve/g" /etc/mysql/my.cnf && sudo systemctl restart mysql
- curl https://getopenpetra.com > getopenpetra.sh && chmod a+x getopenpetra.sh && sudo -E ./getopenpetra.sh devenv
build_script:
- nant generateSolution
- echo "building was already done in install section"
test_script:
- nant recreateDatabase resetDatabase test-without-display
- sudo -E sh -c "curl --silent --location https://github.com/openpetra/demo-databases/raw/UsedForNUnitTests/demoWith1ledger.yml.gz > /home/op_dev/openpetra/demoWith1ledger.yml.gz && chown op_dev:op_dev /home/op_dev/openpetra/demoWith1ledger.yml.gz"
- sudo -E sh -c "cd /home/op_dev/openpetra && nant resetDatabase test-without-display"
before_deploy:
- nant buildRPM
- sudo -E sh -c "cd /home/op_dev/openpetra && nant buildRPM"
@@ -53,7 +53,7 @@ public static bool LoadData(string AHostname, string ADatabaseName, string AUser
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
return false;
throw e;
}

DBAccessObj.WriteTransaction(ref WriteTransaction,
@@ -28,24 +28,25 @@
<include name="System.Threading.Tasks.Extensions.dll" /> <!-- Needed for Npgsql.dll -->
<include name="System.Runtime.CompilerServices.Unsafe.dll" /> <!-- Needed for Npgsql.dll -->
<include name="System.Memory.dll" /> <!-- Needed for Npgsql.dll -->
<include name="Mono.Security.dll" /> <!-- Needed for Npgsql.dll -->
<include name="MySql.Data.dll"/>
<include name="Mono.Data.Sqlite.dll"/>
<include name="sqlite3.dll"/>
<include name="ICSharpCode.SharpZipLib.dll"/>
<include name="ExcelLibrary.dll"/>
<include name="Jayrock.Json.dll"/>
<include name="Newtonsoft.Json.dll" />
<include name="ICSharpCode.NRefactory.dll"/> <!-- Winforms Generator -->
<include name="PasswordUtilities.dll"/>
<include name="Sodium.dll"/>
<include name="libsodium.dll"/>
<include name="libsodium-64.dll"/>
<include name="MailKit.dll"/>
<include name="MimeKit.dll"/>
<include name="HtmlAgilityPack.dll"/>
</patternset>

<patternset id="3rdPartyWinPattern">
<include name="Mono.Security.dll" /> <!-- Needed for Npgsql.dll -->
<include name="libsodium.dll"/>
<include name="libsodium-64.dll"/>
</patternset>

<patternset id="NunitPattern">
<include name="nunit.framework.dll"/>
</patternset>
@@ -60,6 +61,15 @@
</fileset>
</copy>
</foreach>
<if test="${'win32'==platform::get-name()}">
<foreach item="Folder" in="${dir.3rdParty}" property="foldername">
<copy todir="${dir.bin}">
<fileset basedir="${foldername}">
<patternset refid="3rdPartyWinPattern" />
</fileset>
</copy>
</foreach>
</if>
<echo message="Target ThirdParty compile finished at: ${datetime::now()}" />
</target>

@@ -18,9 +18,16 @@ export OPENPETRA_PORT=6700
export OPENPETRA_USER_PREFIX=op_
export THIS_SCRIPT=$0

if [[ ! -z "`cat /usr/lib/systemd/system/openpetra.service | grep postgresql`" ]]; then
servicefile=/usr/lib/systemd/system/openpetra.service
if [ ! -f $servicefile ]; then
servicefile=/lib/systemd/system/openpetra.service
fi

if [ -f $servicefile ]; then
if [[ ! -z "`cat $servicefile | grep postgresql`" ]]; then
export OPENPETRA_DBPORT=5432
export OPENPETRA_RDBMSType=postgresql
fi
fi

generatepwd() {
@@ -376,16 +383,20 @@ init() {
mysqlinitdb() {
mkdir -p $OpenPetraPath/tmp

if [ "$OPENPETRA_DBHOST" == "localhost" ]
if [ "$OPENPETRA_DBHOST" == "localhost" -o "$OPENPETRA_DBHOST" == "127.0.0.1" ]
then
echo "initialise database"
systemctl start mariadb
systemctl enable mariadb
echo "DROP DATABASE IF EXISTS \`$OPENPETRA_DBNAME\`;" > $OpenPetraPath/tmp/createdb-MySQL.sql
echo "CREATE DATABASE IF NOT EXISTS \`$OPENPETRA_DBNAME\`;" >> $OpenPetraPath/tmp/createdb-MySQL.sql
echo "USE \`$OPENPETRA_DBNAME\`;" >> $OpenPetraPath/tmp/createdb-MySQL.sql
echo "GRANT ALL ON \`$OPENPETRA_DBNAME\`.* TO \`$OPENPETRA_DBUSER\`@localhost IDENTIFIED BY '$OPENPETRA_DBPWD'" >> $OpenPetraPath/tmp/createdb-MySQL.sql
mysql -u root --host=$OPENPETRA_DBHOST --port=$OPENPETRA_DBPORT < $OpenPetraPath/tmp/createdb-MySQL.sql
echo "GRANT ALL ON \`$OPENPETRA_DBNAME\`.* TO \`$OPENPETRA_DBUSER\`@'%' IDENTIFIED BY '$OPENPETRA_DBPWD'" >> $OpenPetraPath/tmp/createdb-MySQL.sql
if [ ! -z "$MYSQL_ROOT_PWD" ]; then
mysql -u root --host=$OPENPETRA_DBHOST --port=$OPENPETRA_DBPORT --password="$MYSQL_ROOT_PWD" < $OpenPetraPath/tmp/createdb-MySQL.sql || exit -1
else
mysql -u root --host=$OPENPETRA_DBHOST --port=$OPENPETRA_DBPORT < $OpenPetraPath/tmp/createdb-MySQL.sql || exit -1
fi
rm -f $OpenPetraPath/tmp/createdb-MySQL.sql
fi
echo "creating tables..."

0 comments on commit 54291c7

Please sign in to comment.
You can’t perform that action at this time.