d: create getter for the number of errors from the parser
[bison.git] / .travis.yml
blobc2e61f354e383e2c7a6318a4ea448927be216e07
1 version: ~> 1.0
3 # If the language is set to C or C++, Travis defines and exports CC
4 # and CXX *after* we have defined our environment variables via 'env'.
5 language: minimal
7 # Run in two steps:
8 # 1. Build the tarball
9 #    On a modern distro, with all the needed dependencies, including the whole git history.
10 # 2. Check it on various environments.
11 #    Less dependencies, and little git content (we would like to have none, but it's not
12 #    an option on Travis).
13 stages:
14   - dist
15   - check
17 # The 'check' jobs do not need the repo at all, only the 'dist'
18 # does.  Let's save time, bandwith, energy, and polar bears.
19 git:
20   clone: false
22 # matrix.include and jobs.include are aliases
23 # (https://docs.travis-ci.com/user/conditional-builds-stages-jobs/).
24 jobs:
25   include:
26     - stage: dist
27       name: "Make dist"
28       git:
29         clone: true
30       dist: bionic
31       script:
32         - sudo apt-get install -qq autoconf automake autopoint flex gettext gperf graphviz help2man m4 texinfo
33         - autoconf --version
34         - automake --version
35         - autopoint --version
36         - dot -V
37         - gettext --version
38         - gperf --version
39         - help2man --version
40         - makeinfo --version
41         - m4 --version
43         # Travis makes a shallow clone, but we need it in full to build the ChangeLog and apply the fixes in git-log-fix.
44         - git fetch --unshallow || true
45         - git submodule update --init --recursive
47         - ./bootstrap
48         - ./configure --enable-gcc-warnings || { cat config.log && false; }
49         - make -j2
50         - make -j2 dist-xz
51         # Can help understanding why we get "dirty" tarballs.
52         - git status
53         - git diff
54         - dist=$(echo bison*.xz)
56         # Unfortunately we cannot deterministically know the name of the tarball without the full
57         # git history (because git describe --abbrev=4 may use more than 4 characters if there are
58         # conflicts).
59         #
60         # So for the sake of the 'check' jobs (that don't even have the repo at all), also expose this
61         # tarball on a name that only depends on the Travis build number.
62         #
63         # Without -b -, exit status is always 0.
64         #
65         # If we rerun a job that was already uploaded, 'ln -s' will fail: remove beforehand.
66         - 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"
68     ## ------- ##
69     ## First.  ##
70     ## ------- ##
72     # Start with three completely different environments, to get errors asap.
74     - name: "GCC 10 -O3"
75       stage: check
76       os: linux
77       dist: bionic
78       addons: &gcc10
79         apt:
80           sources:
81             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
82             - sourceline: 'ppa:ubuntu-toolchain-r/test'
83           packages: g++-10
84       env:
85         - CC=gcc-10
86         - CXX=g++-10
87         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
89     # ASAN is time consuming, and we timeout the 50min granted by
90     # Travis if we run all the tests in one go.  Run in two parts.
91     - name: "Clang 10 libc++ and ASAN part 1"
92       stage: check
93       os: linux
94       dist: bionic
95       addons: &clang10
96         apt:
97           sources:
98             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
99             - sourceline: 'ppa:ubuntu-toolchain-r/test'
100             - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
101               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
102           packages:
103             - clang-10
104             - libc++-10-dev
105             - libc++abi-10-dev
106       env:
107         # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
108         - CC='clang-10 -fsanitize=address'
109         - CXX='clang++-10 -fsanitize=address -stdlib=libc++'
110         - PART=1
112     - name: "Clang 10 libc++ and ASAN part 2"
113       stage: check
114       os: linux
115       dist: bionic
116       addons: *clang10
117       env:
118         # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
119         - CC='clang-10 -fsanitize=address'
120         - CXX='clang++-10 -fsanitize=address -stdlib=libc++'
121         - PART=2
123     # See https://github.com/simd-everywhere/simde/blob/master/.travis.yml
124     # and https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-render-linux/top/configure-your-system.html.
125     - name: "ICC"
126       stage: check
127       os: linux
128       compiler: icc
129       env:
130         - CC=icc
131         - CXX=icpc
132       install:
133         - source /opt/intel/oneapi/compiler/latest/env/vars.sh
134       addons:
135         apt:
136           sources:
137           - sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
138             key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
139           packages:
140           - intel-oneapi-icc
142     - name: "ARM64: GCC 10 -O2 part 1"
143       stage: check
144       os: linux
145       arch: arm64
146       dist: bionic
147       addons: *gcc10
148       env:
149         - CC=gcc-10
150         - CXX=g++-10
151         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
152         - PART=1
154     - name: "PPC64le: GCC 10 -O2 part 1"
155       stage: check
156       os: linux
157       arch: ppc64le
158       dist: bionic
159       addons:
160         apt:
161           sources:
162             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
163             - sourceline: 'ppa:ubuntu-toolchain-r/test'
164           packages: g++-10
165       env:
166         - CC=gcc-10
167         - CXX=g++-10
168         - CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
169         - PART=1
171     - name: "s390x: GCC 10 -O2 part 1"
172       stage: check
173       os: linux
174       arch: s390x
175       dist: bionic
176       addons: *gcc10
177       env:
178         - CC=gcc-10
179         - CXX=g++-10
180         - CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
181         - PART=1
183     ## ----- ##
184     ## GCC.  ##
185     ## ----- ##
187     - name: "GCC 9 with sanitizers part 1"
188       stage: check
189       os: linux
190       dist: bionic
191       addons:
192         apt:
193           sources:
194             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
195             - sourceline: 'ppa:ubuntu-toolchain-r/test'
196           packages: g++-9
197       env:
198         - CC='gcc-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
199         - CXX='g++-9 -fsanitize=undefined,address -fno-omit-frame-pointer'
200         - CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
201         - PART=1
203     # With glr2.cc, we run out of time with the full test suite.
204     - name: "GCC 8 part 1"
205       stage: check
206       os: linux
207       dist: bionic
208       addons:
209         apt:
210           packages: g++-8
211       env:
212         - CC=gcc-8
213         - CXX=g++-8
214         - PART=1
216     - name: "GCC 7"
217       stage: check
218       os: linux
219       dist: bionic
220       addons:
221         apt:
222           packages: g++-7
223       env:
224         - CC=gcc-7
225         - CXX=g++-7
227     - name: "GCC 6"
228       stage: check
229       os: linux
230       dist: xenial
231       addons:
232         apt:
233           sources: ubuntu-toolchain-r-test
234           packages: g++-6
235       env:
236         - CC=gcc-6
237         - CXX=g++-6
239     - name: "GCC 5"
240       stage: check
241       os: linux
242       dist: xenial
243       addons:
244         apt:
245           sources: ubuntu-toolchain-r-test
246           packages: g++-5
247       env:
248          - CC=gcc-5
249          - CXX=g++-5
251     - name: "GCC 4.9"
252       stage: check
253       os: linux
254       dist: xenial
255       addons:
256         apt:
257           sources: ubuntu-toolchain-r-test
258           packages: g++-4.9
259       env:
260          - CC=gcc-4.9
261          - CXX=g++-4.9
263     - name: "GCC 4.8"
264       stage: check
265       os: linux
266       dist: xenial
267       addons:
268         apt:
269           sources: ubuntu-toolchain-r-test
270           packages: g++-4.8
271       env:
272          - CC=gcc-4.8
273          - CXX=g++-4.8
275     - name: "GCC 4.7"
276       stage: check
277       os: linux
278       dist: xenial
279       addons:
280         apt:
281           sources: ubuntu-toolchain-r-test
282           packages: g++-4.7
283       env:
284          - CC=gcc-4.7
285          - CXX=g++-4.7
287     - name: "GCC 4.6"
288       stage: check
289       os: linux
290       dist: xenial
291       addons:
292         apt:
293           sources: ubuntu-toolchain-r-test
294           packages: g++-4.6
295       env:
296          - CC=gcc-4.6
297          - CXX=g++-4.6
299     ## ------- ##
300     ## Clang.  ##
301     ## ------- ##
303     - name: "Clang 9 -O3"
304       stage: check
305       os: linux
306       dist: bionic
307       addons:
308         apt:
309           sources:
310             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
311             - sourceline: 'ppa:ubuntu-toolchain-r/test'
312             - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
313               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
314           packages:
315             - clang-9
316             - libc++-9-dev
317             - libc++abi-9-dev
318       env:
319         - CC='clang-9'
320         - CXX='clang++-9 -stdlib=libc++'
321         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
323     - name: "Clang 8"
324       stage: check
325       os: linux
326       dist: bionic
327       addons:
328         apt:
329           packages:
330             - clang-8
331             - libc++-8-dev
332             - libc++abi-8-dev
333       env:
334         - CC=clang-8
335         - CXX='clang++-8 -stdlib=libc++'
337     - name: "Clang 7"
338       stage: check
339       os: linux
340       dist: bionic
341       addons:
342         apt:
343           packages:
344             - clang-7
345             - libc++-7-dev
346             - libc++abi-7-dev
347       env:
348         - CC=clang-7
349         - CXX='clang++-7 -stdlib=libc++'
351     - name: "Clang 6 and libc++"
352       stage: check
353       os: linux
354       dist: xenial
355       addons:
356         apt:
357           sources:
358             - llvm-toolchain-xenial-6.0
359             - ubuntu-toolchain-r-test
360           packages:
361             - clang-6.0
362             - libc++-dev
363       env:
364         - CC=clang-6.0
365         - CXX='clang++-6.0 -stdlib=libc++'
367     - name: "Clang 5"
368       stage: check
369       os: linux
370       dist: xenial
371       addons:
372         apt:
373           sources: llvm-toolchain-xenial-5.0
374           packages:
375             - clang-5.0
376             - libc++-dev
377       env:
378         - CC='clang-5.0'
379         - CXX='clang++-5.0'
381     - name: "Clang 4"
382       stage: check
383       os: linux
384       dist: xenial
385       addons:
386         apt:
387           sources: llvm-toolchain-xenial-4.0
388           packages: clang-4.0
389       env:
390         - CC=clang-4.0
391         - CXX=clang++-4.0
393     - name: "Clang 3.9"
394       stage: check
395       os: linux
396       dist: xenial
397       addons:
398         apt:
399           sources: llvm-toolchain-xenial-3.9
400           packages: clang-3.9
401       env:
402         - CC=clang-3.9
403         - CXX=clang++-3.9
405     - name: "Clang 3.8"
406       stage: check
407       os: linux
408       dist: xenial
409       addons:
410         apt:
411           sources:
412             - ubuntu-toolchain-r-test
413             - llvm-toolchain-precise-3.8
414           packages: clang-3.8
415       env:
416         - CC=clang-3.8
417         - CXX=clang++-3.8
419     - name: "CLang 3.7"
420       stage: check
421       os: linux
422       dist: xenial
423       addons:
424         apt:
425           sources:
426             - ubuntu-toolchain-r-test
427             - llvm-toolchain-precise-3.7
428           packages: clang-3.7
429       env:
430         - CC=clang-3.7
431         - CXX=clang++-3.7
433     - name: "Clang 3.6"
434       stage: check
435       os: linux
436       dist: xenial
437       addons:
438         apt:
439           sources:
440             - ubuntu-toolchain-r-test
441             - llvm-toolchain-precise-3.6
442           packages: clang-3.6
443       env:
444         - CC=clang-3.6
445         - CXX=clang++-3.6
447     - name: "Clang 3.5"
448       stage: check
449       os: linux
450       dist: xenial
451       addons:
452         apt:
453           sources:
454             - ubuntu-toolchain-r-test
455             - llvm-toolchain-precise-3.5
456           packages: clang-3.5
457       env:
458         - CC=clang-3.5
459         - CXX=clang++-3.5
461     - name: "Clang 3.4"
462       stage: check
463       os: linux
464       # Not available on Xenial.
465       dist: trusty
466       addons:
467         apt:
468           packages: clang-3.4
469       env:
470         # No versioned name installed, but beware that Travis installs
471         # a more modern clang earlier in the default PATH.
472         - CC=/usr/bin/clang
473         - CXX=/usr/bin/clang++
475     - name: "Clang 3.3"
476       stage: check
477       os: linux
478       # Not available on Xenial.
479       dist: trusty
480       addons:
481         apt:
482           packages: clang-3.3
483       env:
484         # See comment for 3.4.
485         - CC=/usr/bin/clang
486         - CXX=/usr/bin/clang++
488 ## From https://docs.gitlab.com/ce/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor.
489 ## Applies to Travis too.  Applied to all the 'script's (of all the jobs).
490 before_script:
491   - 'which ssh-agent || ( sudo apt-get install openssh-client -y )'
492   - eval "$(ssh-agent -s)"
493   # $SSH_PRIVATE_KEY is multiline.  Use $'...' to register its value: $'-----BEGIN OPENSSH PRIVATE KEY-----\nXXXXX...\n...==\n-----END OPENSSH PRIVATE KEY-----'.
494   - echo "$SSH_PRIVATE_KEY" >/tmp/key.id_rsa
495   - chmod 600 /tmp/key.id_rsa
496   - ssh-add /tmp/key.id_rsa </dev/null
497   - mkdir -p ~/.ssh
498   - chmod 700 ~/.ssh
499   - echo '|1|bpc51UGxoDZjCPiwRlCStW32trI=|rfh6mLoLZv/vAvOVrpZXI1hTLxg= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIR+ckMoJTNXHvAQLHWSfrRnrNJGW2ZR6kr5pBVDGCkz1v1RcQ5rleq0NAt9kS3v4hgnuLiEVnK7KDRzcEH3ikc=' >>~/.ssh/known_hosts
500   - chmod 600 ~/.ssh/known_hosts
502 # Applies only to the jobs that don't have a 'script', i.e., applies to all the 'check' jobs, but not the 'dist' one.
503 script:
504   # Beware not too leak $SSH_PRIVATE_KEY.
505   # - env
506   - sudo apt-get install -qq doxygen flex m4
507   # Install and activate dmd.
508   - mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
509   - source $(source ~/dlang/install.sh dmd -a) || true
511   - $CC --version
512   - $CXX --version
513   - dmd --version || true
514   - doxygen --version
515   - flex --version
516   - ld --version
517   - m4 --version
519   - if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
520   # Unset this variable, otherwise, Java programs' stderr is cluttered
521   # with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
522   # the test suite fail.
523   - unset _JAVA_OPTIONS
525   # Fail fast from now on.
526   - set -e
527   - sftp bison@sftp.lrde.epita.fr:bison-$TRAVIS_BUILD_NUMBER.tar.xz
528   - tar xf bison-$TRAVIS_BUILD_NUMBER.tar.xz
529   - dir=$(tar tf bison-$TRAVIS_BUILD_NUMBER.tar.xz | sed 1q)
530   - cd $dir
531   - mkdir _build
532   - cd _build
533   - ../configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
534   - make -j2 $MAKE_ARGS
535   - if test ${PART-1} = 1; then make check                  VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
536   - if test ${PART-2} = 2; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
537   - if test ${PART-2} = 2; then make maintainer-check-g++   VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi