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.9", "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: ${{ startsWith(github.ref, 'refs/heads/') }}
45 update_packager_index: false
51 boost_url="https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz"
52 boost_url2="https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.gz"
54 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url"
55 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
56 if [ "$_exitCode" -ne "0" ]; then
57 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2"
58 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
60 mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}"
63 uses: jurplel/install-qt-action@v3
65 version: ${{ matrix.qt_version }}
66 archives: icu qtbase qtdeclarative qtsvg qttools
69 - name: Install libtorrent
72 --branch v${{ matrix.libt_version }} \
74 --recurse-submodules \
75 https://github.com/arvidn/libtorrent.git \
76 ${{ env.libtorrent_path }}
77 cd ${{ env.libtorrent_path }}
78 CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }}" \
82 -DBUILD_SHARED_LIBS=OFF \
83 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
84 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
85 -DBOOST_ROOT="${{ env.boost_path }}" \
86 -Ddeprecated-functions=OFF
88 sudo cmake --install build
90 # to avoid scanning 3rdparty codebases, initialize it just before building qbt
91 - name: Initialize CodeQL
92 uses: github/codeql-action/init@v3
93 if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
95 config-file: ./.github/workflows/helper/codeql/cpp.yaml
98 - name: Build qBittorrent
100 CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }} -Werror" \
101 LDFLAGS="$LDFLAGS -gz" \
105 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
106 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
107 -DBOOST_ROOT="${{ env.boost_path }}" \
108 -DCMAKE_INSTALL_PREFIX="/usr" \
110 -DVERBOSE_CONFIGURE=ON \
111 -D${{ matrix.qbt_gui }}
112 cmake --build build --target qbt_update_translations
114 cmake --build build --target check
115 DESTDIR="qbittorrent" cmake --install build
117 - name: Run CodeQL analysis
118 uses: github/codeql-action/analyze@v3
119 if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
121 category: ${{ github.base_ref || github.ref_name }}
123 - name: Prepare build artifacts
127 cp build/compile_commands.json upload/cmake
128 mkdir upload/cmake/libtorrent
129 cp ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
131 - name: Install AppImage
133 sudo apt install libfuse2
137 -O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
138 -O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
139 -O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage
141 linuxdeploy-x86_64.AppImage \
142 linuxdeploy-plugin-qt-x86_64.AppImage \
143 linuxdeploy-plugin-appimage-x86_64.AppImage
145 - name: Prepare files for AppImage
146 if: matrix.qbt_gui == 'GUI=OFF'
148 mkdir -p qbittorrent/usr/share/applications
149 cp .github/workflows/helper/appimage/org.qbittorrent.qBittorrent.desktop qbittorrent/usr/share/applications/org.qbittorrent.qBittorrent.desktop
150 mkdir -p qbittorrent/usr/share/icons/hicolor/scalable/apps
151 cp dist/unix/menuicons/scalable/apps/qbittorrent.svg qbittorrent/usr/share/icons/hicolor/scalable/apps/qbittorrent.svg
153 - name: Package AppImage
155 ./linuxdeploy-x86_64.AppImage --appdir qbittorrent --plugin qt
156 rm qbittorrent/apprun-hooks/*
157 cp .github/workflows/helper/appimage/export_vars.sh qbittorrent/apprun-hooks/export_vars.sh
159 OUTPUT=upload/qbittorrent-CI_Ubuntu_x86_64.AppImage \
160 ./linuxdeploy-x86_64.AppImage --appdir qbittorrent --output appimage
162 - name: Upload build artifacts
163 uses: actions/upload-artifact@v4
165 name: qBittorrent-CI_Ubuntu-x64_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}_Qt-${{ matrix.qt_version }}