-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.travis.yml
144 lines (133 loc) · 7.33 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
134
135
136
137
138
139
140
141
142
143
144
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 home=$(pwd)
- export travis_dir="${home}/images/${VERSION}-${BENCH}/${VARIANT}"
- export IMAGE_NAME="docker-frappe-travis:${TAG}"
install:
- echo "Changing to travis test directory ($travis_dir)"
- cd "$travis_dir"
# Prepare test image for local build version and variant
- sed -i -e "s|FROM monogramm/docker-frappe:.*|FROM ${IMAGE_NAME}|g" test/Dockerfile
# Test container build
- travis_retry docker-compose -f "docker-compose.${DATABASE}.yml" build
before_script:
- docker images
# Set permissions for persistence
- mkdir -p '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs'
- chown 1000:1000 '/srv/erpnext/frappe/sites' '/srv/erpnext/frappe/logs'
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 "frappe_db"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_db" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" logs "frappe_app"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_app" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" logs "frappe_web"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_web" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "sut" | grep "Exit 0"
# Test container db reinstall
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" bench reinstall --help
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" bench reinstall --yes && sleep 20
# 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 "frappe_db"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_db" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" logs "frappe_app"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_app" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" logs "frappe_web"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "frappe_web" | grep "Up"
- docker-compose -f "docker-compose.${DATABASE}.yml" ps "sut" | grep "Exit 0"
# Test container migrate
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" bench migrate --help
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" migrate
# Test container backup
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" bench backup --help
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" backup && sleep 5
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" backup && sleep 5
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" backup && sleep 5
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" backup && sleep 5
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" backup && sleep 5
# Test container restore
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" bench restore --help
# Test container "old" restore (file number instead of file name)
- docker-compose -f "docker-compose.${DATABASE}.yml" run --rm "frappe_app" restore 1
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 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 BENCH=master VARIANT=alpine DATABASE=postgres
- env: VERSION=develop BENCH=master VARIANT=alpine DATABASE=mariadb
- env: VERSION=develop BENCH=master VARIANT=slim-buster DATABASE=postgres
- env: VERSION=develop BENCH=master VARIANT=slim-buster DATABASE=mariadb
- env: VERSION=develop BENCH=master VARIANT=buster DATABASE=postgres
- env: VERSION=develop BENCH=master VARIANT=buster DATABASE=mariadb
- env: VERSION=12 BENCH=master VARIANT=alpine DATABASE=postgres
- env: VERSION=12 BENCH=master VARIANT=slim-buster DATABASE=postgres
- env: VERSION=12 BENCH=master VARIANT=buster DATABASE=postgres
- env: VERSION=13 BENCH=master VARIANT=alpine DATABASE=postgres
- env: VERSION=13 BENCH=master VARIANT=alpine DATABASE=mariadb
- env: VERSION=13 BENCH=master VARIANT=slim-buster DATABASE=postgres
- env: VERSION=13 BENCH=master VARIANT=slim-buster DATABASE=mariadb
- env: VERSION=13 BENCH=master VARIANT=buster DATABASE=postgres
- env: VERSION=13 BENCH=master VARIANT=buster DATABASE=mariadb
# Stop supporting Frappe 10 and Python 2
- env: VERSION=10.x BENCH=master VARIANT=alpine DATABASE=mariadb
- env: VERSION=10.x BENCH=master VARIANT=slim-buster DATABASE=mariadb
- env: VERSION=10.x BENCH=master VARIANT=buster DATABASE=mariadb
env: # Environments
- VERSION=11 BENCH=master VARIANT=alpine DATABASE=mariadb
- VERSION=11 BENCH=master VARIANT=slim-buster DATABASE=mariadb
- VERSION=11 BENCH=master VARIANT=buster DATABASE=mariadb
- VERSION=12 BENCH=master VARIANT=alpine DATABASE=postgres
- VERSION=12 BENCH=master VARIANT=alpine DATABASE=mariadb
- VERSION=12 BENCH=master VARIANT=slim-buster DATABASE=postgres
- VERSION=12 BENCH=master VARIANT=slim-buster DATABASE=mariadb
- VERSION=12 BENCH=master VARIANT=buster DATABASE=postgres
- VERSION=12 BENCH=master VARIANT=buster DATABASE=mariadb
- VERSION=13 BENCH=master VARIANT=alpine DATABASE=postgres
- VERSION=13 BENCH=master VARIANT=alpine DATABASE=mariadb
- VERSION=13 BENCH=master VARIANT=slim-buster DATABASE=postgres
- VERSION=13 BENCH=master VARIANT=slim-buster DATABASE=mariadb
- VERSION=13 BENCH=master VARIANT=buster DATABASE=postgres
- VERSION=13 BENCH=master VARIANT=buster DATABASE=mariadb
- VERSION=develop BENCH=master VARIANT=alpine DATABASE=postgres
- VERSION=develop BENCH=master VARIANT=alpine DATABASE=mariadb
- VERSION=develop BENCH=master VARIANT=slim-buster DATABASE=postgres
- VERSION=develop BENCH=master VARIANT=slim-buster DATABASE=mariadb
- VERSION=develop BENCH=master VARIANT=buster DATABASE=postgres
- VERSION=develop BENCH=master VARIANT=buster DATABASE=mariadb