140 lines
9.2 KiB
YAML
140 lines
9.2 KiB
YAML
# Reference: https://andrewdolby.com/articles/2016/continuous-deployment-for-qt-applications/
|
|
notifications:
|
|
email: false
|
|
|
|
os: osx
|
|
|
|
language: cpp
|
|
|
|
matrix:
|
|
include:
|
|
- if: tag IS present
|
|
- os: linux
|
|
dist: xenial
|
|
sudo: required
|
|
compiler: gcc
|
|
addons:
|
|
apt:
|
|
sources:
|
|
- ubuntu-toolchain-r-test
|
|
- os: osx
|
|
compiler: clang
|
|
osx_image: xcode9.3
|
|
|
|
install:
|
|
- if [[ $TRAVIS_BRANCH != "ci" && $TRAVIS_TAG == "" ]]; then echo "Not branch ci and no tag, cancel build"; fi
|
|
- if [[ $TRAVIS_BRANCH != "ci" && $TRAVIS_TAG == "" ]]; then travis_terminate 0; fi
|
|
|
|
# (Linux) Prepare build environment
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository --yes ppa:beineri/opt-qt591-xenial; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt install cmake; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libgl-dev; fi
|
|
|
|
# (Linux) Install CGAL
|
|
# (Linux) First install a maybe old version CGAL to resolve dependencies
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libcgal-dev; fi
|
|
|
|
# (Linux) Build CGAL from source
|
|
- wget https://github.com/CGAL/cgal/releases/download/v5.1/CGAL-5.1.zip
|
|
- unzip CGAL-5.1.zip
|
|
- cd CGAL-5.1
|
|
- mkdir build
|
|
- cd build
|
|
- cmake ../
|
|
- make
|
|
- sudo make install
|
|
- cd "$TRAVIS_BUILD_DIR"
|
|
|
|
# Build Instant-Meshes from source
|
|
- cd thirdparty/instant-meshes
|
|
- mkdir build
|
|
- cd build
|
|
- cmake ../
|
|
- make -j 4
|
|
- cd "$TRAVIS_BUILD_DIR"
|
|
|
|
# (Mac) Install Qt5
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then HOMEBREW_VERBOSE_USING_DOTS=1 brew reinstall --verbose qt; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/qt/bin:$(brew --prefix)/bin:$PATH"; fi
|
|
|
|
# (Linux) Install Qt5
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qt59base qt59tools --force-yes; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source /opt/qt59/bin/qt59-env.sh; fi
|
|
|
|
script:
|
|
|
|
# Build Dust3D
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then qmake -config release || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then qmake -config release || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make CXX="g++ -fext-numeric-literals" || travis_terminate 1; fi
|
|
|
|
# Prepare tag name
|
|
- export TAG="$TRAVIS_TAG"
|
|
- if [[ "$TAG" == "" ]]; then export TAG=unstable; fi
|
|
- export BRANCH="$TRAVIS_BRANCH"
|
|
- if [[ "$BRANCH" == "$TAG" ]]; then export BRANCH=master; fi
|
|
|
|
# (Mac) Test
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-addax.ds3 -o addax.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-addax.ds3 -o addax.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-addax.ds3 -o addax.fbx || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bicycle.ds3 -o bicycle.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bicycle.ds3 -o bicycle.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bicycle.ds3 -o bicycle.fbx || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bob.ds3 -o bob.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bob.ds3 -o bob.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-bob.ds3 -o bob.fbx || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-dog.ds3 -o dog.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-dog.ds3 -o dog.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-dog.ds3 -o dog.fbx || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-meerkat.ds3 -o meerkat.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-meerkat.ds3 -o meerkat.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-meerkat.ds3 -o meerkat.fbx || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-mosquito.ds3 -o mosquito.obj || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-mosquito.ds3 -o mosquito.glb || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then dust3d.app/Contents/MacOS/dust3d :/resources/model-mosquito.ds3 -o mosquito.fbx || travis_terminate 1; fi
|
|
|
|
# (Mac) Prepare dmg
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mv dust3d.app dust3d-$TAG.app || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then macdeployqt dust3d-$TAG.app -dmg || travis_terminate 1; fi
|
|
|
|
# (Linux) Prepare AppImage
|
|
# References:
|
|
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
|
|
# https://packages.ubuntu.com/search?suite=trusty&arch=amd64&mode=exactfilename&searchon=contents&keywords=libstdc%2B%2B.so.6
|
|
# https://github.com/darealshinji/AppImageKit-checkrt/issues/1
|
|
# https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64
|
|
# https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so
|
|
# https://github.com/probonopd/audacity/blob/AppImage/.travis.yml
|
|
# https://discourse.appimage.org/t/im-a-big-fan-of-this-but-graphics-driver-libstdc-conflict/171
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/share/metainfo || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/share/applications || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/bin || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p appdir/usr/optional/libstdc++ || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ldd --version; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ls /usr/lib/x86_64-linux-gnu/ | grep libstdc; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 appdir/usr/optional/libstdc++/libstdc++.so.6 || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/exec-x86_64.so appdir/usr/optional/exec.so || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/dust3d.png appdir/dust3d.png || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/dust3d.appdata.xml appdir/usr/share/metainfo/dust3d.appdata.xml || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./dust3d appdir/usr/bin/dust3d || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/dust3d.desktop appdir/usr/share/applications/dust3d.desktop || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x ./ci/linuxdeployqt.AppImage || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then unset QTDIR; unset QT_PLUGIN_PATH ; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ci/linuxdeployqt.AppImage appdir/usr/share/applications/dust3d.desktop -bundle-non-qt-libs -verbose=2 || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then rm appdir/AppRun || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ./ci/AppRun-patched-x86_64 appdir/AppRun || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod a+x appdir/AppRun || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ci/linuxdeployqt.AppImage --appimage-extract || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$(readlink -f ./squashfs-root/usr/bin):$PATH || travis_terminate 1; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then rm -v "./appdir/usr/lib/libxcb-dri2.so"* "./appdir/usr/lib/libxcb-dri3.so"*; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./squashfs-root/usr/bin/appimagetool -g ./appdir/ dust3d-$TAG.AppImage || travis_terminate 1; fi
|
|
|
|
# Distribute
|
|
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then echo "No distribution on pull request"; fi
|
|
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then travis_terminate 0; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then sh ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$BRANCH owner=huxingyi repo=dust3d tag=$TAG filename=dust3d-$TAG.dmg; fi
|
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then bash ci/upload-github-release-asset.sh github_api_token=${my_auth_token} branch=$BRANCH owner=huxingyi repo=dust3d tag=$TAG filename=dust3d-$TAG.AppImage; fi
|