* 2022-01-18 [ci skip]
[ruby-80x24.org.git] / .travis.yml
blobf8c66f715e748297a07545f929c5033b4e5f6360
1 # -*- YAML -*-
2 # Copyright (C) 2011 Urabe, Shyouhei.  All rights reserved.
4 # This file is  a part of the programming language  Ruby.  Permission is hereby
5 # granted,  to either  redistribute  or  modify this  file,  provided that  the
6 # conditions  mentioned in  the file  COPYING are  met.  Consult  the  file for
7 # details.
9 # We only manage non-amd64 free pipelines.
10 # https://docs.travis-ci.com/user/billing-overview/
12 language: c
14 os: linux
16 if: commit_message !~ /^\[DOC\]/
18 dist: focal
20 git:
21   quiet: true
23 cache:
24   ccache: true
25   directories:
26     - $HOME/config_2nd
27     - $HOME/.downloaded-cache
29 env:
30   global:
31     # The tests skipped in `make test-all`.
32     - TEST_ALL_SKIPPED_TESTS=
33     # The tests executed separately by `make test-all`.
34     - TEST_ALL_SEPARATED_TESTS=
35     # Reset timestamps early
36     - _=$(touch NEWS && find . -type f -exec touch -r NEWS {} +)
37     - CONFIGURE_TTY=no
38     - CCACHE_COMPILERCHECK=none
39     - CCACHE_NOCOMPRESS=1
40     - CCACHE_MAXSIZE=512Mi
41     - NPROC="`nproc`"
42     # JOBS and SETARCH are overridden when necessary; see below.
43     - JOBS=-j$((1+${NPROC}))
44     - SETARCH=
45     - RUBY_PREFIX=/tmp/ruby-prefix
46     - GEMS_FOR_TEST='timezone tzinfo'
47     # https://github.com/travis-ci/travis-build/blob/e411371dda21430a60f61b8f3f57943d2fe4d344/lib/travis/build/bash/travis_apt_get_options.bash#L7
48     - travis_apt_get_options='--allow-downgrades --allow-remove-essential --allow-change-held-packages'
49     - travis_apt_get_options="-yq --no-install-suggests --no-install-recommends $travis_apt_get_options"
50     # -O1 is faster than -O3 in our tests.
51     - optflags=-O1
52     # -g0 disables backtraces when SEGV.  Do not set that.
53     - debugflags=-ggdb3
55 .org.ruby-lang.ci.matrix-definitions:
57   - &gcc-10
58     compiler: gcc-10
59     before_install:
60       - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
61       - >-
62         tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
63         ccache
64         gcc-10
65         g++-10
66         libffi-dev
67         libgdbm-dev
68         libncurses-dev
69         libncursesw5-dev
70         libreadline-dev
71         libssl-dev
72         libyaml-dev
73         openssl
74         zlib1g-dev
76   # --------
78   - &arm64-linux
79     name: arm64-linux
80     arch: arm64
81     <<: *gcc-10
83   - &ppc64le-linux
84     name: ppc64le-linux
85     arch: ppc64le
86     <<: *gcc-10
88   - &s390x-linux
89     name: s390x-linux
90     arch: s390x
91     <<: *gcc-10
93   - &arm32-linux
94     name: arm32-linux
95     arch: arm64
96     # https://packages.ubuntu.com/focal/crossbuild-essential-armhf
97     compiler: arm-linux-gnueabihf-gcc
98     env:
99       - SETARCH='setarch linux32 --verbose --32bit'
100       # The "TestReadline#test_interrupt_in_other_thread" started failing on arm32
101       # from https://www.travis-ci.com/github/ruby/ruby/jobs/529005145
102       - TEST_ALL_SKIPPED_TESTS=test_interrupt_in_other_thread
103     before_install:
104       - sudo dpkg --add-architecture armhf
105       - tool/travis_retry.sh sudo bash -c "rm -rf '${TRAVIS_ROOT}/var/lib/apt/lists/'* && exec apt-get update -yq"
106       - >-
107         tool/travis_retry.sh sudo -E apt-get $travis_apt_get_options install
108         ccache
109         crossbuild-essential-armhf
110         libc6:armhf
111         libstdc++-10-dev:armhf
112         libffi-dev:armhf
113         libgdbm-dev:armhf
114         libncurses-dev:armhf
115         libncursesw5-dev:armhf
116         libreadline-dev:armhf
117         libssl-dev:armhf
118         linux-libc-dev:armhf
119         zlib1g-dev:armhf
121 matrix:
122   include:
123     # Build every commit (Allowed Failures):
124     - <<: *arm32-linux
125     # Comment out as the 2nd arm64 pipeline is unstable.
126     # - <<: *arm64-linux
127     - <<: *ppc64le-linux
128     - <<: *s390x-linux
129   allow_failures:
130     # We see multiple errors indicating errors on the Travis environment itself in a short while:
131     # https://app.travis-ci.com/github/ruby/ruby/jobs/544382885
132     # https://app.travis-ci.com/github/ruby/ruby/jobs/544361370
133     # It's not a fault of Ruby's arm32 support but just Travis arm32 seems unsable.
134     - name: arm32-linux
135     # - name: arm64-linux
136     # We see "Some worker was crashed." in about 40% of recent ppc64le-linux jobs
137     # e.g. https://app.travis-ci.com/github/ruby/ruby/jobs/530959548
138     - name: ppc64le-linux
139     # Tentatively disable, because often hungs up **after** all tests
140     # have finished successfully and saving caches.
141     - name: s390x-linux
142   fast_finish: true
144 before_script:
145   - . tool/ci_functions.sh
146   - |-
147     if [ -n "${TEST_ALL_SKIPPED_TESTS}" ]; then
148       TEST_ALL_OPTS="${TEST_ALL_OPTS} $(ci_to_excluded_test_opts "${TEST_ALL_SKIPPED_TESTS}")"
149       if [ -z "${TEST_ALL_SEPARATED_TESTS}" ]; then
150         TEST_ALL_SEPARATED_TESTS="${TEST_ALL_SKIPPED_TESTS}"
151       fi
152     fi
153   - |-
154     if [ -n "${TEST_ALL_SEPARATED_TESTS}" ]; then
155       TEST_ALL_OPTS_SEPARATED="$(ci_to_included_test_opts "${TEST_ALL_SEPARATED_TESTS}")"
156     fi
157   - echo TEST_ALL_OPTS="${TEST_ALL_OPTS}" TEST_ALL_OPTS_SEPARATED="${TEST_ALL_OPTS_SEPARATED}"
158   - rm -fr .ext autom4te.cache
159   - |-
160     [ -d ~/.downloaded-cache ] ||
161     mkdir ~/.downloaded-cache
162   - ln -s ~/.downloaded-cache
163   - "> config.status"
164   - "> .rbconfig.time"
165   - sed -f tool/prereq.status template/Makefile.in common.mk > Makefile
166   - make -s $JOBS up
167   - make -s $JOBS srcs
168   - rm -f config.status Makefile rbconfig.rb .rbconfig.time
169   - |-
170     if [ -d ~/config_2nd ]; then
171       cp -pr ~/config_2nd build
172     else
173       mkdir build
174     fi
175   - mkdir config_1st config_2nd
176   - chmod -R a-w .
177   - chmod -R u+w build config_1st config_2nd
178   - cd build
179   - |-
180     case "$CC" in
181     gcc*)   CC="ccache $CC${GCC_FLAGS:+ }$GCC_FLAGS -fno-diagnostics-color";;
182     clang*) CC="ccache $CC${GCC_FLAGS:+ }$GCC_FLAGS -fno-color-diagnostics";;
183     esac
184   - |-
185     [ ! -f config.cache ] ||
186     [ "$CC" = "`sed -n s/^ac_cv_prog_CC=//p config.cache`" ] ||
187     (set -x; exec rm config.cache)
188   - $SETARCH ../configure -C --disable-install-doc --prefix=$RUBY_PREFIX $CONFIG_FLAG
189   - cp -pr config.cache config.status .ext/include ../config_1st
190   - $SETARCH make reconfig
191   - cp -pr config.cache config.status .ext/include ../config_2nd
192   - (cd .. && exec diff -ru config_1st config_2nd)
193   - chmod u+w ..
194   - rm -rf ~/config_2nd
195   - mv ../config_2nd ~
196   - chmod u-w ..
197   - $SETARCH make -s $JOBS
198   - make -s install
199   - |-
200     [ -z "${GEMS_FOR_TEST}" ] ||
201     $RUBY_PREFIX/bin/gem install --no-document $GEMS_FOR_TEST
202   - echo "raise 'do not load ~/.irbrc in test'" > ~/.irbrc
204 script:
205   - $SETARCH make -s test -o showflags TESTOPTS="${TESTOPTS=$JOBS -q --tty=no}"
206   - ../tool/travis_wait.sh $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -q --tty=no ${TEST_ALL_OPTS}" RUBYOPT="-w"
207   # Run the failing tests separately returning ok status to check if it works,
208   # visualize them.
209   - |
210     if [ -n "${TEST_ALL_OPTS_SEPARATED}" ]; then
211       $SETARCH make -s test-all -o exts TESTOPTS="$JOBS -v --tty=no ${TEST_ALL_OPTS_SEPARATED}" RUBYOPT="-w" || :
212     fi
213   - $SETARCH make -s test-spec MSPECOPT=-ff # not using `-j` because sometimes `mspec -j` silently dies
214   - $SETARCH make -s -o showflags leaked-globals
216 # We enable Travis on the specific branches or forked repositories here.
217 if: (repo = ruby/ruby AND (branch = master OR branch =~ /^ruby_\d_\d$/)) OR repo != ruby/ruby
219 # We want to be notified when something happens.
220 notifications:
221   irc:
222     channels:
223       - "chat.freenode.net#ruby-core"
224     on_success: change # [always|never|change] # default: always
225     on_failure: always # [always|never|change] # default: always
226     template:
227       - "%{message} by @%{author}: See %{build_url}"
229   webhooks:
230     urls:
231       - secure: mRsoS/UbqDkKkW5p3AEqM27d4SZnV6Gsylo3bm8T/deltQzTsGzZwrm7OIBXZv0UFZdE68XmPlyHfZFLSP2V9QZ7apXMf9/vw0GtcSe1gchtnjpAPF6lYBn7nMCbVPPx9cS0dwL927fjdRM1vj7IKZ2bk4F0lAJ25R25S6teqdk= # ruby-lang slack: ruby/simpler-alerts-bot (travis)
232     on_success: never
233     on_failure: always
235   email:
236     - jaruga@ruby-lang.org