From 635ecbeb902726919c828fbc07421b6cf7d78811 Mon Sep 17 00:00:00 2001 From: Zion Nimchuk Date: Sun, 15 Jul 2018 18:12:43 -0700 Subject: [PATCH] Travis refactor --- .travis.yml | 165 +++++++------------------------------- .travis/build-linux.bash | 35 ++++++++ .travis/build-mac.bash | 21 +++++ .travis/deploy-linux.bash | 31 +++++++ 4 files changed, 116 insertions(+), 136 deletions(-) create mode 100644 .travis/build-linux.bash create mode 100644 .travis/build-mac.bash create mode 100644 .travis/deploy-linux.bash diff --git a/.travis.yml b/.travis.yml index ebb7b1e9a0..a25ee78685 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,140 +1,33 @@ language: cpp -sudo: required - -os: - - linux - #- osx - -compiler: - - clang - - gcc - -cache: ccache - matrix: - fast_finish: true - allow_failures: - - os: osx - compiler: clang - exclude: - - os: osx - compiler: gcc - + include: + - os: linux + env: + - NAME="Linux build" + - COMPILER="gcc" + dist: trusty + services: docker + cache: ccache + install: "docker pull rpcs3/rpcs3-travis-trusty:1.0" + script: 'docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache -e TRAVIS_PULL_REQUEST -e TRAVIS_BRANCH -e UPLOAD_URL -e COMPILER rpcs3/rpcs3-travis-trusty:1.0 /bin/bash -ex /rpcs3/.travis/build-linux.bash' + - os: linux + env: + - NAME="Linux build" + - COMPILER="clang" + - DEPLOY_APPIMAGE="true" + dist: trusty + services: docker + cache: ccache + install: "docker pull rpcs3/rpcs3-travis-trusty:1.0" + script: 'docker run -v $(pwd):/rpcs3 -v "$HOME/.ccache":/root/.ccache -e TRAVIS_PULL_REQUEST -e TRAVIS_BRANCH -e TRAVIS_COMMIT -e COMPILER -e UPLOAD_URL -e DEPLOY_APPIMAGE rpcs3/rpcs3-travis-trusty:1.0 /bin/bash -ex /rpcs3/.travis/build-linux.bash' + - os: osx + osx_image: xcode10 + script: "/bin/bash -ex .travis/build-mac.bash" + cache: ccache + # Unfortunately Requires MacOS 10.14 Mojave for latest c++ features, which Travis doesn't use yet + allow_failures: + - os: osx + git: depth: false # Unshallow clone to obtain proper GIT_VERSION - submodules: false - -env: - - QTVER=5.10.1 - -before_install: - - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" = "g++" ]; then - export CXX="g++-8" CC="gcc-8" CXXFLAGS="-Wno-format-security"; - fi; - -install: - # Install updated libglew-dev since the version provided by trusty is outdated - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - wget https://mirrors.kernel.org/ubuntu/pool/universe/g/glew/libglew-dev_2.0.0-5_amd64.deb; - wget https://mirrors.kernel.org/ubuntu/pool/universe/g/glew/libglew2.0_2.0.0-5_amd64.deb; - wget https://mirrors.kernel.org/ubuntu/pool/universe/v/vulkan/libvulkan1_1.1.73+dfsg-1_amd64.deb; - wget https://mirrors.kernel.org/ubuntu/pool/universe/v/vulkan/libvulkan-dev_1.1.73+dfsg-1_amd64.deb; - sudo apt-get install --only-upgrade dpkg; - sudo dpkg -i libglew2.0_2.0.0-5_amd64.deb libglew-dev_2.0.0-5_amd64.deb libvulkan1_1.1.73+dfsg-1_amd64.deb libvulkan-dev_1.1.73+dfsg-1_amd64.deb; - else - brew install ccache glew ninja qt; - export CCACHE_SLOPPINESS=pch_defines,time_macros; - export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/; - export PATH="/usr/local/opt/ccache/libexec:$PATH"; - fi; - # Download pre-compiled LLVM libs - - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - wget https://github.com/RPCS3/llvm/releases/download/continuous-linux-master/llvmlibs-linux.tar.gz; - mkdir llvmlibs; - tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs; - fi; - -before_script: - - git submodule update --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang - - mkdir build ; cd build - - if [ "$TRAVIS_PULL_REQUEST" = false ]; then - export CXXFLAGS="$CXXFLAGS -DBRANCH=$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH"; - else - export CXXFLAGS="$CXXFLAGS -DBRANCH=$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/#$TRAVIS_PULL_REQUEST"; - fi; - - cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_DIR=../llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja; - -script: - - ninja -j 2 - -after_script: - - cd build - - # AppImage generation - - if [ -n "$UPLOAD_URL" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$CC" = "clang" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then - source /opt/qt*/bin/qt*-env.sh ; - echo $LD_LIBRARY_PATH ; - export LD_LIBRARY_PATH=/opt/qt510/lib ; - DESTDIR=appdir ninja install ; find appdir/ ; - find ../bin ; - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" ; - chmod a+x linuxdeployqt*.AppImage ; - ./linuxdeployqt*.AppImage ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs ; - rm ./appdir/usr/lib/libfreetype.so.6 ; - rm ./appdir/usr/lib/libglapi.so.0 ; - rm ./appdir/usr/lib/libxcb* ; - rm -r ./appdir/usr/share/doc ; - rm -r ./appdir/usr/share/man ; - rm -r ./appdir/usr/include ; - export PATH=${TRAVIS_BUILD_DIR}/build/squashfs-root/usr/bin/:${PATH} ; - - echo "Embed newer libstdc++ for distros that don't come with it (ubuntu 14.04)"; - mkdir -p appdir/usr/optional/ ; mkdir -p appdir/usr/optional/libstdc++/ ; - cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/ ; - rm ./appdir/AppRun ; - wget -c https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O ./appdir/AppRun ; - chmod a+x ./appdir/AppRun ; - wget -c https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./appdir/usr/optional/exec.so ; - - echo "Package it up and send it off" ; - ./linuxdeployqt*.AppImage --appimage-extract ; - ./squashfs-root/usr/bin/appimagetool ${TRAVIS_BUILD_DIR}/build/appdir ; - find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq ; - COMM_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))" ; - COMM_COUNT="$(git rev-list --count HEAD)" ; - curl "${UPLOAD_URL}${TRAVIS_COMMIT:0:8}&t=${COMM_TAG}&a=${COMM_COUNT}" --upload-file ./RPCS3*.AppImage; - fi; -addons: - apt: - sources: - - ubuntu-toolchain-r-test - - sourceline: 'ppa:jonathonf/binutils' # We need to update binutils to a newer version to link against the ffmpeg libs on. - - sourceline: 'ppa:beineri/opt-qt-5.10.1-trusty' # <>: This needs to be updated manually whenever the QT Version changes. Add QT PPA since the installer is quite bad. - packages: - - binutils - - cmake - - ninja-build - - libasound2-dev - - libopenal-dev - - freeglut3-dev - #- libglew-dev - #- libvulkan1 - #- libvulkan-dev - - libc6-dev - # Clang 5.0 is now bundled in travis, so we no longer need the ppa version. - #- clang-4.0 - - libedit-dev - - g++-8 - - gcc-8 - - libstdc++-5-dev - - lib32stdc++6 - - zlib1g-dev - # From the beineri PPA - - qt510-meta-minimal # <>: This needs to be updated manually whenever the QT Version changes. - - libudev-dev - - libevdev-dev - - libpulse-dev - # Wayland support, Ubuntu 14.04's version is quite old, but it's better than nothing - - libwayland-dev - - libwayland-cursor0 - - libwayland-client0 - - libwayland-server0 +submodules: false diff --git a/.travis/build-linux.bash b/.travis/build-linux.bash new file mode 100644 index 0000000000..475a9ef436 --- /dev/null +++ b/.travis/build-linux.bash @@ -0,0 +1,35 @@ +#!/bin/env bash -ex +shopt -s nocasematch + +# Setup Qt variables +export QT_BASE_DIR=/opt/qt${QTVERMIN} +export PATH=$QT_BASE_DIR/bin:$PATH +export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib + +cd rpcs3 + +git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang + +# Download pre-compiled llvm libs +curl -sLO https://github.com/RPCS3/llvm/releases/download/continuous-linux-master/llvmlibs-linux.tar.gz +mkdir llvmlibs +tar -xzf ./llvmlibs-linux.tar.gz -C llvmlibs + +mkdir build ; cd build + +if [ $COMPILER = "gcc" ]; then + # These are set in the dockerfile + export CC=${GCC_BINARY} + export CXX=${GXX_BINARY} +else + export CC=${CLANG_BINARY} + export CXX=${CLANGXX_BINARY} +fi + +cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_DIR=../llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja + +ninja + +cd .. +# If it compiled succesfully let's deploy +if [ $? -eq 0 ] && [ -n "$UPLOAD_URL" ] && [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then /bin/bash -ex .travis/deploy-linux.bash ; fi diff --git a/.travis/build-mac.bash b/.travis/build-mac.bash new file mode 100644 index 0000000000..b13f3595d2 --- /dev/null +++ b/.travis/build-mac.bash @@ -0,0 +1,21 @@ +brew install ccache glew ninja qt +export CCACHE_SLOPPINESS=pch_defines,time_macros +export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/ +export PATH="/usr/local/opt/ccache/libexec:$PATH" + +# Setup vulkan and gfx-rs/portability +curl -sLO https://github.com/gfx-rs/portability/releases/download/latest/gfx-portability-macos-latest.zip +unzip -: gfx-portability-macos-latest.zip +curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.77.0.zip +unzip -: sdk-*.zip +mkdir vulkan-sdk +ln -s ${PWD}/Vulkan-Headers*/include vulkan-sdk/include +mkdir vulkan-sdk/lib +ln release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib +export VULKAN_SDK=${PWD}/vulkan-sdk + +git submodule update --quiet --init asmjit 3rdparty/ffmpeg 3rdparty/pugixml 3rdparty/GSL 3rdparty/libpng 3rdparty/cereal 3rdparty/hidapi 3rdparty/xxHash 3rdparty/yaml-cpp Vulkan/glslang + +mkdir build; cd build +cmake .. -DWITHOUT_LLVM=On -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja +ninja diff --git a/.travis/deploy-linux.bash b/.travis/deploy-linux.bash new file mode 100644 index 0000000000..657d45e536 --- /dev/null +++ b/.travis/deploy-linux.bash @@ -0,0 +1,31 @@ +#!/bin/env bash -ex +shopt -s nocasematch +cd build +if [ "$DEPLOY_APPIMAGE" = "true" ]; then + DESTDIR=appdir ninja install + curl -sLO "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" + chmod a+x linuxdeployqt*.AppImage + ./linuxdeployqt*.AppImage --appimage-extract + ./squashfs-root/AppRun ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs + ls ./appdir/usr/lib/ + rm -r ./appdir/usr/share/doc + export PATH=/rpcs3/build/squashfs-root/usr/bin/:${PATH} + + # Embed newer libstdc++ for distros that don't come with it (ubuntu 14.04) + mkdir -p appdir/usr/optional/ ; mkdir -p appdir/usr/optional/libstdc++/ + cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/ + rm ./appdir/AppRun + curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -o ./appdir/AppRun + chmod a+x ./appdir/AppRun + curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -o ./appdir/usr/optional/exec.so + + # Package it up and send it off + ./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir + ls + COMM_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))" + COMM_COUNT="$(git rev-list --count HEAD)" + curl "${UPLOAD_URL}${TRAVIS_COMMIT:0:8}&t=${COMM_TAG}&a=${COMM_COUNT}" --upload-file ./RPCS3*.AppImage +fi +if [ "$DEPLOY_PPA" = "true" ]; then + export DEBFULLNAME="RPCS3 Build Bot" +fi