This repository has been archived by the owner on Oct 24, 2019. It is now read-only.
forked from dune-community/dune-gdt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml.py
executable file
·99 lines (85 loc) · 2.97 KB
/
.travis.yml.py
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
#!/usr/bin/env python3
#
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2017 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# Felix Schindler (2016 - 2017)
# Rene Milk (2016 - 2017)
tpl = '''# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2016 dune-gdt developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# Authors:
# Felix Schindler (2016 - 2017)
# Rene Milk (2016 - 2017)
# THIS FILE IS AUTOGENERATED -- DO NOT EDIT #
sudo: required
dist: trusty
language: generic
services: docker
before_script:
- export IMAGE="dunecommunity/${MY_MODULE}-testing_${DOCKER_TAG}:${TRAVIS_BRANCH}"
# get image with fallback to master branch of the super repo
- docker pull ${IMAGE} || export IMAGE="dunecommunity/${MY_MODULE}-testing_${DOCKER_TAG}:master" ; docker pull ${IMAGE}
- export ENV_FILE=${HOME}/env
- printenv | \grep TRAVIS > ${ENV_FILE} || echo This is not a failure
- printenv | \grep encrypt >> ${ENV_FILE} || echo This is not a failure
- printenv | \grep TEST >> ${ENV_FILE}
- printenv | \grep TOKEN >> ${ENV_FILE} || echo This is not a failure
- export DOCKER_RUN="docker run --env-file ${ENV_FILE} -v ${TRAVIS_BUILD_DIR}:/root/src/${MY_MODULE} ${IMAGE}"
script:
- travis_wait 50 ${DOCKER_RUN} /root/src/${MY_MODULE}/.travis.script.bash
# runs independent of 'script' failure/success
after_script:
- ${DOCKER_RUN} /root/src/${MY_MODULE}/.travis.after_script.bash
notifications:
email:
on_success: change
on_failure: change
on_start: never
webhooks:
urls:
- https://buildtimetrend.herokuapp.com/travis
- https://webhooks.gitter.im/e/2a38e80d2722df87f945
branches:
except:
- gh-pages
env:
global:
- MY_MODULE=dune-gdt
matrix:
include:
# gcc 5
{%- for c in builders %}
- env: DOCKER_TAG=gcc TESTS={{c}}
{%- endfor %}
# clang 3.9
{%- for c in builders %}
- env: DOCKER_TAG=clang TESTS={{c}}
{%- endfor %}
# THIS FILE IS AUTOGENERATED -- DO NOT EDIT #
'''
import os
import jinja2
import sys
import where
import subprocess
tpl = jinja2.Template(tpl)
builder_count = int(sys.argv[1])
ymlfn = os.path.join(os.path.dirname(__file__), '.travis.yml')
with open(ymlfn, 'wt') as yml:
yml.write(tpl.render(builders=range(0, builder_count)))
travis = where.first('travis')
if travis:
try:
subprocess.check_call([str(travis), 'lint', ymlfn])
except subprocess.CalledProcessError as err:
print('Linting {} failed'.format(ymlfn))
print(err)
sys.exit(-1)
else:
print('Travis linter missing. Try:\ngem install travis')