name: Coverity Scan on: schedule: - cron: '0 0 1 * *' # Monthly (1st day of month at midnight) workflow_dispatch: # Mainly for testing. Don't forget the Coverity usage limits. permissions: {} jobs: coverity_scan: name: Scan runs-on: ubuntu-latest strategy: matrix: libtorrent: - version: "2.0.11" boost_major_version: "1" boost_minor_version: "90" boost_patch_version: "0" qbt_gui: ["GUI=ON"] qt_version: ["6.10.1"] env: boost_path: "${{ github.workspace }}/../boost" coverity_path: "${{ github.workspace }}/../coverity" 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 libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev - 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 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 }} cmake \ -B build \ -G "Ninja" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_CXX_STANDARD=20 \ -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" \ -Ddeprecated-functions=OFF cmake --build build sudo cmake --install build - name: Download Coverity Build Tool run: | curl \ -L \ -d "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=qbittorrent%2FqBittorrent" \ -o "${{ runner.temp }}/coverity_tool.tgz" \ "https://scan.coverity.com/download/linux64" mkdir -p ${{ env.coverity_path }} tar \ -xf "${{ runner.temp }}/coverity_tool.tgz" \ -C "${{ env.coverity_path }}" \ --strip-components 1 - name: Build qBittorrent run: | cmake \ -B build \ -G "Ninja" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" \ -DVERBOSE_CONFIGURE=ON \ -D${{ matrix.qbt_gui }} PATH="${{ env.coverity_path }}/bin:$PATH" \ cov-build \ --dir cov-int \ cmake --build build - name: Submit the result to Coverity Scan run: | tar -caf qbittorrent.xz cov-int curl \ --form token="${{ secrets.COVERITY_SCAN_TOKEN }}" \ --form email=sledgehammer999@qbittorrent.org \ --form file=@qbittorrent.xz \ --form version="$(git rev-parse --short HEAD)" \ --form description="master" \ https://scan.coverity.com/builds?project=qbittorrent%2FqBittorrent