summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.76.0/.travis.yml
blob: a3bfcf7a49e23fcc97a6be6f6add081292cb8682 (plain)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
language: cpp
sudo: false

matrix:
  include:

    # bionic 18
    # 2
    - os: linux
      dist: Bionic
      env: BADGE=linux BUILD_TYPE=debug
      addons:
        apt:
          update: true
          packages:
            - ninja-build

    # Clang 4.0 address sanitizer
    # 3
    - os: linux
      dist: Bionic
      env: BADGE=linux BUILD_TYPE=asan C_COMPILER=clang-4.0 CXX_COMPILER=clang++-4.0
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-4.0
          packages:
            - clang-4.0

    # GCC 6
    # 4
    - os: linux
      dist: Bionic
      env: BADGE=linux C_COMPILER=gcc-6 CXX_COMPILER=g++-6
      addons:
        apt:
          update: true
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
            - g++-6
            - ninja-build

    # OSX
    # 5
    - os: osx
      env: BADGE=osx BUILD_TYPE=debug

    # 6
    - os: osx
      env: BADGE=osx BUILD_TYPE=release

    # focal 20
    # 7
    - os: linux
      dist: focal
      env: BADGE=linux BUILD_TYPE=debug
      addons:
        apt:
          update: true
          packages:
            - ninja-build

    # 8
    - os: linux
      dist: focal
      env: BADGE=linux BUILD_TYPE=release
      addons:
        apt:
          update: true
          packages:
            - ninja-build

    # 9
    - os: linux
      dist: focal
      env: BADGE=linux BUILD_TYPE=release NO_MACRO_VARARG=1

    ### Clang address sanitizer
    ### 10
    ##- os: linux
    ##  dist: focal
    ##  env: BADGE=linux BUILD_TYPE=asan C_COMPILER=clang-12.0 CXX_COMPILER=clang++-12.0
    ##  addons:
    ##    apt:
    ##      sources:
    ##        - ubuntu-toolchain-r-test
    ##        - llvm-toolchain-precise-12.0
    ##      packages:
    ##        - clang-12.0

    # mingw-w64 Win64 cross-compile
    # 11
    - os: linux
      dist: focal
      env: BADGE=linux BUILD_TYPE=cross C_COMPILER=x86_64-w64-mingw32-gcc CXX_COMPILER=x86_64-w64-mingw32-g++
      addons:
        apt:
          packages:
            - mingw-w64
            - binutils-mingw-w64
            - binutils-mingw-w64-i686
            - binutils-mingw-w64-x86-64
            - gcc-mingw-w64
            - gcc-mingw-w64-i686
            - gcc-mingw-w64-x86-64
            - g++-mingw-w64
            - g++-mingw-w64-i686
            - g++-mingw-w64-x86-64

    # 12
    - os: linux
      dist: focal
      env: BUILD_TYPE=coverage COVERALLS_TOKEN="Dy94SOU3ajc1VbIy1wnWaNaeIUzfgdtEg"
      compiler: gcc

branches:
  only:
  - master

before_install:
  - |
    if [ "x${BUILD_TYPE}" == "xcoverage" ]; then
      sudo apt-get update
      sudo apt-get install -qy python3-pip lcov
      pip3 install --user --upgrade setuptools
      pip3 install --user --upgrade pip
      pip3 install --user PyYAML
      pip3 install --user --upgrade cpp-coveralls
    fi
  - if [ -n "${C_COMPILER}" ]; then export CC="${C_COMPILER}"; fi
  - if [ -n "${CXX_COMPILER}" ]; then export CXX="${CXX_COMPILER}"; fi
  - ${CXX} --version
  - cmake --version
  - mkdir build
  - cd build
  - type -p ninja && export GENERATOR=-GNinja || true

before_script:
  # to stop the script after an error/warning
  - set -e
  # workarounds for OSX traivs build failure issues:
  # 1. rvm overrides cd with a function so that it can hook into it to run some scripts from the new
  # working directory. The workaround is to revert it to the builtin shell one.
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then unset -f cd; fi
  # 2. Redefine shell_session_update as a dummy function to avoid travis error:
  # /Users/travis/.rvm/scripts/functions/support: line 57: shell_session_update: command not found.
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then shell_session_update() { :; }; fi
  # prepare make files with cmake
  - |-
    case "${BUILD_TYPE}" in
      "coverage")
        cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CODECOVERAGE=ON ..
        ;;
      "asan")
        cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=address ..
        ;;
      "ubsan")
        cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=undefined ..
        ;;
      "cross")
        cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake -DCMAKE_EXE_LINKER_FLAGS="-static -s" ..
        ;;
      "release")
        cmake ${GENERATOR} -DCMAKE_BUILD_TYPE=Release ..
        ;;
      *)
        cmake ${GENERATOR} ..
        ;;
    esac


script:
  # build
  - if [ -f build.ninja ]; then ninja -v; else make VERBOSE=1; fi
  # run all tests
  - if [ "x${BUILD_TYPE}" != "xcross" ]; then ../scripts/run_ctest.py; fi
  # collect coverage (needs to be after running tests)
  - if [ "x${BUILD_TYPE}" == "xcoverage" ]; then make coverage; fi

  # DO NOT REMOVE (debugging purposes)
  #- /home/travis/build/uncrustify/uncrustify/build/uncrustify -l cs -c /home/travis/build/uncrustify/uncrustify/tests/config/U10-Cpp.cfg -f /home/travis/build/uncrustify/uncrustify/tests/input/cs/newlines.mm -L A

after_success:
  # publish coverage data to coveralls
  - if [ "x${BUILD_TYPE}" == "xcoverage" ]; then cd ../ && coveralls -l build/cmake_coverage.output -t $COVERALLS_TOKEN; fi