summaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: 99914b941de8433ba15dc512832f1ea60fa0402d (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
sudo: false

language: c

jobs:
    include:
        # Build with gcc and run tests on Ubuntu.
        -   &test-ubuntu
            stage: test
            os: linux
            compiler: gcc

            addons:
                apt:
                    packages:
                        - valgrind
                        - bison
                        - automake

            before_install:
                - uname -s
                - rvm install ruby-1.9.3-p551
                - rvm use 1.9.3
                - rm src/{lexer,parser}.{c,h}
                - sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac

            install:
                - bundle install --gemfile=docs/Gemfile
                - wget http://ftp.debian.org/debian/pool/main/b/bison/bison_3.0.2.dfsg-2_amd64.deb
                - ar p bison_3.0.2.dfsg-2_amd64.deb data.tar.xz | tar xJ
                - if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi

            before_script:
                # If this is OS X we'll get bison from brew, else we'll get bison
                # from the .deb unpacked above in the install section.
                - PATH=/usr/local/opt/bison/bin:$PWD/usr/bin:$PATH
                - echo SHELL=$SHELL
                - echo PATH=$PATH
                - which bison
                - bison --version
                - autoreconf -if
                - ./configure --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE

            script:
                # When using the bison from Debian we need to tell that bison where
                # to find its data.  Yay non-relocatable code.  Not.
                - echo PATH=$PATH
                - which bison
                - make BISON_PKGDATADIR=$PWD/usr/share/bison src/parser.c || make src/parser.c
                # Make dist!
                #
                # Make it first to fail the build early, before we test with
                # valgrind.
                - make dist
                # Build and test the dist (without valgrind)
                - |
                    (
                    tar xvf jq-`scripts/version`.tar.gz &&
                    cd jq-`scripts/version` &&
                    pwd &&
                    ./configure --disable-valgrind --with-oniguruma=builtin YACC="$(which bison) -y" $COVERAGE &&
                    make BISON_PKGDATADIR=$PWD/usr/share/bison src/parser.c || make src/parser.c &&
                    make -j4 &&
                    make check -j4 || true
                    )
                # Build and test the HEAD
                - make -j4
                - make check -j4

            after_failure:
                - cat test-suite.log
                - cat tests/*.log


        # Build with clang and run tests on Ubuntu.
        -   <<: *test-ubuntu
            compiler: clang


        # Build with gcc and run tests with gcov on Ubuntu.
        -   <<: *test-ubuntu
            env: COVERAGE="--disable-valgrind --enable-gcov"

            after_script:
                - rm -rf src/.libs # don't care about coverage for libjq
                - coveralls --gcov-options '\-lp'
                    -e src/lexer.c -e src/parser.c -e src/jv_dtoa.c


        # Build with gcc and run tests on macOS.
        -   &test-osx
            <<: *test-ubuntu
            os: osx

            before_install:
                - uname -s
                - brew update
                - brew install flex
                - brew install bison
                - rvm install ruby-1.9.3-p551
                - rvm use 1.9.3
                - rm src/{lexer,parser}.{c,h}
                - sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac

            install:
                - bundle install --gemfile=docs/Gemfile
                - if [ -n "$COVERAGE" ]; then pip install --user cpp-coveralls; fi


        # Build with clang and run tests on macOS.
        -   <<: *test-osx
            compiler: clang


        # Build with gcc and run tests on Alpine Linux v3.7 (inside chroot).
        # Note: Alpine uses musl libc.
        -   &test-alpine
            stage: test
            os: linux
            language: minimal
            compiler: gcc
            sudo: true

            before_install:
                - "wget 'https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.7.0/alpine-chroot-install' \
                    && echo '090d323d887ef3a2fd4e752428553f22a52b87bb  alpine-chroot-install' | sha1sum -c || travis_terminate 1"
                - alpine() { /alpine/enter-chroot -u "$USER" "$@"; }

            install:
                - sudo sh alpine-chroot-install -b v3.7 -a "$ARCH"
                    -p 'build-base automake autoconf bison libtool oniguruma-dev'

            before_script:
                - autoreconf -if

            script:
                - alpine ./configure --disable-docs
                - alpine make
                - alpine make check


notifications:
    email: false