aboutsummaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 019d51a73a9bdae4d070c384e9e217278e5eecda (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
sudo: false

branches:
  only:
  - master
  # Release branches
  - /^[0-9]+\.[0-9]+$/

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

env:
  - MESON_ARGS=""
  - RUN_TESTS_ARGS="--no-unittests" MESON_ARGS="--unity=on"

language:
  - cpp

services:
  - docker

matrix:
  exclude:
  # On OS X gcc is just a wrapper around clang, so don't waste time testing that
  - os: osx
    compiler: gcc
  include:
  # Test cross builds separately, they do not use the global compiler
  - os: linux
    compiler: gcc
    env: RUN_TESTS_ARGS="--cross"
  - os: linux
    compiler: gcc
    env: RUN_TESTS_ARGS="--cross" MESON_ARGS="--unity=on"

before_install:
  - python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt llvm ninja; fi
    # # Run one macOS build without pkg-config available, and the other (unity=on) with pkg-config
  - if [[ "$TRAVIS_OS_NAME" == "osx" && "$MESON_ARGS" =~ .*unity=on.* ]]; then brew install pkg-config; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:cosmic; fi

# We need to copy the current checkout inside the Docker container,
# because it has the MR id to be tested checked out.

script:
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM jpakkane/mesonci:cosmic > Dockerfile; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
  - |
    if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
      ci_env=`bash <(curl -s https://codecov.io/env)`
      docker run --security-opt seccomp:unconfined $ci_env -v ${PWD}/.coverage:/root/.coverage \
        withgit \
          /bin/sh -c "cd /root && mkdir -p tools; wget -c https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip -O /root/tools/ninja.zip; unzip -d /root/tools /root/tools/ninja.zip; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH ./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS && chmod -R a+rwX .coverage"
    fi
  # Ensure that llvm is added after $PATH, otherwise the clang from that llvm install will be used instead of the native apple clang.
  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH:$(brew --prefix llvm)/bin ./run_tests.py $RUN_TESTS_ARGS --backend=ninja -- $MESON_ARGS ; fi