sudo: required

services:
- docker

language: php

addons:
  apt:
    packages:
    - expect

php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'

before_script:
- sudo apt-get update
- sudo apt-get install -y expect
- docker pull evilfreelancer/docker-routeros:6.42
- docker pull evilfreelancer/docker-routeros:latest
- docker run --device=/dev/net/tun --cap-add NET_ADMIN -d -p 12223:23 -p 18728:8728 -p 18729:8729 -ti evilfreelancer/docker-routeros:6.42
- docker run --device=/dev/net/tun --cap-add NET_ADMIN -d -p 22223:23 -p 8728:8728 -p 8729:8729 -ti evilfreelancer/docker-routeros:latest
- docker ps -a
- sleep 60
- ./preconf.tcl 12223 > /dev/null || true
- ./preconf.tcl 22223 > /dev/null || true
- composer self-update
- composer install --no-interaction --dev

script:
- vendor/bin/phpunit --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
