glr2.cc: put create_state_set_index in unnamed namespace
[bison.git] / .travis.yml
bloba801ea2e9a85e0729ca6f7be4dd0eb199fee51b3
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         # As of 2021-08, we don't have Autoconf 2.71 on Ubuntu.
48         - sed -i 's/AC_PREREQ(\[2\.71\])/AC_PREREQ([2.69])/g' configure.ac
49         - ./bootstrap
50         - ./configure --enable-gcc-warnings || { cat config.log && false; }
51         - make -j2
52         - make -j2 dist-xz
53         # Can help understanding why we get "dirty" tarballs.
54         - git status
55         - git diff
56         - dist=$(echo bison*.xz)
58         # Unfortunately we cannot deterministically know the name of the tarball without the full
59         # git history (because git describe --abbrev=4 may use more than 4 characters if there are
60         # conflicts).
61         #
62         # So for the sake of the 'check' jobs (that don't even have the repo at all), also expose this
63         # tarball on a name that only depends on the Travis build number.
64         #
65         # Without -b -, exit status is always 0.
66         #
67         # If we rerun a job that was already uploaded, 'ln -s' will fail: remove beforehand.
68         - 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"
70     ## ------- ##
71     ## First.  ##
72     ## ------- ##
74     # Start with three completely different environments, to get errors asap.
76     - name: "GCC 11 -O3"
77       stage: check
78       os: linux
79       dist: bionic
80       addons: &gcc11
81         apt:
82           sources:
83             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
84             - sourceline: 'ppa:ubuntu-toolchain-r/test'
85           packages: g++-11
86       env:
87         - CC=gcc-11
88         - CXX=g++-11
89         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
91     # ASAN is time consuming, and we timeout the 50min granted by
92     # Travis if we run all the tests in one go.  Run in two parts.
93     - name: "Clang 11 libc++ and ASAN part 1"
94       stage: check
95       os: linux
96       dist: bionic
97       addons: &clang11
98         apt:
99           sources:
100             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
101             - sourceline: 'ppa:ubuntu-toolchain-r/test'
102             - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
103               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
104           packages:
105             - clang-11
106             - libc++-11-dev
107             - libc++abi-11-dev
108       env:
109         # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
110         - CC='clang-11 -fsanitize=address'
111         - CXX='clang++-11 -fsanitize=address -stdlib=libc++'
112         - PART=1
114     - name: "Clang 11 libc++ and ASAN part 2"
115       stage: check
116       os: linux
117       dist: bionic
118       addons: *clang11
119       env:
120         # Do not use ASAN with ubuntu's libc++: https://bugs.llvm.org/show_bug.cgi?id=17379
121         - CC='clang-11 -fsanitize=address'
122         - CXX='clang++-11 -fsanitize=address -stdlib=libc++'
123         - PART=2
125     # See https://github.com/simd-everywhere/simde/blob/master/.travis.yml
126     # and https://software.intel.com/content/www/us/en/develop/documentation/get-started-with-intel-oneapi-render-linux/top/configure-your-system.html.
127     - name: "ICC"
128       stage: check
129       os: linux
130       compiler: icc
131       env:
132         - CC=icc
133         - CXX=icpc
134       install:
135         - source /opt/intel/oneapi/compiler/latest/env/vars.sh
136       addons:
137         apt:
138           sources:
139           - sourceline: 'deb https://apt.repos.intel.com/oneapi all main'
140             key_url: 'https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB'
141           packages:
142           - intel-oneapi-icc
144     - name: "ARM64: GCC 11 -O2 part 1"
145       stage: check
146       os: linux
147       arch: arm64
148       dist: bionic
149       addons: *gcc11
150       env:
151         - CC=gcc-11
152         - CXX=g++-11
153         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O2 CXXFLAGS=-O2'
154         - PART=1
156     - name: "PPC64le: GCC 11 -O2 part 1"
157       stage: check
158       os: linux
159       arch: ppc64le
160       dist: bionic
161       addons:
162         apt:
163           sources:
164             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
165             - sourceline: 'ppa:ubuntu-toolchain-r/test'
166           packages: g++-11
167       env:
168         - CC=gcc-11
169         - CXX=g++-11
170         - CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
171         - PART=1
173     - name: "s390x: GCC 11 -O2 part 1"
174       stage: check
175       os: linux
176       arch: s390x
177       dist: bionic
178       addons: *gcc11
179       env:
180         - CC=gcc-11
181         - CXX=g++-11
182         - CONFIGUREFLAGS='CFLAGS=-O2 CXXFLAGS=-O2'
183         - PART=1
185     ## ----- ##
186     ## GCC.  ##
187     ## ----- ##
189     - name: "GCC 10 with sanitizers part 1"
190       stage: check
191       os: linux
192       dist: bionic
193       addons:
194         apt:
195           sources:
196             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
197             - sourceline: 'ppa:ubuntu-toolchain-r/test'
198           packages: g++-10
199       env:
200         - CC='gcc-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
201         - CXX='g++-10 -fsanitize=undefined,address -fno-omit-frame-pointer'
202         - CONFIGUREFLAGS='CFLAGS=-O1 CXXFLAGS=-O1'
203         - PART=1
205     # With glr2.cc, we run out of time with the full test suite.
206     - name: "GCC 9 part 1"
207       stage: check
208       os: linux
209       dist: bionic
210       addons:
211         apt:
212           sources:
213             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
214             - sourceline: 'ppa:ubuntu-toolchain-r/test'
215           packages: g++-9
216       env:
217         - CC=gcc-9
218         - CXX=g++-9
219         - PART=1
221     # With glr2.cc, we run out of time with the full test suite.
222     - name: "GCC 8 part 1"
223       stage: check
224       os: linux
225       dist: bionic
226       addons:
227         apt:
228           packages: g++-8
229       env:
230         - CC=gcc-8
231         - CXX=g++-8
232         - PART=1
234     - name: "GCC 7"
235       stage: check
236       os: linux
237       dist: bionic
238       addons:
239         apt:
240           packages: g++-7
241       env:
242         - CC=gcc-7
243         - CXX=g++-7
245     - name: "GCC 6"
246       stage: check
247       os: linux
248       dist: xenial
249       addons:
250         apt:
251           sources: ubuntu-toolchain-r-test
252           packages: g++-6
253       env:
254         - CC=gcc-6
255         - CXX=g++-6
257     - name: "GCC 5"
258       stage: check
259       os: linux
260       dist: xenial
261       addons:
262         apt:
263           sources: ubuntu-toolchain-r-test
264           packages: g++-5
265       env:
266          - CC=gcc-5
267          - CXX=g++-5
269     - name: "GCC 4.9"
270       stage: check
271       os: linux
272       dist: xenial
273       addons:
274         apt:
275           sources: ubuntu-toolchain-r-test
276           packages: g++-4.9
277       env:
278          - CC=gcc-4.9
279          - CXX=g++-4.9
281     - name: "GCC 4.8"
282       stage: check
283       os: linux
284       dist: xenial
285       addons:
286         apt:
287           sources: ubuntu-toolchain-r-test
288           packages: g++-4.8
289       env:
290          - CC=gcc-4.8
291          - CXX=g++-4.8
293     - name: "GCC 4.7"
294       stage: check
295       os: linux
296       dist: xenial
297       addons:
298         apt:
299           sources: ubuntu-toolchain-r-test
300           packages: g++-4.7
301       env:
302          - CC=gcc-4.7
303          - CXX=g++-4.7
305     - name: "GCC 4.6"
306       stage: check
307       os: linux
308       dist: xenial
309       addons:
310         apt:
311           sources: ubuntu-toolchain-r-test
312           packages: g++-4.6
313       env:
314          - CC=gcc-4.6
315          - CXX=g++-4.6
317     ## ------- ##
318     ## Clang.  ##
319     ## ------- ##
321     - name: "Clang 10 -O3, libc++, part 1"
322       stage: check
323       os: linux
324       dist: bionic
325       addons:
326         apt:
327           sources:
328             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
329             - sourceline: 'ppa:ubuntu-toolchain-r/test'
330             - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
331               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
332           packages:
333             - clang-10
334             - libc++-10-dev
335             - libc++abi-10-dev
336       env:
337         - CC='clang-10'
338         - CXX='clang++-10 -stdlib=libc++'
339         - CONFIGUREFLAGS='CPPFLAGS=-DNDEBUG CFLAGS=-O3 CXXFLAGS=-O3'
340         - PART=1
342     - name: "Clang 9 and libc++"
343       stage: check
344       os: linux
345       dist: bionic
346       addons:
347         apt:
348           sources:
349             # See https://github.com/travis-ci/apt-source-safelist/issues/410.
350             - sourceline: 'ppa:ubuntu-toolchain-r/test'
351             - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
352               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
353           packages:
354             - clang-9
355             - libc++-9-dev
356             - libc++abi-9-dev
357       env:
358         - CC='clang-9'
359         - CXX='clang++-9 -stdlib=libc++'
361     - name: "Clang 8 and libc++"
362       stage: check
363       os: linux
364       dist: bionic
365       addons:
366         apt:
367           packages:
368             - clang-8
369             - libc++-8-dev
370             - libc++abi-8-dev
371       env:
372         - CC=clang-8
373         - CXX='clang++-8 -stdlib=libc++'
375     - name: "Clang 7 and libc++"
376       stage: check
377       os: linux
378       dist: bionic
379       addons:
380         apt:
381           packages:
382             - clang-7
383             - libc++-7-dev
384             - libc++abi-7-dev
385       env:
386         - CC=clang-7
387         - CXX='clang++-7 -stdlib=libc++'
389     - name: "Clang 6 and libc++"
390       stage: check
391       os: linux
392       dist: xenial
393       addons:
394         apt:
395           sources:
396             - llvm-toolchain-xenial-6.0
397             - ubuntu-toolchain-r-test
398           packages:
399             - clang-6.0
400             - libc++-dev
401       env:
402         - CC=clang-6.0
403         - CXX='clang++-6.0 -stdlib=libc++'
405     - name: "Clang 5"
406       stage: check
407       os: linux
408       dist: xenial
409       addons:
410         apt:
411           sources: llvm-toolchain-xenial-5.0
412           packages:
413             - clang-5.0
414             - libc++-dev
415       env:
416         - CC='clang-5.0'
417         - CXX='clang++-5.0'
419     - name: "Clang 4"
420       stage: check
421       os: linux
422       dist: xenial
423       addons:
424         apt:
425           sources: llvm-toolchain-xenial-4.0
426           packages: clang-4.0
427       env:
428         - CC=clang-4.0
429         - CXX=clang++-4.0
431     - name: "Clang 3.9"
432       stage: check
433       os: linux
434       dist: xenial
435       addons:
436         apt:
437           sources: llvm-toolchain-xenial-3.9
438           packages: clang-3.9
439       env:
440         - CC=clang-3.9
441         - CXX=clang++-3.9
443     - name: "Clang 3.8"
444       stage: check
445       os: linux
446       dist: xenial
447       addons:
448         apt:
449           sources:
450             - ubuntu-toolchain-r-test
451             - llvm-toolchain-precise-3.8
452           packages: clang-3.8
453       env:
454         - CC=clang-3.8
455         - CXX=clang++-3.8
457     - name: "CLang 3.7"
458       stage: check
459       os: linux
460       dist: xenial
461       addons:
462         apt:
463           sources:
464             - ubuntu-toolchain-r-test
465             - llvm-toolchain-precise-3.7
466           packages: clang-3.7
467       env:
468         - CC=clang-3.7
469         - CXX=clang++-3.7
471     - name: "Clang 3.6"
472       stage: check
473       os: linux
474       dist: xenial
475       addons:
476         apt:
477           sources:
478             - ubuntu-toolchain-r-test
479             - llvm-toolchain-precise-3.6
480           packages: clang-3.6
481       env:
482         - CC=clang-3.6
483         - CXX=clang++-3.6
485     - name: "Clang 3.5"
486       stage: check
487       os: linux
488       dist: xenial
489       addons:
490         apt:
491           sources:
492             - ubuntu-toolchain-r-test
493             - llvm-toolchain-precise-3.5
494           packages: clang-3.5
495       env:
496         - CC=clang-3.5
497         - CXX=clang++-3.5
499     - name: "Clang 3.4"
500       stage: check
501       os: linux
502       # Not available on Xenial.
503       dist: trusty
504       addons:
505         apt:
506           packages: clang-3.4
507       env:
508         # No versioned name installed, but beware that Travis installs
509         # a more modern clang earlier in the default PATH.
510         - CC=/usr/bin/clang
511         - CXX=/usr/bin/clang++
513     - name: "Clang 3.3"
514       stage: check
515       os: linux
516       # Not available on Xenial.
517       dist: trusty
518       addons:
519         apt:
520           packages: clang-3.3
521       env:
522         # See comment for 3.4.
523         - CC=/usr/bin/clang
524         - CXX=/usr/bin/clang++
526 ## From https://docs.gitlab.com/ce/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor.
527 ## Applies to Travis too.  Applied to all the 'script's (of all the jobs).
528 before_script:
529   - 'which ssh-agent || ( sudo apt-get install openssh-client -y )'
530   - eval "$(ssh-agent -s)"
531   # $SSH_PRIVATE_KEY is multiline.  Use $'...' to register its value: $'-----BEGIN OPENSSH PRIVATE KEY-----\nXXXXX...\n...==\n-----END OPENSSH PRIVATE KEY-----'.
532   - echo "$SSH_PRIVATE_KEY" >/tmp/key.id_rsa
533   - chmod 600 /tmp/key.id_rsa
534   - ssh-add /tmp/key.id_rsa </dev/null
535   - mkdir -p ~/.ssh
536   - chmod 700 ~/.ssh
537   - echo '|1|bpc51UGxoDZjCPiwRlCStW32trI=|rfh6mLoLZv/vAvOVrpZXI1hTLxg= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIR+ckMoJTNXHvAQLHWSfrRnrNJGW2ZR6kr5pBVDGCkz1v1RcQ5rleq0NAt9kS3v4hgnuLiEVnK7KDRzcEH3ikc=' >>~/.ssh/known_hosts
538   - chmod 600 ~/.ssh/known_hosts
540 # Applies only to the jobs that don't have a 'script', i.e., applies to all the 'check' jobs, but not the 'dist' one.
541 script:
542   # Beware not too leak $SSH_PRIVATE_KEY.
543   # - env
544   - sudo apt-get install -qq doxygen flex m4
545   # Install and activate dmd.
546   - mkdir -p ~/dlang && wget https://dlang.org/install.sh -O ~/dlang/install.sh
547   - source $(source ~/dlang/install.sh dmd -a) || true
549   - $CC --version
550   - $CXX --version
551   - dmd --version || true
552   - doxygen --version
553   - flex --version
554   - ld --version
555   - m4 --version
557   - if [[ -f ~/.bashrc ]]; then source ~/.bashrc; fi
558   # Unset this variable, otherwise, Java programs' stderr is cluttered
559   # with `Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m`, which makes
560   # the test suite fail.
561   - unset _JAVA_OPTIONS
563   # Fail fast from now on.
564   - set -e
565   - sftp bison@sftp.lrde.epita.fr:bison-$TRAVIS_BUILD_NUMBER.tar.xz
566   - tar xf bison-$TRAVIS_BUILD_NUMBER.tar.xz
567   - dir=$(tar tf bison-$TRAVIS_BUILD_NUMBER.tar.xz | sed 1q)
568   - cd $dir
569   - mkdir _build
570   - cd _build
571   - ../configure --enable-gcc-warnings CC="$CC" CXX="$CXX" $CONFIGUREFLAGS || { cat config.log && false; }
572   - make -j2 $MAKE_ARGS
573   - if test ${PART-1} = 1; then make check                  VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat test-suite.log && cat tests/testsuite.log && false; }; fi
574   - if test ${PART-2} = 2; then make maintainer-check-posix VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi
575   - if test ${PART-2} = 2; then make maintainer-check-g++   VERBOSE=1 TESTSUITEFLAGS=-j2 || { cat tests/testsuite.log && false; }; fi