Commit a93f46b0 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

CI: Configure project for gitlab

* Use headless Chromium as the browser for selenium and karma tests.
* Make database host configurable for developer setting.
* Add .gitlab-ci.yml
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 100772ba
Pipeline #1301 canceled with stage
in 1 minute and 5 seconds
......@@ -16,6 +16,7 @@ tags
TAGS
!.gitignore
!.travis.yml
!.gitlab-ci.yml
# configuration files
patchwork/settings/production.py
......
image: python:3.6
services:
- mariadb:latest
variables:
PW_TEST_DB_HOST: 'mariadb'
PW_TEST_DB_USER: 'root'
MYSQL_DATABASE: 'patchwork'
MYSQL_ROOT_PASSWORD: 'password'
DEBIAN_FRONTEND: 'noninteractive'
CHROME_BIN: '/usr/bin/chromium'
before_script:
- apt-get -qq update
- apt-get -qq install libmariadbclient-dev
- apt-get -qq install python-virtualenv python3-virtualenv python-pip python3-pip
- apt-get -qq install chromium chromium-driver
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get -qq install nodejs
- npm install -g jshint jasmine-core karma karma-jasmine karma-chrome-launcher
test:
script:
- python3 -V
- python2 -V
- npm --version
- chromium --version
- chromedriver --version
- ./tests/test_all.sh
......@@ -28,7 +28,7 @@ DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': 'localhost',
'HOST': os.getenv('PW_TEST_DB_HOST', 'localhost'),
'PORT': '',
'USER': os.getenv('PW_TEST_DB_USER', 'patchwork'),
'PASSWORD': os.getenv('PW_TEST_DB_PASS', 'password'),
......
......@@ -104,8 +104,12 @@ class SeleniumTestCase(StaticLiveServerTestCase):
if self.browser == 'firefox':
self.selenium = webdriver.Firefox()
if self.browser == 'chrome':
options = webdriver.ChromeOptions()
options.add_argument("--no-sandbox")
options.set_headless(True)
self.selenium = webdriver.Chrome(
service_args=["--verbose", "--log-path=selenium.log"]
service_args=["--verbose", "--log-path=selenium.log"],
options=options
)
mkdir(self._SCREENSHOT_DIR)
......
......@@ -58,7 +58,14 @@ module.exports = function(config) {
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],
browsers: ['ChromiumHeadlessNoSandbox'],
customLaunchers: {
ChromiumHeadlessNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox']
}
},
// Continuous Integration mode
......
......@@ -12,8 +12,8 @@ setenv =
DJANGO_SETTINGS_MODULE = patchwork.settings.dev
passenv =
http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS DISPLAY
PATCHWORK_SKIP_BROWSER_TESTS SELENIUM_BROWSER
PW_TEST_DB_HOST PW_TEST_DB_TYPE PW_TEST_DB_USER PW_TEST_DB_PASS
DISPLAY PATCHWORK_SKIP_BROWSER_TESTS SELENIUM_BROWSER CHROME_BIN
commands =
{toxinidir}/manage.py test --noinput '{posargs:patchwork}'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment