WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / .github / workflows / coverity-scan.yaml
blobaaaefb5989a46e7d19fe37579e23ac27eb7f2321
1 name: Coverity Scan
3 on:
4   schedule:
5     - cron: '0 0 1 * *' # Monthly (1st day of month at midnight)
6   workflow_dispatch: # Mainly for testing. Don't forget the Coverity usage limits.
8 permissions: {}
10 jobs:
11   coverity_scan:
12     name: Scan
13     runs-on: ubuntu-latest
15     strategy:
16       matrix:
17         libt_version: ["2.0.10"]
18         qbt_gui: ["GUI=ON"]
19         qt_version: ["6.5.2"]
21     env:
22       boost_path: "${{ github.workspace }}/../boost"
23       coverity_path: "${{ github.workspace }}/../coverity"
24       libtorrent_path: "${{ github.workspace }}/../libtorrent"
26     steps:
27       - name: Checkout repository
28         uses: actions/checkout@v4
30       - name: Install dependencies
31         run: |
32           sudo apt update
33           sudo apt install \
34             build-essential cmake ninja-build \
35             libssl-dev libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev
37       - name: Install boost
38         env:
39           BOOST_MAJOR_VERSION: "1"
40           BOOST_MINOR_VERSION: "86"
41           BOOST_PATCH_VERSION: "0"
42         run: |
43           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"
44           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"
45           set +e
46           curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url"
47           tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
48           if [ "$_exitCode" -ne "0" ]; then
49             curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2"
50             tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."; _exitCode="$?"
51           fi
52           mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}"
54       - name: Install Qt
55         uses: jurplel/install-qt-action@v4
56         with:
57           version: ${{ matrix.qt_version }}
58           archives: icu qtbase qtdeclarative qtsvg qttools
59           cache: true
61       - name: Install libtorrent
62         run: |
63           git clone \
64             --branch v${{ matrix.libt_version }} \
65             --depth 1 \
66             --recurse-submodules \
67             https://github.com/arvidn/libtorrent.git \
68             ${{ env.libtorrent_path }}
69           cd ${{ env.libtorrent_path }}
70           cmake \
71             -B build \
72             -G "Ninja" \
73             -DCMAKE_BUILD_TYPE=RelWithDebInfo \
74             -DBOOST_ROOT="${{ env.boost_path }}" \
75             -Ddeprecated-functions=OFF
76           cmake --build build
77           sudo cmake --install build
79       - name: Download Coverity Build Tool
80         run: |
81           curl \
82             -L \
83             -d "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=qbittorrent%2FqBittorrent" \
84             -o "${{ runner.temp }}/coverity_tool.tgz" \
85             "https://scan.coverity.com/download/linux64"
86           mkdir -p ${{ env.coverity_path }}
87           tar \
88             -xf "${{ runner.temp }}/coverity_tool.tgz" \
89             -C "${{ env.coverity_path }}" \
90             --strip-components 1
92       - name: Build qBittorrent
93         run: |
94           cmake \
95             -B build \
96             -G "Ninja" \
97             -DCMAKE_BUILD_TYPE=RelWithDebInfo \
98             -DBOOST_ROOT="${{ env.boost_path }}" \
99             -DVERBOSE_CONFIGURE=ON \
100             -D${{ matrix.qbt_gui }}
101           PATH="${{ env.coverity_path }}/bin:$PATH" \
102           cov-build \
103             --dir cov-int \
104             cmake --build build
106       - name: Submit the result to Coverity Scan
107         run: |
108           tar -caf qbittorrent.xz cov-int
109           curl \
110             --form token="${{ secrets.COVERITY_SCAN_TOKEN }}" \
111             --form email=sledgehammer999@qbittorrent.org \
112             --form file=@qbittorrent.xz \
113             --form version="$(git rev-parse --short HEAD)" \
114             --form description="master" \
115             https://scan.coverity.com/builds?project=qbittorrent%2FqBittorrent