-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
86 lines (77 loc) · 3.89 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
sudo: required
services: docker
git:
# we don't want travis to pull them for the lint build,
# so we pull them manually in the tests build
submodules: false
addons:
apt:
packages:
# used for pylint
- python-lxml
cache:
directories:
- $HOME/.cachedb
env:
matrix:
- LINT_CHECK="1"
- TESTS="1"
global:
- DOCKER_COMPOSE_VERSION="1.17.1"
- TESTS="0" LINT_CHECK="0"
- ADDONS_DIR="${TRAVIS_BUILD_DIR}/odoo/local-src"
- SONGS_DIR="${TRAVIS_BUILD_DIR}/odoo/songs"
- COMPOSE_PROJECT_NAME=geo_11
- GENERATED_IMAGE="${COMPOSE_PROJECT_NAME}_odoo"
- DOCKER_HUB_REPO="camptocamp/${GENERATED_IMAGE}"
- TRAVIS_COMPOSE="travis/docker-compose.yml"
- RANCHER_MINION_SERVER="https://${COMPOSE_PROJECT_NAME}.odoo-test.camptocamp.ch"
before_install:
- git config --global user.name "TravisCI"
- git config --global user.email "travis@camptocamp.com"
# Generate a md5 from submodules to identify the dump.
# We will generate a new dump each time any submodule changes
- if [ "$TESTS" == "1" ] ; then export SUBS_MD5=$(git submodule status | md5sum | cut -d ' ' -f1) ; fi
# Only create cached dump on commits on master and not on tags.
# Database dumps will land on the master's cache only.
- if [ "$TESTS" == "1" -a "$TRAVIS_PULL_REQUEST" == "false" -a -z "$TRAVIS_TAG" ] ; then export CREATE_DB_CACHE="true" ; fi
- if [ "$LINT_CHECK" == "1" ] ; then pip install --user -q flake8 pylint pylint_odoo; fi
- if [ "$LINT_CHECK" == "0" ] ; then pip install --user -q gitpython requests pyOpenSSL ndg-httpsclient pyasn1 pyyaml; fi
install:
- if [ "$TESTS" == "1" ] ; then bundle install ; fi
- if [ "$LINT_CHECK" == "0" ] ; then ./travis/git_submodule_update.py ; fi
# we always specify '-f docker-compose.yml' so 'docker-compose.override.yml'
# is not used and so the volumes are not shared with the host
- if [ "$LINT_CHECK" == "0" ] ; then docker-compose -f $TRAVIS_COMPOSE build --pull ; fi
- if [ "$TESTS" == "1" ] ; then docker-compose -f $TRAVIS_COMPOSE up -d db ; fi
- if [ "$TESTS" == "1" ] ; then docker-compose -f $TRAVIS_COMPOSE ps ; fi
# We run the tests and migration in the same build, so we can push the docker image
# after that we validated it has tests and migration passing
script:
- if [ "$TESTS" == "1" ] ; then bundle exec danger ; fi
- if [ "$LINT_CHECK" == "1" ] ; then flake8 ${ADDONS_DIR} ${SONGS_DIR} --exclude=__init__.py ; fi
- if [ "$LINT_CHECK" == "1" ] ; then pylint --rcfile=travis/pylintrc --valid_odoo_versions=11.0 ${ADDONS_DIR}/* ; fi
# run tests on an empty database, which is dropped afterwards
- if [ "$TESTS" == "1" ] ; then docker-compose -f $TRAVIS_COMPOSE run --rm -e SUBS_MD5=${SUBS_MD5} -e CREATE_DB_CACHE=${CREATE_DB_CACHE} -e DEMO=True odoo runtests ; fi
# run the migration
#
# Notes on releases:
#
# On each release both upgrade step and install from scratch are tested
# on separate builds. (even if cache exists)
#
# When creating a release a git tag will generate 2 builds on travis:
# - one for the new tag
# - a second for the commit on master.
#
# As the tag build is used to generate a new release we want to end it fast
# to ship it quickly. Thus as odoo/VERSION has changed it needs to check for
# previous tag cached database. MIG_LOAD_VERSION_CEIL is there for that.
#
# However, to ensure a build from scratch is done on each new release
# the search of a previous version dump is not active on commits on master.
# This will force a complete build when odoo/VERSION has been edited and doesn't
# match a cached database dump because such dump has not been created yet.
- if [ "$TESTS" == "1" ] ; then docker-compose -f $TRAVIS_COMPOSE run --rm -e MARABUNTA_MODE=sample -e MARABUNTA_ALLOW_SERIE=True -e CREATE_DB_CACHE=${CREATE_DB_CACHE} -e MIG_LOAD_VERSION_CEIL=${TRAVIS_TAG} odoo runmigration ; fi
after_success:
- if [ "$TESTS" == "1" ] ; then ./travis/publish.sh ; fi