Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Automatic installation for Travis CI (or any other CI)



  • What is recommended way to install Qt in Windows based CI? Will it be working with future versions?

    Auto-depoying guide suggests AppVeyor CI but it doesn't include install of Qt.

    Chocolatey Qt packages seems to be outdated https://chocolatey.org/search?q=Qt

    Wireshark has dropped windows from its tests https://github.com/wireshark/wireshark/commit/44407c16fcf085b811caf5bc33c7667b2b354fc6#diff-354f30a63fb0907d4ad57269548329e3

    And other projects are including Qt Account credentials into public git repository https://github.com/semlanik/qtprotobuf/

    There is also Another Qt installer(aqt) https://github.com/miurahr/aqtinstall . It looks as best solution so far. Would you recommend something else?



  • Travis CI - Ubuntu:

    Stephan Binner is your best friend. Add the relevant ppa to your sources and you can use apt-get to install Qt.
    Example:

    matrix:
      fast_finish: true
      include:
      - name: Ubuntu Build
        os: linux
        dist: bionic
        group: stable
        services:
            - xvfb
        compiler: gcc
        addons:
          apt:
            sources:
            - ubuntu-toolchain-r-test
            - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
            update: true
            packages:
            - qt514base
            - qt514tools
            - gcc-9
            - g++-9
            - libc6-i386
            - libgl-dev
            - libgl1-mesa-dev
            - mesa-common-dev
        script:
            - /opt/qt514/bin/qt514-env.sh
            - CXX="g++-9"
            - CC="gcc-9"
            - mkdir ./build
            - cd ./build
            - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ../
            - cmake --build .
    

    Travis - MacOS

    Homebrew
    Example:

      - name: MacOS
        os: osx
        osx_image: xcode11.3
        compiler: clang
        addons:
          homebrew:
            packages:
            - qt
            update: true
        script:
            - mkdir ./build
            - cd ./build
            - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ../
            - cmake --build .
    

    Appveyor - Windows

    Qt comese pre-installed
    Example:

    before_build:
    - set SOURCEDIR=%cd%
    - call "C:\Qt\5.13\msvc2017\bin\qtenv2.bat"
    - cd /D %SOURCEDIR%
    - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"
    build_script:
    - mkdir .\build 
    - cd .\build
    - cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ../
    - cmake --build .
    

    You can use these 2 scripts I am using as full examples: Appveyor/Travis CI



  • @VRonin I ended up with following .travis.yml

    os: windows
    language: C++
    env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
    before_install:
    #  - choco install -y visualstudio2017buildtools
    #  - choco install -y visualstudio2017-workload-vctools
      - choco install  python --version 3.8.0
      - python -m pip install --upgrade pip
      - python -m pip install aqtinstall
      - python -m aqt install --outputdir /c/Qt 5.14.2 windows desktop win32_msvc2017
    script:
      - mkdir build
      - cd build
      - cmake -DCMAKE_PREFIX_PATH="C:\Qt\5.14.2\msvc2017" -DCMAKE_BUILD_TYPE=RELEASE -DDEPLOY_QT_LIBRARIES=ON ..
      - cmake --build .
      - cp *.qm ./Debug
      - 7z a -tzip editor.zip -r *
    deploy:
      provider: releases
      skip_cleanup: true
      api_key: $GITHUB_TOKEN
      file: editor.zip
      on:
        tags: false
        draft: true
    
    

Log in to reply