Commit e5baa796 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

CI: Configure the project for GitLab's CI

* use headless Chromium as the browser for selenium and karma tests
* make database host configurable for developer setting
* add .gitlab-ci.yml
* remove .travis.yml
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent c04497c7
......@@ -15,7 +15,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
dist: trusty
language: python
python:
- 3.6
cache: pip
addons:
apt:
packages:
- libmysqlclient-dev
firefox: "52.0esr"
services:
- mysql
before_install:
- firefox --version
install:
- npm install -g jshint
- npm install -g jasmine-core
- npm install -g karma
- npm install -g karma-jasmine
- npm install -g karma-firefox-launcher
- wget https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-linux64.tar.gz
- mkdir geckodriver
- tar -xzf geckodriver-v0.17.0-linux64.tar.gz -C geckodriver
- export PATH=$PATH:$PWD/geckodriver
- geckodriver --version
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3 # give xvfb some time to start
before_script:
- mysql -e 'create database patchwork;'
- export SELENIUM_BROWSER=firefox
- export PW_TEST_DB_USER=travis
- export PW_TEST_DB_PASS=""
- env | grep ^TRAVIS
script: ./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