sudo: required
language: python
dist: trusty
python:
  - "2.7"
after_success:
  - codecov
virtualenv:
  system_site_packages: true
install:
  - echo "127.0.0.1 localhost" | sudo tee /etc/hosts
  - echo "127.0.1.1 ca.example.lan ca" | sudo tee -a /etc/hosts
  - echo "127.0.0.1 vpn.koodur.lan" | sudo tee -a /etc/hosts
  - sudo mkdir -p /etc/systemd/system
  - sudo pip install -r requirements.txt
  - sudo pip install codecov pytest-cov
  - sudo pip install -e .
script:
  - sudo find /home/ -type d -exec chmod 755 {} \;
  - sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
  - sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
  - sudo adduser --system --no-create-home --group certidude
  - sudo coverage run --parallel-mode --source certidude -m py.test tests
  - sudo coverage combine
  - sudo coverage report
  - sudo coverage xml
cache:
  directories:
    - $HOME/.cache/pip
addons:
  hostname: ca
  apt:
    packages:
    - python-configparser

sudo: required
language: python
dist: trusty
python:
  - "2.7"
after_success:
  - codecov
virtualenv:
  system_site_packages: true
install:
  - echo "127.0.0.1 localhost" | sudo tee /etc/hosts
  - echo "127.0.1.1 ca.example.lan ca" | sudo tee -a /etc/hosts
  - echo "127.0.0.1 vpn.koodur.lan" | sudo tee -a /etc/hosts
  - sudo mkdir -p /etc/systemd/system
  - sudo pip install -r requirements.txt
  - sudo pip install codecov pytest-cov
  - sudo pip install -e .
script:
  - sudo find /home/ -type d -exec chmod 755 {} \; # Allow certidude serve to read templates
  - sudo useradd adminbot -G sudo -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
  - sudo useradd userbot -G users -p '$1$PBkf5waA$n9EV6WJ7PS6lyGWkgeTPf1'
  - sudo adduser --system --no-create-home --group certidude
  - sudo chmod 777 . # Allow forked processes to write .coverage files
  - sudo coverage run --parallel-mode --source certidude -m py.test tests
  - sudo coverage combine
  - sudo coverage report
  - sudo coverage xml
cache:
  directories:
    - $HOME/.cache/pip
addons:
  hostname: ca
  apt:
    packages:
    - python-configparser

Allow coverage to write output from forked processes
tests: Allow coverage to write output from forked processes
