diff --git a/.travis.yml b/.travis.yml index add05a621a..dde8c3080f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,37 @@ language: python cache: pip + +service: + - posgresql + - mysql + python: - - "3.6" -sudo: false + - "3.7" + +env: + - TESTING_DB=sqlite3 + - TESTING_DB=postgresql + - TESTING_DB=mysql + +before_install: + - psql -c "CREATE USER evennia WITH PASSWORD 'password'; CREATE DATABASE evennia; GRANT ALL PRIVILEGES ON DATABASE evennia TO evennia;'" + - mysql -e "CREATE USER 'evennia'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE evennia; ALTER DATABASE `evennia` CHARACTER SET utf8; GRANT ALL PRIVILEGES ON evennia.* TO 'evennia'@'localost'; FLUSH PRIVILEGES;" + install: + - pip install psycopg2-binary + - pip install mysqlclient - pip install -e . - pip install coveralls + before_script: - - evennia --init dummy - - cd dummy + - python -VV + - evennia --init testing_mygame + - cp .travis/testing_settings.py testing_mygame/server/conf/settings.py + - cd testing_mygame - evennia migrate + script: - coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test evennia + after_success: - coveralls diff --git a/.travis/testing_settings.py b/.travis/testing_settings.py new file mode 100644 index 0000000000..46a53e4396 --- /dev/null +++ b/.travis/testing_settings.py @@ -0,0 +1,72 @@ +""" +Evennia settings file. + +The available options are found in the default settings file found +here: + +/home/griatch/Devel/Home/evennia/evennia/evennia/settings_default.py + +Remember: + +Don't copy more from the default file than you actually intend to +change; this will make sure that you don't overload upstream updates +unnecessarily. + +When changing a setting requiring a file system path (like +path/to/actual/file.py), use GAME_DIR and EVENNIA_DIR to reference +your game folder and the Evennia library folders respectively. Python +paths (path.to.module) should be given relative to the game's root +folder (typeclasses.foo) whereas paths within the Evennia library +needs to be given explicitly (evennia.foo). + +If you want to share your game dir, including its settings, you can +put secret game- or server-specific settings in secret_settings.py. + +""" + +import os + +# Use the defaults from Evennia unless explicitly overridden +from evennia.settings_default import * + +###################################################################### +# Evennia base server config +###################################################################### + +# This is the name of your game. Make it catchy! +SERVERNAME = "testing_mygame" + +# Testing database types + +if os.environ.get("TESTING_DB") == "postgresql": + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'evennia', + 'USER': 'evennia', + 'PASSWORD': '', + 'HOST': 'localhost', + 'PORT': '' # use default + }} +elif os.environ.get("TESTING_DB") == "mysql": + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'evennia', + 'USER': 'evennia', + 'PASSWORD': '', + 'HOST': 'localhost', # or an IP Address that your DB is hosted on + 'PORT': '', # use default port + } + } +else: # default sqlite3, use default settings + pass + + +###################################################################### +# Settings given in secret_settings.py override those in this file. +###################################################################### +try: + from server.conf.secret_settings import * +except ImportError: + print("secret_settings.py file not found or failed to import.")