3 on: [pull_request, push]
10 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11 cancel-in-progress: ${{ github.head_ref != '' }}
16 runs-on: ubuntu-latest
21 libt_version: ["2.0.10", "1.2.19"]
22 qbt_gui: ["GUI=ON", "GUI=OFF"]
26 boost_path: "${{ github.workspace }}/../boost"
27 harden_flags: "-D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS"
28 libtorrent_path: "${{ github.workspace }}/../libtorrent"
31 - name: Checkout repository
32 uses: actions/checkout@v4
34 - name: Install dependencies
38 build-essential cmake ninja-build \
39 libssl-dev libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev
42 uses: Chocobo1/setup-ccache-action@v1
44 store_cache: ${{ github.ref == 'refs/heads/master' }}
45 update_packager_index: false
51 BOOST_MAJOR_VERSION: "1"
52 BOOST_MINOR_VERSION: "76"
53 BOOST_PATCH_VERSION: "0"
55 boost_url="https://boostorg.jfrog.io/artifactory/main/release/${{ env.BOOST_MAJOR_VERSION }}.${{ env.BOOST_MINOR_VERSION }}.${{ env.BOOST_PATCH_VERSION }}/source/boost_${{ env.BOOST_MAJOR_VERSION }}_${{ env.BOOST_MINOR_VERSION }}_${{ env.BOOST_PATCH_VERSION }}.tar.gz"
56 boost_url2="https://sourceforge.net/projects/boost/files/boost/${{ env.BOOST_MAJOR_VERSION }}.${{ env.BOOST_MINOR_VERSION }}.${{ env.BOOST_PATCH_VERSION }}/boost_${{ env.BOOST_MAJOR_VERSION }}_${{ env.BOOST_MINOR_VERSION }}_${{ env.BOOST_PATCH_VERSION }}.tar.gz"
58 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url"
59 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
60 if [ "$_exitCode" -ne "0" ]; then
61 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2"
62 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
64 mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}"
67 uses: jurplel/install-qt-action@v4
69 version: ${{ matrix.qt_version }}
70 archives: icu qtbase qtdeclarative qtsvg qttools
73 - name: Install libtorrent
76 --branch v${{ matrix.libt_version }} \
78 --recurse-submodules \
79 https://github.com/arvidn/libtorrent.git \
80 ${{ env.libtorrent_path }}
81 cd ${{ env.libtorrent_path }}
82 CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }}" \
86 -DBUILD_SHARED_LIBS=OFF \
87 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
88 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
89 -DBOOST_ROOT="${{ env.boost_path }}" \
90 -Ddeprecated-functions=OFF
92 sudo cmake --install build
94 # to avoid scanning 3rdparty codebases, initialize it just before building qbt
95 - name: Initialize CodeQL
96 uses: github/codeql-action/init@v3
97 if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
99 config-file: ./.github/workflows/helper/codeql/cpp.yaml
102 - name: Build qBittorrent
104 CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }} -DQT_FORCE_ASSERTS -Werror" \
105 LDFLAGS="$LDFLAGS -gz" \
109 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
110 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
111 -DBOOST_ROOT="${{ env.boost_path }}" \
112 -DCMAKE_INSTALL_PREFIX="/usr" \
114 -DVERBOSE_CONFIGURE=ON \
115 -D${{ matrix.qbt_gui }}
116 cmake --build build --target qbt_update_translations
118 cmake --build build --target check
119 DESTDIR="qbittorrent" cmake --install build
121 - name: Run CodeQL analysis
122 uses: github/codeql-action/analyze@v3
123 if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
125 category: ${{ github.base_ref || github.ref_name }}
127 - name: Prepare build artifacts
131 cp build/compile_commands.json upload/cmake
132 mkdir upload/cmake/libtorrent
133 cp ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
135 - name: Install AppImage
137 sudo apt install libfuse2
141 -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-static-x86_64.AppImage \
142 -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-static-x86_64.AppImage \
143 -O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage
145 linuxdeploy-static-x86_64.AppImage \
146 linuxdeploy-plugin-qt-static-x86_64.AppImage \
147 linuxdeploy-plugin-appimage-x86_64.AppImage
149 - name: Prepare files for AppImage
150 if: matrix.qbt_gui == 'GUI=OFF'
152 mkdir -p qbittorrent/usr/share/applications
153 cp .github/workflows/helper/appimage/org.qbittorrent.qBittorrent.desktop qbittorrent/usr/share/applications/org.qbittorrent.qBittorrent.desktop
154 mkdir -p qbittorrent/usr/share/icons/hicolor/scalable/apps
155 cp dist/unix/menuicons/scalable/apps/qbittorrent.svg qbittorrent/usr/share/icons/hicolor/scalable/apps/qbittorrent.svg
157 - name: Package AppImage
159 ./linuxdeploy-static-x86_64.AppImage --appdir qbittorrent --plugin qt
160 rm qbittorrent/apprun-hooks/*
161 cp .github/workflows/helper/appimage/export_vars.sh qbittorrent/apprun-hooks/export_vars.sh
163 OUTPUT=upload/qbittorrent-CI_Ubuntu_x86_64.AppImage \
164 ./linuxdeploy-static-x86_64.AppImage --appdir qbittorrent --output appimage
166 - name: Upload build artifacts
167 uses: actions/upload-artifact@v4
169 name: qBittorrent-CI_Ubuntu-x64_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}_Qt-${{ matrix.qt_version }}