forked from freeorion/freeorion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
139 lines (138 loc) · 4.83 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
stages:
- lint
- build
- test
jobs:
include:
- stage: lint
os: linux
language: python
python: 2.7.14
before_install:
- pip install flake8-putty==0.4.0
before_script:
- cd default/python
script:
- flake8
- python -m compileall -q .
env:
- NAME="Lint Python script"
- stage: build
os: linux
language: shell
services:
- docker
env:
- NAME="Build C++ API documentation"
# Auth token to push API documentation
- secure: "JKeXk8p65hodb12PVRST6A90swsNubc+46EbSJGSghldIxbFWLBAlwU+KLeOMO4V0veu6k4lnMa50V0UYFZmoUsS6W0aL5Ybo98SpzXHiNLOmOluoqJoF9TBsOTCCRFbWbccgJyVEtulgRcdml96naS51lq9Sw/VO/N3Z472304="
before_install:
- docker pull freeorion/freeorion-travis-build
# Add transparent cmake function to allow possible cross platform use of
# build sections.
- >
function cmake {
docker run -v "${TRAVIS_BUILD_DIR}:/freeorion" -w /freeorion/build freeorion/freeorion-travis-build timeout 40m /usr/bin/cmake $@
}
before_script:
- mkdir build
- cd build
script:
- cmake ..
- cmake --build . --target cpp-apidoc
before_deploy:
# Configure git to use the identity of FreeOrion Build Bot and
# load credentials
- git config --global user.email "[email protected]"
- git config --global user.name "FreeOrion Build Bot"
- git config --global credential.helper "cache --timeout=300"
- echo -e "url=https://freeorion-bot:${FreeOrion_AUTH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git\n" | git credential approve
- git clone --depth=1 --branch=master https://github.com/freeorion/freeorion.github.io.git apidoc-deploy.git
- pushd apidoc-deploy.git
- rm -rf cppapi/master
- mkdir -p cppapi/master
- cp -R ../doc/cpp-apidoc/html cppapi/master
- git add -A cppapi/master
- git commit -m "Update FreeOrion API documentation to match commit \`$(date --iso-8601).${TRAVIS_COMMIT:0:8}\`" || true
deploy:
provider: script
script: git push https://github.com/freeorion/freeorion.github.io.git master:master
skip_cleanup: true
on:
branch: master
- stage: build
os: linux
language: cpp
services:
- docker
cache: ccache
env:
- NAME="Build FreeOrion"
before_install:
- mkdir -p $HOME/.ccache;
- echo sloppiness = file_macro > $HOME/.ccache/ccache.conf
- echo max_size = 200M >> $HOME/.ccache/ccache.conf
- ccache --version
- ccache --show-stats
- docker pull freeorion/freeorion-travis-build
# Add transparent cmake function to allow possible cross platform use of
# build sections.
# mount ccache dir and set its environment variable
# timeout before Travis kills jobs so that ccache is always at least partially populated
- >
function cmake {
docker run -v "${TRAVIS_BUILD_DIR}:/freeorion" -v "${HOME}/.ccache:/ccache_dir" -e CCACHE_DIR='/ccache_dir' -w /freeorion/build freeorion/freeorion-travis-build timeout 40m /usr/bin/cmake $@
}
before_script:
- mkdir build
- cd build
script:
- cmake -DBUILD_TESTING=ON ..
- cmake --build . -- -j 2
- cmake --build . --target unittest
before_cache:
- ccache --clean
- ccache --show-stats
- stage: build
os: osx
language: cpp
osx_image: xcode8.3
compiler: clang
cache: ccache
env:
- NAME="Build FreeOrion"
before_install:
- brew install ccache
- export PATH="/usr/local/opt/ccache/libexec:$PATH"
- mkdir -p $HOME/.ccache;
- echo sloppiness = file_macro > $HOME/.ccache/ccache.conf
- echo max_size = 200M >> $HOME/.ccache/ccache.conf
- ccache --version
- ccache --show-stats
# Add transparent cmake function to allow possible cross platform use of
# build sections.
# mount ccache dir and set its environment variable
# timeout before Travis kills jobs so that ccache is always at least partially populated
- >
function cmake {
/usr/local/bin/gtimeout 40m /usr/local/bin/cmake $@
}
before_script:
- mkdir build
- cd build
script:
- cmake -GXcode ..
- cmake --build . --config Release -- -parallelizeTargets -jobs $(sysctl hw.ncpu | awk '{print $2}')
before_cache:
- ccache --clean
- ccache --show-stats
- stage: test
os: linux
language: python
python: 2.7.14
before_install:
- pip install pytest==3.6.3
script:
- pytest
env:
- NAME="Pytest"