-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
executable file
·44 lines (35 loc) · 1.31 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
sudo: required
language: python
python:
- 3.6
install:
- pip install flake8
services:
- docker
notifications:
email: false
branches:
only:
- master
before_install:
# Update docker
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo apt-get update
- sudo apt-get -y install docker-ce
# Build docker image
- docker build -t $DOCKER_USERNAME/universitybot .
# run docker container
- mv ./config/config.example.json ./config/config.json
- sed -i "s/123456789:qwertyuiopasdfghjklzxcvbnm123456789/$TELEGRAM_STAGINGBOT_TOKEN/g" config/config.json
- docker run -d --name=universitybot -v $TRAVIS_BUILD_DIR/logs:/opt/UniversityBot/logs -v $TRAVIS_BUILD_DIR/cache:/opt/UniversityBot/cache -v $TRAVIS_BUILD_DIR/config:/opt/UniversityBot/config --restart=on-failure:10 $DOCKER_USERNAME/universitybot
- docker ps -a
- docker stats --no-stream
after_success:
# Update online image
- if [ "$TRAVIS_BRANCH" == "master" ]; then if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "$DOCKER_PASSWORD" | docker login -u="$DOCKER_USERNAME" --password-stdin;
docker push $DOCKER_USERNAME/universitybot;
fi; fi;
script:
- flake8 . --max-line-length=120