5849898283
Unit tests functional and coverage back to 100% Add more routes to dictionary, add more credentials, add default port 5554, rename cameradar logs ENV variable, improve unit test readability, remove tmp file
56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
dist: trusty
|
|
sudo: required
|
|
language: go
|
|
|
|
env:
|
|
- DEP_VERSION="0.5.0"
|
|
|
|
services:
|
|
- docker
|
|
|
|
before_install:
|
|
- echo "Testing Docker Hub credentials"
|
|
- if [[ "$DOCKER_PASSOWRD" != "" ]]; then docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD; fi
|
|
- echo "Docker Hub credentials are working"
|
|
# If I see one day that Travis CI updates their default docker version
|
|
# I can remove the lines below. That's why I leave this here :-)
|
|
- docker version
|
|
- sudo apt-get remove docker docker-engine docker.io
|
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
- sudo apt-get update
|
|
- sudo apt-get install -y docker-ce nmap
|
|
- go get github.com/mattn/goveralls
|
|
- docker version
|
|
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
|
|
- chmod +x $GOPATH/bin/dep
|
|
|
|
install:
|
|
- dep ensure
|
|
- docker build -t cameradar .
|
|
|
|
script:
|
|
# Run unit tests
|
|
- go test -v -covermode=count -coverprofile=coverage.out
|
|
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken=$COVERALLS_TOKEN
|
|
# Launch a fake camera to check if cameradar is able to access it
|
|
- docker run -d --name=fake_camera -e RTSP_USERNAME=admin -e RTSP_PASSWORD=12345 -p 8554:8554 ullaakut/rtspatt
|
|
# Launch cameradar on the local machine
|
|
- docker run --net=host -t cameradar -t 0.0.0.0 -l > logs.txt
|
|
- docker logs fake_camera > camera_logs.txt
|
|
# Stop the fake camera
|
|
- docker stop fake_camera
|
|
# Print logs
|
|
- cat camera_logs.txt
|
|
- cat logs.txt
|
|
# check if file contains more than one line
|
|
# 1 line: Error message because no streams were found
|
|
# More lines: Logs for all found cameras
|
|
- if [[ $(wc -l <logs.txt) -lt 2 ]]; then exit 1; fi
|
|
|
|
notifications:
|
|
email:
|
|
recipients:
|
|
- brendan.le-glaunec@epitech.eu
|
|
on_success: never
|
|
on_failure: always
|