geneva/.travis.yml

36 lines
2.0 KiB
YAML

sudo: required
dist: "bionic"
services:
- docker
language: python
python:
- "3.6"
install:
# Travis recently added systemd-resolvd to their VMs. We must disable this to test our own DNS server
- sudo systemctl disable systemd-resolved.service # First disable the service
- sudo systemctl stop systemd-resolved # Stop the service
- echo $(hostname -I | cut -d\ -f1) $(hostname) | sudo tee -a /etc/hosts # add back our hostname to /etc/hosts so sudo does not complain
- sudo sed 's/nameserver.*/nameserver 8.8.8.8/' /etc/resolv.conf > /tmp/resolv.conf.new # replace the 127.0.0.53 nameserver with Google's
- sudo mv /tmp/resolv.conf.new /etc/resolv.conf
- sudo systemctl start docker # must now restart docker so the resolv.conf changes propagate to its containers
- sudo apt-get clean # travis having mirror sync issues
- sudo apt-get update
- sudo apt-get -y install libnetfilter-queue-dev python3 python3-pip python3-setuptools graphviz
- printf "Defaults\tenv_reset\nDefaults\tmail_badpass\nDefaults\tsecure_path="/home/travis/virtualenv/python3.6.7/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"\nroot\tALL=(ALL:ALL) ALL\n#includedir /etc/sudoers.d\n" > /tmp/sudoers.tmp # Since sudo is required but travis does not set up the root environment, we must override the secure_path in sudoers in order for travis's setup to take effect for sudo commands
- sudo visudo -c -f /tmp/sudoers.tmp # Verify the sudoers file
- sudo cp /tmp/sudoers.tmp /etc/sudoers # Copy in the sudoers file
- sudo echo $PATH # Confirm the PATH changes took effect
- sudo python3 -m pip install -r requirements.txt
- sudo python3 -m pip install slackclient pytest-cov
- docker build -t base:latest -f docker/Dockerfile .
script:
- sudo python3 -m pytest --cov=./ -sv tests/ --tb=short
after_script:
- bash <(curl -s https://codecov.io/bash) -t 83a45966-78ce-44c2-80b3-964ecab4a53d || echo "Codecov did not collect coverage reports"