name: CI - Ubuntu on: [pull_request, push] permissions: {} concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: ${{ github.head_ref != '' }} jobs: ci: name: Build runs-on: ubuntu-latest permissions: actions: write security-events: write strategy: fail-fast: false matrix: libtorrent: - version: "2.0.11" boost_major_version: "1" boost_minor_version: "77" boost_patch_version: "0" - version: "1.2.20" boost_major_version: "1" boost_minor_version: "77" boost_patch_version: "0" qbt_gui: ["GUI=ON", "GUI=OFF"] qt_version: ["6.6.3"] env: boost_path: "${{ github.workspace }}/../boost" harden_flags: "-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS" libtorrent_path: "${{ github.workspace }}/../libtorrent" steps: - name: Checkout repository uses: actions/checkout@v6 with: persist-credentials: false - name: Install dependencies run: | sudo apt update sudo apt install \ build-essential cmake ninja-build \ libssl-dev zlib1g-dev - name: Setup ccache uses: Chocobo1/setup-ccache-action@v1 with: store_cache: ${{ (github.repository != 'qbittorrent/qBittorrent') || (github.ref == 'refs/heads/master') }} update_packager_index: false ccache_options: | max_size=1G - name: Install boost run: | boost_url="https://archives.boost.io/release/${{ matrix.libtorrent.boost_major_version }}.${{ matrix.libtorrent.boost_minor_version }}.${{ matrix.libtorrent.boost_patch_version }}/source/boost_${{ matrix.libtorrent.boost_major_version }}_${{ matrix.libtorrent.boost_minor_version }}_${{ matrix.libtorrent.boost_patch_version }}.tar.gz" boost_url2="https://sourceforge.net/projects/boost/files/boost/${{ matrix.libtorrent.boost_major_version }}.${{ matrix.libtorrent.boost_minor_version }}.${{ matrix.libtorrent.boost_patch_version }}/boost_${{ matrix.libtorrent.boost_major_version }}_${{ matrix.libtorrent.boost_minor_version }}_${{ matrix.libtorrent.boost_patch_version }}.tar.gz" set +e curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url" tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?" if [ "$_exitCode" -ne "0" ]; then curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2" tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?" fi mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}" cd "${{ env.boost_path }}" ./bootstrap.sh ./b2 stage --stagedir=./ --with-headers - name: Install Qt uses: jurplel/install-qt-action@v4 with: version: ${{ matrix.qt_version }} archives: icu qtbase qtdeclarative qtsvg qttools modules: qtimageformats cache: true - name: Install libtorrent run: | git clone \ --branch v${{ matrix.libtorrent.version }} \ --depth 1 \ --recurse-submodules \ https://github.com/arvidn/libtorrent.git \ ${{ env.libtorrent_path }} cd ${{ env.libtorrent_path }} CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }}" \ cmake \ -B build \ -G "Ninja" \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" \ -Ddeprecated-functions=OFF cmake --build build sudo cmake --install build # to avoid scanning 3rdparty codebases, initialize it just before building qbt - name: Initialize CodeQL uses: github/codeql-action/init@v4 if: startsWith(matrix.libtorrent.version, 2) && (matrix.qbt_gui == 'GUI=ON') with: config-file: ./.github/workflows/helper/codeql/cpp.yaml languages: cpp - name: Build qBittorrent run: | CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }} -DQT_FORCE_ASSERTS -Werror" \ LDFLAGS="$LDFLAGS -gz" \ cmake \ -B build \ -G "Ninja" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" \ -DCMAKE_INSTALL_PREFIX="/usr" \ -DTESTING=ON \ -DVERBOSE_CONFIGURE=ON \ -D${{ matrix.qbt_gui }} cmake --build build --target qbt_update_translations cmake --build build cmake --build build --target check if [ "${{ matrix.qbt_gui }}" = "GUI=ON" ]; then QT_QPA_PLATFORM=offscreen build/qbittorrent -v else build/qbittorrent-nox -v fi DESTDIR="qbittorrent" cmake --install build - name: Run CodeQL analysis uses: github/codeql-action/analyze@v4 if: startsWith(matrix.libtorrent.version, 2) && (matrix.qbt_gui == 'GUI=ON') with: category: ${{ github.base_ref || github.ref_name }} - name: Prepare build artifacts run: | mkdir upload mkdir upload/cmake cp build/compile_commands.json upload/cmake mkdir upload/cmake/libtorrent cp ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent - name: Install AppImage run: | curl \ -L \ -Z \ -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \ -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \ -O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage chmod +x \ linuxdeploy-x86_64.AppImage \ linuxdeploy-plugin-qt-x86_64.AppImage \ linuxdeploy-plugin-appimage-x86_64.AppImage - name: Prepare files for AppImage if: matrix.qbt_gui == 'GUI=OFF' run: | mkdir -p qbittorrent/usr/share/applications cp .github/workflows/helper/appimage/org.qbittorrent.qBittorrent.desktop qbittorrent/usr/share/applications/org.qbittorrent.qBittorrent.desktop mkdir -p qbittorrent/usr/share/icons/hicolor/scalable/apps cp dist/unix/menuicons/scalable/apps/qbittorrent.svg qbittorrent/usr/share/icons/hicolor/scalable/apps/qbittorrent.svg - name: Package AppImage run: | rm -f "${{ runner.workspace }}/Qt/${{ matrix.qt_version }}/gcc_64/plugins/sqldrivers/libqsqlmimer.so" ./linuxdeploy-x86_64.AppImage --appdir qbittorrent --plugin qt mkdir -p qbittorrent/apprun-hooks rm -f qbittorrent/apprun-hooks/* cp .github/workflows/helper/appimage/export_vars.sh qbittorrent/apprun-hooks/export_vars.sh NO_APPSTREAM=1 \ OUTPUT=upload/qbittorrent-CI_Ubuntu_x86_64.AppImage \ ./linuxdeploy-x86_64.AppImage --appdir qbittorrent --output appimage - name: Upload build artifacts uses: actions/upload-artifact@v6 with: name: qBittorrent-CI_Ubuntu-x64_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libtorrent.version }}_Qt-${{ matrix.qt_version }} path: upload