-
Notifications
You must be signed in to change notification settings - Fork 15
/
.travis.yml
133 lines (122 loc) · 6.04 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
121
122
123
124
125
126
127
128
129
130
131
132
133
os: linux
dist: trusty
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=erpnext_autoinstall
- 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}}
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 && sleep 60
- 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" || exit 1
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_app"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_app" | grep "Up" || exit 1
- docker-compose -f docker-compose.${DATABASE}.yml logs "erpnext_web"
- docker-compose -f docker-compose.${DATABASE}.yml ps "erpnext_web" | grep "Up" || exit 1
- echo 'Wait until sites and apps database installed (9-10 minutes)' && travis_wait 15 sleep 720
- 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"
- echo 'Wait until test finished (3 minutes)' && sleep 180
- docker-compose -f docker-compose.${DATABASE}.yml logs "sut"
- 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 && sleep 60
- 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"
- echo 'Wait until test finished (3 minutes)' && sleep 180
- docker-compose -f docker-compose.${DATABASE}.yml logs "sut"
- 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
- curl https://deepsource.io/cli | sudo sh
# 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_autoinstall'
# Copy and convert coverage to XML format
- cp '/srv/erpnext/frappe/sites/.coverage' .coverage
- coverage xml
- coverage report -m
# 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)
# Publish coverage to DeepSource
- export DEEPSOURCE_DSN=https://[email protected]
- ./bin/deepsource report --analyzer test-coverage --key python --value-file ./coverage.xml
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