• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#==============================================================================
2#   Copyright (c) 2016-2020 Nikita Kniazev
3#
4#   Use, modification and distribution is subject to the Boost Software
5#   License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6#   http://www.boost.org/LICENSE_1_0.txt)
7#==============================================================================
8
9language: cpp
10
11sudo: false
12
13addon_shortcuts:
14  clang-10: &clang-10
15    apt:
16      sources:
17        - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
18          key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
19      packages:
20        - clang-10
21        - libc++-10-dev
22        - libc++abi-10-dev
23
24  gcc-10: &gcc-10
25    apt:
26      sources:
27        - sourceline: 'ppa:ubuntu-toolchain-r/test'
28      packages:
29        - g++-10
30
31os: linux
32dist: bionic
33
34env:
35  global:
36    - PROJECT=libs/spirit
37    - BOOST_ROOT=$HOME/boost
38    - BOOST_BUILD_PATH=$HOME/build-boost
39
40matrix:
41  include:
42    ### Spirit 3
43    - { env: 'STD=14  JOB=test/x3',         compiler: clang-10, addons: *clang-10 }
44    - { env: 'STD=14  JOB=test/x3',         compiler: gcc-10, addons: *gcc-10 }
45    ### Spirit 2
46    ## Clang
47    # 11
48    - { env: 'STD=11  JOB=test/qi',         compiler: clang-10, addons: *clang-10 }
49    - { env: 'STD=11  JOB=test/karma',      compiler: clang-10, addons: *clang-10 }
50    - { env: 'STD=11  JOB=test/lex',        compiler: clang-10, addons: *clang-10 }
51    - { env: 'STD=11  JOB=test/support',    compiler: clang-10, addons: *clang-10 }
52    - { env: 'STD=11  JOB=repository/test', compiler: clang-10, addons: *clang-10 }
53    # 03
54    - { env: 'STD=03  JOB=test/qi',         compiler: clang-10, addons: *clang-10 }
55    - { env: 'STD=03  JOB=test/karma',      compiler: clang-10, addons: *clang-10 }
56    - { env: 'STD=03  JOB=test/lex',        compiler: clang-10, addons: *clang-10 }
57    - { env: 'STD=03  JOB=test/support',    compiler: clang-10, addons: *clang-10 }
58    - { env: 'STD=03  JOB=repository/test', compiler: clang-10, addons: *clang-10 }
59    ## GCC
60    # 11
61    - { env: 'STD=11  JOB=test/qi',         compiler: gcc-10, addons: *gcc-10 }
62    - { env: 'STD=11  JOB=test/karma',      compiler: gcc-10, addons: *gcc-10 }
63    - { env: 'STD=11  JOB=test/lex',        compiler: gcc-10, addons: *gcc-10 }
64    - { env: 'STD=11  JOB=test/support',    compiler: gcc-10, addons: *gcc-10 }
65    - { env: 'STD=11  JOB=repository/test', compiler: gcc-10, addons: *gcc-10 }
66    # 03
67    - { env: 'STD=03  JOB=test/qi',         compiler: gcc-10, addons: *gcc-10 }
68    - { env: 'STD=03  JOB=test/karma',      compiler: gcc-10, addons: *gcc-10 }
69    - { env: 'STD=03  JOB=test/lex',        compiler: gcc-10, addons: *gcc-10 }
70    - { env: 'STD=03  JOB=test/support',    compiler: gcc-10, addons: *gcc-10 }
71    - { env: 'STD=03  JOB=repository/test', compiler: gcc-10, addons: *gcc-10 }
72    ### Spirit 1
73    - { env: 'STD=03  JOB=classic/test',    compiler: clang-10, addons: *clang-10 }
74    - { env: 'STD=03  JOB=classic/test',    compiler: gcc-10, addons: *gcc-10 }
75
76cache: ccache
77
78before_install:
79  - export CACHE_NAME=$TRAVIS_OS_NAME-$TOOLSET-$STD-$JOB
80  - export PATH=$BOOST_ROOT:$PATH
81  - if [[ "$TRAVIS_COMPILER" =~ ^clang- ]]; then export STDLIB=stdlib=libc++ ; fi
82  - |
83    # Creating ~/user-config.jam file
84    sed 's/^  //' > ~/user-config.jam << 'EOF'
85
86    import feature ;
87    import os ;
88    import regex ;
89    import toolset ;
90
91
92    local TOOLSET = [ os.environ TRAVIS_COMPILER ] ;
93    local toolset-parts = [ regex.split $(TOOLSET) "-" ] ;
94    local toolset-name = $(toolset-parts[1]) ;
95    local toolset-feature = $(toolset-parts[2-]:J="-") ;
96
97    local cxx ;
98    switch $(toolset-name) {
99        case gcc   : cxx ?= [ regex.replace $(TOOLSET) "gcc" "g++" ] ;
100        case clang : cxx ?= [ regex.replace $(TOOLSET) "clang" "clang++" ] ;
101        case *     : EXIT "user-config: Unsupported toolset $(toolset-name)" ;
102    }
103
104    using $(toolset-name) : $(toolset-feature) : ccache $(cxx) ;
105
106    # Release variant with enabled asserts
107    variant sanitize : <optimization>speed <debug-symbols>off <inlining>full
108                       <runtime-debugging>off ;
109
110    # Ignore some warnings
111    feature.feature known-warnings : suppress : optional incidental propagated ;
112    toolset.flags gcc.compile OPTIONS <known-warnings>suppress :
113        -Wno-maybe-uninitialized  # this warning is known to give false positives
114      # -Wextra warnings:
115        -Wno-deprecated-copy      # Proto, Phoenix, GCC bug 92145
116      : unchecked ;
117    toolset.flags clang-linux.compile OPTIONS <known-warnings>suppress :
118        -Wno-deprecated-copy      # Proto, Phoenix
119      : unchecked ;
120
121  - |
122    # Determining the root branch
123    if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
124      export BRANCH=$TRAVIS_BRANCH
125    else
126      # It is a pull request. Retrieve the base branch from GitHub
127      GH_PR_API=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
128      export BRANCH=`curl -s $GH_PR_API | jq -r .head.ref`;
129    fi
130    if [[ ! "$BRANCH" =~ ^(master|develop)$ ]]; then
131      # Travis has been triggered not from our main branches.
132      # Find out the base branch from the git history
133      # TODO: Not implemented yet, but in most cases it will be develop branch
134      export BRANCH=develop
135    fi
136    echo Root branch is $BRANCH
137
138  # Dump environment variables
139  - env
140
141  # Sadly git's --shallow-submodules has hardcoded depth of 1 commit
142  # Patch the git binary with a little more depth to deal with boost-commitbot's lag
143  - sed 's/--depth=1/--depth=9/g' `which git` > ~/git && chmod +x ~/git
144
145  # Checkout Boost
146  - ~/git clone -j10 --branch=$BRANCH --depth=1 --quiet
147      --recurse-submodules=":(exclude)$PROJECT" --shallow-submodules
148      https://github.com/boostorg/boost.git $BOOST_ROOT
149  - pushd $BOOST_ROOT
150  # Remove the empty folder
151  - rm -rf $PROJECT
152  - ./bootstrap.sh --with-toolset=clang
153  - ./b2 headers
154
155  # Move the repository to boost/libs and make a link to previous place
156  - mv $TRAVIS_BUILD_DIR $PROJECT
157  - ln -s $PROJECT $TRAVIS_BUILD_DIR
158
159  - cd $PROJECT
160  - cd $JOB
161
162script:
163  - b2 link=shared threading=multi variant=release,sanitize
164      toolset=$TRAVIS_COMPILER cxxstd=$STD $STDLIB
165      warnings=extra known-warnings=suppress warnings-as-errors=on
166