Auto-deploying your Qt Application

From Qt Wiki
Revision as of 13:05, 28 July 2020 by Ratijas (talk | contribs) (Fix wording)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Deploy on Travis for Linux

Travis help you to deploy your application automatically. when you push a commit on github, it runs a virtual machine and execute a script defined by your .travis.yml file. Here is a travis example which compile a Qt project, make an AppImage and send it to transfer.sh. You can check a code example here [1]


language: cpp
dist: trusty
compiler: g++
sudo: required

before_install:
  - sudo add-apt-repository ppa:beineri/opt-qt58-trusty -y
  - sudo apt-get update

install:
  - sudo apt-get install qt58base qt58svg qt58charts-no-lgpl qt58xmlpatterns
  - source /opt/qt58/bin/qt58-env.sh


script:
  - /opt/qt58/bin/qmake PREFIX=/usr
  - make
  - # Generate AppImage
  - sudo apt-get -y install checkinstall
  - sudo checkinstall --pkgname=app --pkgversion="1" --pkgrelease="1" --backup=no --fstrans=no --default --deldoc
  - mkdir -p appdir/usr/bin ; cd appdir
  - dpkg -x ../app_1-1_amd64.deb . ; find .
  - mv ./usr/local/bin/* ./usr/bin/ 
  - cp ./usr/share/icons/hicolor/48x48/apps/YOUR_APP_ICON.png .
  - cp ./usr/share/applications/YOUR_APP.desktop .
  - cd ..
  - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/3/linuxdeployqt-3-x86_64.AppImage"
  - chmod a+x linuxdeployqt*.AppImage
  - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
  - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -bundle-non-qt-libs
  - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -appimage
  - curl --upload-file ./YOUR_APPLICATION*.AppImage https://transfer.sh/YOUR_APPLICATION-git.$(git rev-parse --short HEAD)-x86_64.AppImage


Deploy on AppVeyor for Windows

appveyor do the same thing than travis, but using Windows virtual machines. The following example compiles your Qt application on Windows and packages it via InnoSetup script. You can check a code example here[2].

branches:
  only:
    - master

install:
  - set QTDIR=C:\Qt\5.8\mingw53_32
  - choco install -y InnoSetup
  - set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;"C:\Program Files (x86)\Inno Setup 5"
build_script:
  - qmake FastQt.pro
  - mingw32-make
after_build:
  - windeployqt release/fastqt.exe
  - cmd: cp LICENSE release/LICENSE.txt
  - iscc innosetup.iss
  - rm release/*.o
  - rm release/*.cpp

artifacts:
  - path: Output\YOUR-APP-*.exe
  - path: release
    type: zip