Add Travis CI testing

This commit is contained in:
Amin Vakil 2020-05-20 12:18:03 +04:30
parent b120d7b3be
commit c21761f351
No known key found for this signature in database
GPG key ID: 1EFC1864E9D9E56B

27
.travis.yml Normal file
View file

@ -0,0 +1,27 @@
os: linux
dist: bionic
language: shell
git:
quiet: true
env:
global:
- HADOLINT_VERSION=1.17.6
services:
- docker
before_install:
- sudo curl -L https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VERSION/hadolint-$(uname -s)-$(uname -m) -o /usr/local/bin/hadolint
- sudo chmod 755 /usr/local/bin/hadolint
- CLIENT_PORT=$(cat /dev/urandom|od -N2 -An -i|awk -v f=10000 -v r=19999 '{printf "%i\n", f + r * $1 / 65536}')
- [ $(netstat -an | grep LISTEN | grep :$CLIENT_PORT | wc -l) -eq 0 ] || { ./$0 && exit 0 || exit 1; }
install:
- docker build
--no-cache
--tag ${TRAVIS_REPO_SLUG}:${TRAVIS_COMMIT} .
script:
- DOCKERCONTAINER=$(docker run -d ${TRAVIS_REPO_SLUG}:${TRAVIS_COMMIT} -p 127.0.0.1:${CLIENT_PORT}:21 -e ADDRESS=ftp.example.com)
- sleep 5
- nc localhost ${CLIENT_PORT} < /dev/null || exit 1
- sleep 10
- docker ps -f id=${DOCKERCONTAINER}
- hadolint Dockerfile
- docker stop ${DOCKERCONTAINER} && docker rm -fv ${DOCKERCONTAINER}