You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
2.0 KiB

sudo: required
dist: "bionic"
- docker
language: python
- "3.6"
# 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' /etc/resolv.conf > /tmp/ # replace the nameserver with Google's
- sudo mv /tmp/ /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 .
- sudo python3 -m pytest --cov=./ -sv tests/ --tb=short
- bash <(curl -s -t 83a45966-78ce-44c2-80b3-964ecab4a53d || echo "Codecov did not collect coverage reports"