-
Notifications
You must be signed in to change notification settings - Fork 10
/
.travis.yml
120 lines (109 loc) · 5.08 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
os: linux
dist: bionic
services: docker
language: shell
branches:
only:
- master
- develop
before_install:
- env | sort
- export TAG=travis
- export VCS_REF=`git rev-parse --short HEAD`
- export BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
- export IMAGE_NAME=docker-erpnext-template
- export home=$(pwd)
- export travis_dir="${home}/.travis"
- export BUILD_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}
- export BUILD_URL=https://github.com/${TRAVIS_PULL_REQUEST_SLUG:-${TRAVIS_REPO_SLUG}}
- export BUILD_APP=erpnext_template
install:
- echo "Changing to travis test directory ($travis_dir)"
- cd "$travis_dir"
# Prepare base image for build version and variant
- sed -i -e "s/%%VERSION%%/${VERSION}/g" Dockerfile.${VARIANT}
- sed -i -e "s/%%IMAGE_NAME%%/${IMAGE_NAME}/g" Dockerfile.test
# Test container build
- travis_retry travis_wait 60 docker-compose -f docker-compose.${DATABASE}.yml build
before_script:
- docker images
script:
- echo "Changing to travis test directory ($travis_dir)"
- cd "$travis_dir"
# Test container run
- travis_retry docker-compose -f docker-compose.${DATABASE}.yml up -d
- docker-compose -f docker-compose.${DATABASE}.yml logs -f "sut"
- docker-compose -f docker-compose.${DATABASE}.yml ps
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_db"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_db" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_app"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_app" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_web"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_web" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml ps "sut" | grep "Exit 0"
# Test container restart
- docker-compose -f docker-compose.${DATABASE}.yml down
- travis_retry docker-compose -f docker-compose.${DATABASE}.yml up -d
- docker-compose -f docker-compose.${DATABASE}.yml logs -f "sut"
- docker-compose -f docker-compose.${DATABASE}.yml ps
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_db"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_db" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_app"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_app" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_web"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_web" | grep "Up"
- docker-compose -f docker-compose.${DATABASE}.yml ps "sut" | grep "Exit 0"
after_script:
- echo "Changing to project directory ($home)"
- cd "$home"
- sudo pip install coverage==4.5.4
- sudo pip install python-coveralls
# Create same directory path as docker test execution
- sudo mkdir -p '/home/frappe/frappe-bench/apps'
- sudo ln -sf "$home" '/home/frappe/frappe-bench/apps/erpnext_template'
# Copy and convert coverage to XML format
- cp '/srv/erpnext/frappe/sites/.coverage' .coverage
- coverage report -m
- coverage xml
# Publish coverage to Coveralls
- coveralls -b "$home" -d "$home/.coverage"
# Publish coverage to Codacy
- test -z "$CODACY_PROJECT_TOKEN" || bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r "./coverage.xml"
# Publish coverage to Codecov
- test -z "$CODECOV_TOKEN" || bash <(curl -s https://codecov.io/bash)
notifications:
email: false
jobs:
allow_failures:
- env: VERSION=develop VARIANT=alpine DATABASE=mariadb
- env: VERSION=develop VARIANT=alpine DATABASE=postgres
- env: VERSION=develop VARIANT=debian DATABASE=mariadb
- env: VERSION=develop VARIANT=debian DATABASE=postgres
- env: VERSION=develop VARIANT=debian-slim DATABASE=mariadb
- env: VERSION=develop VARIANT=debian-slim DATABASE=postgres
- env: VERSION=12 VARIANT=alpine DATABASE=postgres
- env: VERSION=12 VARIANT=debian DATABASE=postgres
- env: VERSION=12 VARIANT=debian-slim DATABASE=postgres
# Stop supporting Frappe 10 and Python 2
- env: VERSION=10 VARIANT=alpine DATABASE=mariadb
- env: VERSION=10 VARIANT=debian DATABASE=mariadb
- env: VERSION=10 VARIANT=debian-slim DATABASE=mariadb
env: # Environments
- VERSION=develop VARIANT=alpine DATABASE=mariadb
- VERSION=develop VARIANT=alpine DATABASE=postgres
- VERSION=develop VARIANT=debian DATABASE=mariadb
- VERSION=develop VARIANT=debian DATABASE=postgres
- VERSION=develop VARIANT=debian-slim DATABASE=mariadb
- VERSION=develop VARIANT=debian-slim DATABASE=postgres
- VERSION=10 VARIANT=alpine DATABASE=mariadb
- VERSION=10 VARIANT=debian DATABASE=mariadb
- VERSION=10 VARIANT=debian-slim DATABASE=mariadb
- VERSION=11 VARIANT=alpine DATABASE=mariadb
- VERSION=11 VARIANT=debian DATABASE=mariadb
- VERSION=11 VARIANT=debian-slim DATABASE=mariadb
- VERSION=12 VARIANT=alpine DATABASE=mariadb
- VERSION=12 VARIANT=alpine DATABASE=postgres
- VERSION=12 VARIANT=debian DATABASE=mariadb
- VERSION=12 VARIANT=debian DATABASE=postgres
- VERSION=12 VARIANT=debian-slim DATABASE=mariadb
- VERSION=12 VARIANT=debian-slim DATABASE=postgres