forked from JCSDA-internal/soca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
138 lines (121 loc) · 6.13 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
#================================================================================
# TravisCI configuration script
#
# The following environment variables need to be defined:
# MAIN_REPO - The name of this repo being tested, as spelled in the bundle
# LIB_REPOS - A list of the dependency repos, in the order that they are to be
# built. If the script detects a repo needs to be rebuit, all repos
# listed after it will be rebuilt as well. These repos will be
# cached. (So try to list large, rarely chaning repos, first)
# BUILD_OPT_{REPO} - For each repo optional arguments to pass to ecbuild
# MATCH_REPOS - All repos in $LIB_REPO will use the branch listed in the bundle
# unless listed in $MATCH_REPOS
# LFS_REPOS - All repos in $LIB_REPO will not use git-lfs when checked out
# unless listed in $LFS_REPOS
#
# NOTE: these scripts have been changed to assume the bundle CMakeLists.txt
# is in this repository directly
#================================================================================
env:
global:
- MAIN_REPO=soca
- LIB_REPOS="fms gsw mom6 crtm
fckit atlas oops saber ioda ufo ioda-converters soca-config"
- BUILD_OPT=""
- BUILD_OPT_crtm="-DBUILD_CRTM=ON"
- BUILD_OPT_mom6="-DENABLE_OCEAN_BGC=ON"
- BUILD_OPT_oops="-DENABLE_QG_MODEL=OFF -DENABLE_LORENZ95_MODEL=OFF"
- BUILD_OPT_ufo="-DLOCAL_PATH_TESTFILES_IODA=NONE"
- BUILD_OPT_soca="-DSOCA_TESTS_FORC_DEFAULT_TOL=ON -DENABLE_OCEAN_BGC=ON"
- MATCH_REPOS="saber oops ioda ioda-converters ufo mom6 soca soca-config"
- LFS_REPOS="crtm"
# secure token used to push changes to GitHub (user: travissluka)
- secure: phYDV8BnMVQMhKbuyfpA0cUvelL3Jn9GrMunbAQAa4Hw6OInALu0BSoPAm5xd+lPAsVkhy3BwHlRvjqGYmhDr3NFuxUbZ/l1CcSOJZmV5Rp+5CY5nk0scQ9asuRSzt6jHBIaj9ncOyTWc7B3H6Vp88z6dBDgzeXWMaLy5A7u3fkTVI3dYAmvPAEd9wRp4nI6ij2lnTELIziTYZ07nrdIzYfAc6sqvPXhLkZfxYMkfDAbHHWZt+kGoJGPFfsjX1K7cgj32Ro+lm3Vl0u732QRCw3nUefhZrz3PkkGeX1U+GjQsz8liEgBqKng4ZxocepPsv5gwZj/frMCCtcXj59Pia5pmHy6vzdq4XCp/WpYwbbMEF9y9qVL35s9On9JnU20DEOV4r5c9rmJd8gbpsfK1reT8KOD5zJe9YBHRRXajweq23TFJPRyHVHlnSF8OtybOVG6OMLba9vvPTveQuaDIyc3kur5QtbM0HVv3uplef14m1frQYqji9I99h/pI5WcueRpcxARwagL1tnl3cfK4LyI3QWXidetDduE3MJQNfsKADlKKBVw9W2JyzNFCNj0J7x8r5SwObRX7Kj9YZfIPJGVt5rDc0OZm9wCt/BEZclTLyf4qbFibX/0glPiFoqhuYP/ZXAbQdYWI+si68gxcql33+PMkmbuhehA8qNZicE=
branches:
only:
- develop
- master
- /.*/travisci_.*$/
language: cpp
services:
- docker
cache:
ccache: true
directories:
- $HOME/repo.cache
#================================================================================
# Download and prepare the repositories and setup the docker image
# The working directory will then contain the following directories, with {repo}
# being each repository listed in $LIB_REPOS and $MAIN_REPO
# ./repo.bundle/{repo}/ - Modified versions of the bundle to individually build repos
# ./repo.src/{repo}/ - The source from github
# ./repo.build/{repo}/ - The build directory
# $HOME/repo.cache/{repo}/ - The cached results from `make install` for each
# $LIB_REPOS from previous builds on TravisCI
#================================================================================
before_install:
- |
# setup other configurables that the subsequent scripts use
export MAIN_BUILD_TYPE=Debug
export LIB_BUILD_TYPE=RelWIthDebInfo
export BRANCH=$( [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && \
echo $TRAVIS_BRANCH || echo $TRAVIS_PULL_REQUEST_BRANCH )
export_vars="-e REPO_CACHE=/repo.cache -e LIB_REPOS -e LIB_BUILD_TYPE
-e MAIN_REPO -e MAIN_BUILD_TYPE -e CCACHE_DIR=/ccache -e BUILD_OPT"
for v in $(env | grep BUILD_OPT_ | cut -d'=' -f 1); do
export_vars="$export_vars -e $v"
done
- |
# clone and prep the repos
# note: the main repo is not handled by the prep.sh script, it is moved from
# what TravisCI auto checks out (because TravisCI handles PR merges specially)
git config --global url.https://${GH_TOKEN}@github.com/.insteadOf https://github.com/
WORK_DIR=$HOME/work
mkdir -p $WORK_DIR/repo.src; cd $WORK_DIR
mv ${TRAVIS_BUILD_DIR} ${WORK_DIR}/repo.src/${MAIN_REPO}
REPO_CACHE=$HOME/repo.cache ${WORK_DIR}/repo.src/${MAIN_REPO}/.github/travisci/prep.sh
- |
# alter file permissions
chmod 777 -R ~/.ccache
chmod 777 -R $HOME/repo.cache
cd ${WORK_DIR} && find . -name \* -exec chmod 777 {} \;
- |
# prepare docker image from jcsda/docker:latest
cd ${WORK_DIR}/repo.src/${MAIN_REPO}/.github/travisci
docker build -t jcsda/dockerl2 .
docker images
ci_env=`bash <(curl -s https://codecov.io/env)`
docker run -d -t $ci_env $export_vars \
-v ${WORK_DIR}:/jcsda/work \
-v $HOME/.ccache:/ccache \
-v $HOME/repo.cache:/repo.cache \
--name jcsda_container jcsda/dockerl2
docker ps -a
#======================================================================
# Here are the run steps
#======================================================================
script:
- |
# Build code
docker exec jcsda_container bash \
-c 'cd /jcsda/work && /jcsda/work/repo.src/${MAIN_REPO}/.github/travisci/build.sh'
- |
# run tests
docker exec jcsda_container bash \
-c 'cd /jcsda/work/repo.build/${MAIN_REPO} && ctest --output-on-failure'
- |
# upload code coverage
docker exec jcsda_container bash -c \
'cd /jcsda/work/repo.src/${MAIN_REPO} \
&& lcov -c -d . -d ../../repo.build/${MAIN_REPO}/ -o coverage.info --no-external -q \
&& bash <(curl -s https://codecov.io/bash)'
#======================================================================
#======================================================================
after_success:
- |
# If this is a cron run, update the release/stable branch of the bundle
if [[ "$TRAVIS_EVENT_TYPE" == "cron" && "$TRAVIS_BRANCH" == "develop" ]]; then
docker exec jcsda_container bash -c \
'cd /jcsda/work && repo.src/${MAIN_REPO}/.github/travisci/stable_mark.sh'
cd ${WORK_DIR} && ${WORK_DIR}/repo.src/${MAIN_REPO}/.github/travisci/stable_commit.sh
fi