diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-04-06 12:13:40 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-04-08 23:37:53 +0300 |
commit | 0d27be0ba5f99997153cf324ec68779267b84417 (patch) | |
tree | b526e9e44cad7b4c861d60bcc0ea18c97fc6e04d | |
parent | e034ebd1537a72d550a699c0d155f19f4791bdc0 (diff) | |
download | meson-0d27be0ba5f99997153cf324ec68779267b84417.zip meson-0d27be0ba5f99997153cf324ec68779267b84417.tar.gz meson-0d27be0ba5f99997153cf324ec68779267b84417.tar.bz2 |
travis: Fix Travis OSX build
-rw-r--r-- | .travis.yml | 22 | ||||
-rwxr-xr-x | ci/travis_install.sh | 19 | ||||
-rwxr-xr-x | ci/travis_script.sh | 59 |
3 files changed, 80 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml index 7ea7d54..f5a32a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,25 +40,7 @@ matrix: 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 ldc 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 mesonbuild/eoan; fi - -# We need to copy the current checkout inside the Docker container, -# because it has the MR id to be tested checked out. + - ./ci/travis_install.sh script: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM mesonbuild/eoan > 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/bash -c "cd /root && source /ci/env_vars.sh && 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 + - ./ci/travis_script.sh diff --git a/ci/travis_install.sh b/ci/travis_install.sh new file mode 100755 index 0000000..346dcb6 --- /dev/null +++ b/ci/travis_install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +msg() { echo -e "\x1b[1;32mINFO: \x1b[37m$*\x1b[0m"; } + +if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + msg "Running OSX setup" + brew update + brew install qt ldc llvm ninja + if [[ "$MESON_ARGS" =~ .*unity=on.* ]]; then + which pkg-config || brew install pkg-config + fi +elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + msg "Running Linux setup" + docker pull mesonbuild/eoan +fi + +msg "Setup finished" diff --git a/ci/travis_script.sh b/ci/travis_script.sh new file mode 100755 index 0000000..a91a5dd --- /dev/null +++ b/ci/travis_script.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e + +msg() { echo -e "\x1b[1;32mINFO: \x1b[37m$*\x1b[0m"; } + +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + # TODO enable coverage + #curl -s https://codecov.io/bash > upload.sh + #chmod +x upload.sh + + # We need to copy the current checkout inside the Docker container, + # because it has the MR id to be tested checked out. + + msg "Generating runner:" + cat <<EOF | tee run.sh +#!/bin/bash + +set -e + +export CC=$CC +export CXX=$CXX +export OBJC=$CC +export OBJCXX=$CXX +export PATH=/root/tools:$PATH + +source /ci/env_vars.sh +cd /root + +./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS +#./upload.sh + +EOF + + chmod +x run.sh + + msg "Generating Dockerfile:" + cat <<EOF | tee Dockerfile +FROM mesonbuild/eoan +ADD . /root + +EOF + + msg "Building the docker image..." + docker build -t test_img . + + msg "Start running tests" + #ci_env=`bash <(curl -s https://codecov.io/env)` + docker run --security-opt seccomp:unconfined test_img /root/run.sh + +elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + # Ensure that llvm is added after $PATH, otherwise the clang from that llvm install will be used instead of the native apple clang. + export SDKROOT=$(xcodebuild -version -sdk macosx Path) + export CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib + export OBJC=$CC + export OBJCXX=$CXX + export PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH:$(brew --prefix llvm)/bin + ./run_tests.py $RUN_TESTS_ARGS --backend=ninja -- $MESON_ARGS +fi |