forked from simbody/simbody
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
149 lines (133 loc) · 6.93 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
145
146
147
148
149
# This script is used by the Travis-CI (continuous integration) testing
# framework to run Simbody's tests with every GitHub push or pull-request.
#
# Ask for Ubuntu "trusty" (14.04) to pick up newer compilers. Still have
# to upgrade gcc from trusty's 4.8 to 4.9 though, because 4.8 didn't support
# C++11 regular expressions.
sudo: required
dist: trusty
language: cpp
# For thread_local support on macOS, we require xcode8 or greater.
# Before 2018, xcode7 was the default. Now that xcode8.3 is the default,
# we no longer need to specify an osx_image.
# https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
# osx_image: xcode8
matrix:
include:
- os: linux
compiler: clang
env: BTYPE=Release COV=OFF DEPLOY=yes
- os: linux
compiler: gcc
env: BTYPE=Release COV=OFF DEPLOY=no
- os: linux
compiler: gcc
env: BTYPE=Debug COV=ON DEPLOY=yes
- os: osx
compiler: clang
env: BTYPE=Release COV=OFF DEPLOY=yes OSX_TARGET=10.10
addons:
# To avoid an interactive prompt when uploading binaries to sourceforge.
ssh_known_hosts: frs.sourceforge.net
before_install:
## Ensure that there are no tabs in source code.
# GREP returns 0 (true) if there are any matches, and
# we don't want any matches. If there are matches,
# print a helpful message, and make the test fail by using "false".
# The GREP command here checks for any tab characters in the the files
# that match the specified pattern. GREP does not pick up explicit tabs
# (e.g., literally a \t in a source file).
# This grep command is invalid on osx.
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then if grep --recursive --include={*.cpp,*.c,*.h,*.md,*.yml,*.cmake.*.xml,*.html,*.in,*.txt} --exclude-dir=c-cmaes -P "\t" . ; then echo "Tabs found in the lines shown above. See CONTRIBUTING.md about tabs."; false; else echo "Repo passed no-tabs check."; fi; else echo "No-tabs check not performed."; fi
## Dependencies for Simbody.
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get --yes update; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get --yes install liblapack-dev; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get --yes install freeglut3-dev libxi-dev libxmu-dev; fi
# C++11 on Ubuntu. Update to gcc 4.9, which provides full C++11 support. We
# use this script because if building Simbody with C++11, we need gcc-4.9,
# and the Travis Ubuntu 12.04 machines have an older version of gcc. Even if
# building with Clang, we need the newer libstdc++ that we get by updating to
# gcc-4.9. See https://github.com/travis-ci/travis-ci/issues/979.
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y; fi
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo apt-get --yes update -qq; fi
- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo apt-get --yes install -qq g++-4.9; fi
- if [[ "$TRAVIS_OS_NAME" = "linux" && "$CXX" = "g++" ]]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
# CMake 2.8.11 on Ubuntu.
#- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo add-apt-repository ppa:kalakris/cmake -y; fi
#- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo apt-get --yes update -qq; fi
#- if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then sudo apt-get --yes install cmake; fi
install:
- mkdir -p $TRAVIS_BUILD_DIR/simbody-build && cd $TRAVIS_BUILD_DIR/simbody-build
# Configure.
- CMAKE_ARGS=($TRAVIS_BUILD_DIR -DCMAKE_BUILD_TYPE=$BTYPE -DCMAKE_CXX_FLAGS=-Werror -DSIMBODY_COVERAGE:BOOL=$COV -DCMAKE_INSTALL_PREFIX=~/simbody)
# The minimum supported OSX version is 10.10.
- if [[ "$TRAVIS_OS_NAME" = "osx" ]]; then CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=$OSX_TARGET); fi
- printf '%s\n' "${CMAKE_ARGS[@]}"
- cmake "${CMAKE_ARGS[@]}"
# Build.
- make -j8
script:
## Test Simbody.
- ctest -j8 --output-on-failure
## Run coverage and send result to codecov.io
- if [[ "$COV" == "ON" ]]; then echo "Running coverage target"; fi
- if [[ "$COV" == "ON" ]]; then make coverage; fi
- if [[ "$COV" == "ON" ]]; then echo "Sending coverage result to codecov.io"; fi
- if [[ "$COV" == "ON" ]]; then bash <(curl -s https://codecov.io/bash) -X gcov; fi
## Make sure we can install with no issues.
- make -j8 install
before_deploy:
## Zip up the installation using a file name that identifies where the
# binaries were built.
- mkdir ~/to_deploy
- export ZIPNAME=simbody-latest_${TRAVIS_OS_NAME}_${BTYPE}.zip
# Zip up simbody relative to the home directory; must change to home dir.
- cd ~
# Leave symlinks intact.
- zip --symlinks --recurse-paths --quiet ~/to_deploy/$ZIPNAME simbody
## Set up ssh for sourceforge.
# Decrypt the private key stored in the repository to the tmp dir.
- openssl aes-256-cbc -K $encrypted_cc3f5ebf7a63_key -iv $encrypted_cc3f5ebf7a63_iv -in $TRAVIS_BUILD_DIR/doc/.deploy_myosin_sourceforge_rsa.enc -out /tmp/deploy_myosin_sourceforge_rsa -d
# Start the ssh agent.
- eval "$(ssh-agent -s)"
# Register this private key with this client (the travis machine).
- chmod 600 /tmp/deploy_myosin_sourceforge_rsa
- ssh-add /tmp/deploy_myosin_sourceforge_rsa
deploy:
# Uploads to sourceforge.net/projects/myosin
# See https://docs.travis-ci.com/user/deployment/custom/
# '--archive' preserves symlinks.
provider: script
skip_cleanup: true
script: rsync --archive --compress --verbose ~/to_deploy/$ZIPNAME opensim-bot@frs.sourceforge.net:/home/frs/project/myosin/simbody/
on:
# Upload for both linux and OSX.
branch: master
condition: "$DEPLOY = yes"
# Process for securely uploading files to Sourceforge, taken from
# https://oncletom.io/2016/travis-ssh-deploy/:
#
# Contact chrisdembia if you need the login information for opensim-bot at
# sourceforge, to manage myosin.sourceforge.net.
#
# You must install the travis command-line tool: `gem install travis`
# Locally, from the root of the simbody repository:
# Create a 4096-bit RSA key with comment, private key
# $ ssh-keygen -t rsa -b 4096 -C 'opensim-bot@sourceforge.net' -f doc/.deploy_myosin_sourceforge_rsa
# When prompted for a passphrase, just hit enter (twice).
# Encrypt the private key, add decryption code to .travis.yml. First make a
# backup copy of .travis.yml.
# $ travis encrypt-file doc/.deploy_myosin_sourceforge_rsa --add
# Manually edit the .travis.yml file to clean up the added lines and restore
# comments to the file; put the decryption in the before_deploy step.
# Remove the unencrypted private key. DO NOT commmit the unencrypted private
# key.
# $ rm -f doc/.deploy_myosin_sourceforge_rsa
# Move the encrypted key to the doc folder.
# $ mv .deploy_myosin_sourceforge_rsa.enc doc/
# Manually, log into the sourceforge website (user opensim-bot) and add the
# public key (contents of doc/.deploy_myosin_sourceforge_rsa.pub) in
# Profile > SSH Settings.
# Now you can delete the public key file from your local machine.
# Commit the encrypted private key and the changes to .travis.yml.
# $ git commit .travis.yml doc/.deploy_myosin_sourceforge_rsa.enc