summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 8d5858436a45ccf0f77db4347a70a292462ed496 (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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
version: ~> 1.0

# If the language is set to C or C++, Travis defines and exports CC
# and CXX *after* we have defined our environment variables via 'env'.
language: minimal

# Run in two steps:
# 1. Build the tarball
#    On a modern distro, with all the needed dependencies, including the whole git history.
# 2. Check it on various environments.
#    Less dependencies, and little git content (we would like to have none, but it's not
#    an option on Travis).
stages:
  - dist
  - check

# The 'check' jobs do not need the repo at all, only the 'dist'
# does.  Let's save time, bandwith, energy, and polar bears.
git:
  clone: false

# matrix.include and jobs.include are aliases
# (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/).
jobs:
  include:
    - stage: dist
      name: "Make dist"
      git:
        clone: true
      dist: bionic
      script:
        - sudo apt-get install -qq autoconf automake autopoint flex gettext graphviz help2man m4 texinfo
        - autoconf --version
        - automake --version
        - autopoint --version
        - dot -V
        - gettext --version
        - help2man --version
        - makeinfo --version
        - m4 --version

        # Travis makes a shallow clone, but we need it in full to build the ChangeLog and apply the fixes in git-log-fix.
        - git fetch --unshallow || true
        - git submodule update --init --recursive

        - ./bootstrap
        - ./configure --enable-gcc-warnings || { cat config.log && false; }
        - make -j2
        - make -j2 dist
        # Can help understanding why we get "dirty" tarballs.
        - git status
        - dist=$(echo bison*.xz)

        # Unfortunately we cannot deterministically know the name of the tarball without the full
        # git history (because git describe --abbrev=4 may use more than 4 characters if there are
        # conflicts).
        #
        # So for the sake of the 'check' jobs (that don't even have the repo at all), also expose this
        # tarball on a name that only depends on the Travis build number.
        #
        # Without -b -, exit status is always 0.
        #
        # If we rerun a job that was already uploaded, 'ln -s' will fail: remove beforehand.
        - sftp -b - bison@sftp.lrde.epita.fr <<< "put $dist"$'\n'"-rm bison-$TRAVIS_BUILD_NUMBER.tar.xz"$'\n'"ln -s $dist bison-$TRAVIS_BUILD_NUMBER.tar.xz"

    ## ------- ##
    ## First.  ##
    ## ------- ##

    # Start with three completely different environments, to get
    # errors asap.

    - name: "GCC 9 -O3"
      stage: check
      os: linux
      dist: bionic
      addons:
        apt:
          sources:
            # See https://github.com/travis-ci/apt-source-safelist/issues/410.
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
          packages: g++-9
      env:
        - CC=gcc-9
        - CXX=g++-9
        - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'

    # ASAN is time consuming, and we timeout the 50min granted by
    # Travis if we run all the tests in one go.  Run in two parts.
    - name: "Clang 9 libc++ and ASAN part 1"
      stage: check
      os: linux
      dist: bionic
      addons: &clang9
        apt:
          sources:
            # See https://github.com/travis-ci/apt-source-safelist/issues/410.
            - sourceline: 'ppa:ubuntu-toolchain-r/test'
            - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - clang-9
            - libc++-9-dev
            - libc++abi-9-dev
      env:
        # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
        - CC='clang-9 -fsanitize=address'
        - CXX='clang++-9 -fsanitize=address -stdlib=libc++'
        - PART=1

    - name: "Clang 9 libc++ and ASAN part 2"
      stage: check
      os: linux
      dist: bionic
      addons: *clang9
      env:
        # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
        - CC='clang-9 -fsanitize=address'
        - CXX='clang++-9 -fsanitize=address -stdlib=libc++'
        - PART=2

    - name: "ICC"
      stage: check
      os: linux
      compiler: icc
      env:
        - CC=icc
        - CXX=icpc
      install:
        - source /opt/intel/inteloneapi/compiler/latest/env/vars.sh
      addons:
        apt:
          sources:
          - sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
            key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
          packages:
          - intel-oneapi-icc

    ## ----- ##
    ## GCC.  ##
    ## ----- ##

    - name: "GCC 8 with sanitizers part 1"
      os: linux
      dist: bionic
      addons:
        apt:
          packages: g++-8
      env:
        - CC='gcc-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
        - CXX='g++-8 -fsanitize=undefined,address -fno-omit-frame-pointer'
        - CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
        - PART=1

    - name: "GCC 8"
      stage: check
      os: linux
      dist: bionic
      addons:
        apt:
          packages: g++-8
      env:
        - CC=gcc-8
        - CXX=g++-8

    - name: "GCC 7"
      stage: check
      os: linux
      dist: bionic
      addons:
        apt:
          packages: g++-7
      env:
        - CC=gcc-7
        - CXX=g++-7

    - name: "GCC 6"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-6
      env:
        - CC=gcc-6
        - CXX=g++-6

    - name: "GCC 5"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-5
      env:
         - CC=gcc-5
         - CXX=g++-5

    - name: "GCC 4.9"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-4.9
      env:
         - CC=gcc-4.9
         - CXX=g++-4.9

    - name: "GCC 4.8"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-4.8
      env:
         - CC=gcc-4.8
         - CXX=g++-4.8

    - name: "GCC 4.7"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-4.7
      env:
         - CC=gcc-4.7
         - CXX=g++-4.7

    - name: "GCC 4.6"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: ubuntu-toolchain-r-test
          packages: g++-4.6
      env:
         - CC=gcc-4.6
         - CXX=g++-4.6

    ## ------- ##
    ## Clang.  ##
    ## ------- ##

    - name: "Clang 8 -O3"
      stage: check
      os: linux
      dist: bionic
      addons:
        apt:
          packages:
            - clang-8
            - libc++-8-dev
            - libc++abi-8-dev
      env:
        - CC=clang-8
        - CXX='clang++-8 -stdlib=libc++'
        - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'

    - name: "Clang 7"
      stage: check
      os: linux
      dist: bionic
      addons:
        apt:
          packages:
            - clang-7
            - libc++-7-dev
            - libc++abi-7-dev
      env:
        - CC=clang-7
        - CXX='clang++-7 -stdlib=libc++'

    - name: "Clang 6 and libc++"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources:
            - llvm-toolchain-xenial-6.0
            - ubuntu-toolchain-r-test
          packages:
            - clang-6.0
            - libc++-dev
      env:
        - CC=clang-6.0
        - CXX='clang++-6.0 -stdlib=libc++'

    - name: "Clang 5"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: llvm-toolchain-xenial-5.0
          packages:
            - clang-5.0
            - libc++-dev
      env:
        - CC='clang-5.0'
        - CXX='clang++-5.0'

    - name: "Clang 4"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: llvm-toolchain-xenial-4.0
          packages: clang-4.0
      env:
        - CC=clang-4.0
        - CXX=clang++-4.0

    - name: "Clang 3.9"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources: llvm-toolchain-xenial-3.9
          packages: clang-3.9
      env:
        - CC=clang-3.9
        - CXX=clang++-3.9

    - name: "Clang 3.8"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.8
          packages: clang-3.8
      env:
        - CC=clang-3.8
        - CXX=clang++-3.8

    - name: "CLang 3.7"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.7
          packages: clang-3.7
      env:
        - CC=clang-3.7
        - CXX=clang++-3.7

    - name: "Clang 3.6"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.6
          packages: clang-3.6
      env:
        - CC=clang-3.6
        - CXX=clang++-3.6

    - name: "Clang 3.5"
      stage: check
      os: linux
      dist: xenial
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - llvm-toolchain-precise-3.5
          packages: clang-3.5
      env:
        - CC=clang-3.5
        - CXX=clang++-3.5

    - name: "Clang 3.4"
      stage: check
      os: linux
      # Not available on Xenial.
      dist: trusty
      addons:
        apt:
          packages: clang-3.4
      env:
        # No versioned name installed, but beware that Travis installs
        # a more modern clang earlier in the default PATH.
        - CC=/usr/bin/clang
        - CXX=/usr/bin/clang++

    - name: "Clang 3.3"
      stage: check
      os: linux
      # Not available on Xenial.
      dist: trusty
      addons:
        apt:
          packages: clang-3.3
      env:
        # See comment for 3.4.
        - CC=/usr/bin/clang
        - CXX=/usr/bin/clang++

## From https://docs.gitlab.com/ce/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor.
## Applies to Travis too.  Applied to all the 'script's (of all the jobs).
before_script:
  - 'which ssh-agent || ( sudo apt-get install openssh-client -y )'
  - eval "$(ssh-agent -s)"
  # $SSH_PRIVATE_KEY is multiline.  Use $'...' to register its value: $'-----BEGIN OPENSSH PRIVATE KEY-----\nXXXXX...\n...==\n-----END OPENSSH PRIVATE KEY-----'.
  - echo "$SSH_PRIVATE_KEY" >/tmp/key.id_rsa
  - chmod 600 /tmp/key.id_rsa
  - ssh-add /tmp/key.id_rsa </dev/null
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
  - echo '|1|bpc51UGxoDZjCPiwRlCStW32trI=|rfh6mLoLZv/vAvOVrpZXI1hTLxg= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIR+ckMoJTNXHvAQLHWSfrRnrNJGW2ZR6kr5pBVDGCkz1v1RcQ5rleq0NAt9kS3v4hgnuLiEVnK7KDRzcEH3ikc=' >>~/.ssh/known_hosts
  - chmod 600 ~/.ssh/known_hosts

# Applies only to the jobs that don't have a 'script', i.e., applies to all the 'check' jobs, but not the 'dist' one.
script:
  # Beware not too leak $SSH_PRIVATE_KEY.
  # - env
  - sudo apt-get install -qq doxygen flex m4
  # Install and activate dmd.
  - mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
  - source $(source ~/dlang/install.sh dmd -a)

  - $CC --version
  - $CXX --version
  - dmd --version
  - doxygen --version
  - flex --version
  - ld --version
  - m4 --version

  - if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
  # Unset this variable, otherwise, Java programs' stderr is cluttered
  # with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
  # the test suite fail.
  - unset _JAVA_OPTIONS

  # Fail fast from now on.
  - set -e
  - sftp bison@sftp.lrde.epita.fr:bison-$TRAVIS_BUILD_NUMBER.tar.xz
  - tar xf bison-$TRAVIS_BUILD_NUMBER.tar.xz
  - dir=$(tar tf bison-$TRAVIS_BUILD_NUMBER.tar.xz | sed 1q)
  - cd $dir
  - mkdir _build
  - cd _build
  - ../configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
  - make -j2 $MAKE_ARGS
  - if test ${PART-1} = 1; then make check                  VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
  - if test ${PART-2} = 2; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
  - if test ${PART-2} = 2; then make maintainer-check-g++   VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi