2021-08-19 06:21:34 +03:00
|
|
|
name: CI - Ubuntu
|
2022-02-25 08:34:28 +03:00
|
|
|
|
2021-08-19 06:21:34 +03:00
|
|
|
on: [pull_request, push]
|
|
|
|
|
2023-02-16 11:16:54 +03:00
|
|
|
permissions:
|
|
|
|
actions: write
|
2023-03-11 22:11:02 +03:00
|
|
|
security-events: write
|
2023-02-16 11:16:54 +03:00
|
|
|
|
2022-02-25 08:34:28 +03:00
|
|
|
concurrency:
|
2022-03-02 08:26:13 +03:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
2022-02-25 08:34:28 +03:00
|
|
|
cancel-in-progress: ${{ github.head_ref != '' }}
|
|
|
|
|
2021-08-19 06:21:34 +03:00
|
|
|
jobs:
|
|
|
|
ci:
|
|
|
|
name: Build
|
2022-08-10 16:47:33 +03:00
|
|
|
runs-on: ubuntu-latest
|
2021-08-19 06:21:34 +03:00
|
|
|
|
|
|
|
strategy:
|
2021-10-23 19:57:50 +03:00
|
|
|
fail-fast: false
|
2021-08-19 06:21:34 +03:00
|
|
|
matrix:
|
2024-02-25 14:30:20 +03:00
|
|
|
libt_version: ["2.0.10", "1.2.19"]
|
2021-08-19 06:21:34 +03:00
|
|
|
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
2023-07-27 17:45:26 +03:00
|
|
|
qt_version: ["6.5.2"]
|
2021-08-19 06:21:34 +03:00
|
|
|
|
2023-08-08 18:31:56 +03:00
|
|
|
env:
|
|
|
|
boost_path: "${{ github.workspace }}/../boost"
|
2023-09-18 19:25:02 +03:00
|
|
|
harden_flags: "-D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS"
|
2023-11-30 11:48:25 +03:00
|
|
|
libtorrent_path: "${{ github.workspace }}/../libtorrent"
|
2023-08-08 18:31:56 +03:00
|
|
|
|
2021-08-19 06:21:34 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-09-05 14:42:07 +03:00
|
|
|
uses: actions/checkout@v4
|
2021-08-19 06:21:34 +03:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install \
|
2023-08-08 18:31:56 +03:00
|
|
|
build-essential cmake ninja-build \
|
|
|
|
libssl-dev libxkbcommon-x11-dev libxcb-cursor-dev zlib1g-dev
|
2021-08-19 06:21:34 +03:00
|
|
|
|
2021-09-23 07:38:52 +03:00
|
|
|
- name: Setup ccache
|
|
|
|
uses: Chocobo1/setup-ccache-action@v1
|
|
|
|
with:
|
2024-04-01 14:36:45 +03:00
|
|
|
store_cache: ${{ github.ref == 'refs/heads/master' }}
|
2021-09-23 07:38:52 +03:00
|
|
|
update_packager_index: false
|
2021-10-03 11:09:09 +03:00
|
|
|
ccache_options: |
|
|
|
|
max_size=2G
|
2021-08-19 06:21:34 +03:00
|
|
|
|
2023-08-08 18:31:56 +03:00
|
|
|
- name: Install boost
|
2024-02-13 22:36:47 +03:00
|
|
|
env:
|
|
|
|
BOOST_MAJOR_VERSION: "1"
|
|
|
|
BOOST_MINOR_VERSION: "76"
|
|
|
|
BOOST_PATCH_VERSION: "0"
|
2023-08-08 18:31:56 +03:00
|
|
|
run: |
|
2024-02-13 22:36:47 +03:00
|
|
|
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"
|
|
|
|
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"
|
2024-01-02 10:54:49 +03:00
|
|
|
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
|
2023-08-08 18:31:56 +03:00
|
|
|
mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}"
|
|
|
|
|
2021-10-23 19:57:50 +03:00
|
|
|
- name: Install Qt
|
2024-06-04 09:15:44 +03:00
|
|
|
uses: jurplel/install-qt-action@v4
|
2021-10-23 19:57:50 +03:00
|
|
|
with:
|
|
|
|
version: ${{ matrix.qt_version }}
|
2023-07-27 17:45:26 +03:00
|
|
|
archives: icu qtbase qtdeclarative qtsvg qttools
|
2023-11-17 17:32:33 +03:00
|
|
|
cache: true
|
2021-10-23 19:57:50 +03:00
|
|
|
|
2021-08-19 06:21:34 +03:00
|
|
|
- name: Install libtorrent
|
|
|
|
run: |
|
2021-11-17 10:53:27 +03:00
|
|
|
git clone \
|
|
|
|
--branch v${{ matrix.libt_version }} \
|
|
|
|
--depth 1 \
|
|
|
|
--recurse-submodules \
|
2023-11-30 11:48:25 +03:00
|
|
|
https://github.com/arvidn/libtorrent.git \
|
|
|
|
${{ env.libtorrent_path }}
|
|
|
|
cd ${{ env.libtorrent_path }}
|
2023-09-18 19:25:02 +03:00
|
|
|
CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }}" \
|
2021-08-19 06:21:34 +03:00
|
|
|
cmake \
|
|
|
|
-B build \
|
|
|
|
-G "Ninja" \
|
2023-05-25 08:08:53 +03:00
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
2021-08-19 06:21:34 +03:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2023-08-08 18:31:56 +03:00
|
|
|
-DBOOST_ROOT="${{ env.boost_path }}" \
|
2021-11-06 06:11:47 +03:00
|
|
|
-Ddeprecated-functions=OFF
|
2021-08-19 06:21:34 +03:00
|
|
|
cmake --build build
|
|
|
|
sudo cmake --install build
|
|
|
|
|
2023-03-11 22:11:02 +03:00
|
|
|
# to avoid scanning 3rdparty codebases, initialize it just before building qbt
|
|
|
|
- name: Initialize CodeQL
|
2024-01-02 11:23:09 +03:00
|
|
|
uses: github/codeql-action/init@v3
|
2023-08-08 18:46:30 +03:00
|
|
|
if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
|
2023-03-11 22:11:02 +03:00
|
|
|
with:
|
|
|
|
config-file: ./.github/workflows/helper/codeql/cpp.yaml
|
|
|
|
languages: cpp
|
|
|
|
|
2023-08-08 18:46:30 +03:00
|
|
|
- name: Build qBittorrent
|
2021-08-19 06:21:34 +03:00
|
|
|
run: |
|
2024-10-06 11:13:14 +03:00
|
|
|
CXXFLAGS="$CXXFLAGS ${{ env.harden_flags }} -DQT_FORCE_ASSERTS -Werror" \
|
2023-02-16 11:31:48 +03:00
|
|
|
LDFLAGS="$LDFLAGS -gz" \
|
2021-08-19 06:21:34 +03:00
|
|
|
cmake \
|
|
|
|
-B build \
|
|
|
|
-G "Ninja" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2023-08-08 18:31:56 +03:00
|
|
|
-DBOOST_ROOT="${{ env.boost_path }}" \
|
2021-11-06 06:11:47 +03:00
|
|
|
-DCMAKE_INSTALL_PREFIX="/usr" \
|
2022-07-10 08:20:27 +03:00
|
|
|
-DTESTING=ON \
|
2021-08-19 06:21:34 +03:00
|
|
|
-DVERBOSE_CONFIGURE=ON \
|
2021-11-06 06:11:47 +03:00
|
|
|
-D${{ matrix.qbt_gui }}
|
2022-05-29 01:08:51 +03:00
|
|
|
cmake --build build --target qbt_update_translations
|
2021-08-19 06:21:34 +03:00
|
|
|
cmake --build build
|
2022-07-10 08:20:27 +03:00
|
|
|
cmake --build build --target check
|
2023-02-16 11:20:05 +03:00
|
|
|
DESTDIR="qbittorrent" cmake --install build
|
2021-11-06 06:11:47 +03:00
|
|
|
|
2023-03-11 22:11:02 +03:00
|
|
|
- name: Run CodeQL analysis
|
2024-01-02 11:23:09 +03:00
|
|
|
uses: github/codeql-action/analyze@v3
|
2023-08-08 18:46:30 +03:00
|
|
|
if: startsWith(matrix.libt_version, 2) && (matrix.qbt_gui == 'GUI=ON')
|
2023-08-01 09:23:51 +03:00
|
|
|
with:
|
|
|
|
category: ${{ github.base_ref || github.ref_name }}
|
2023-03-11 22:11:02 +03:00
|
|
|
|
2021-11-06 06:11:47 +03:00
|
|
|
- name: Prepare build artifacts
|
|
|
|
run: |
|
|
|
|
mkdir upload
|
|
|
|
mkdir upload/cmake
|
|
|
|
cp build/compile_commands.json upload/cmake
|
|
|
|
mkdir upload/cmake/libtorrent
|
2023-11-30 11:48:25 +03:00
|
|
|
cp ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
|
2021-08-19 06:21:34 +03:00
|
|
|
|
2023-11-27 19:04:28 +03:00
|
|
|
- name: Install AppImage
|
2022-12-10 18:12:00 +03:00
|
|
|
run: |
|
|
|
|
sudo apt install libfuse2
|
2023-11-27 19:04:28 +03:00
|
|
|
curl \
|
|
|
|
-L \
|
|
|
|
-Z \
|
2024-06-25 08:11:32 +03:00
|
|
|
-O https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-static-x86_64.AppImage \
|
|
|
|
-O https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-static-x86_64.AppImage \
|
2023-11-27 19:04:28 +03:00
|
|
|
-O https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage
|
|
|
|
chmod +x \
|
2024-06-25 08:11:32 +03:00
|
|
|
linuxdeploy-static-x86_64.AppImage \
|
|
|
|
linuxdeploy-plugin-qt-static-x86_64.AppImage \
|
2023-11-27 19:04:28 +03:00
|
|
|
linuxdeploy-plugin-appimage-x86_64.AppImage
|
|
|
|
|
|
|
|
- name: Prepare files for AppImage
|
2022-12-10 18:12:00 +03:00
|
|
|
if: matrix.qbt_gui == 'GUI=OFF'
|
|
|
|
run: |
|
2023-11-27 19:04:28 +03:00
|
|
|
mkdir -p qbittorrent/usr/share/applications
|
2022-12-10 18:12:00 +03:00
|
|
|
cp .github/workflows/helper/appimage/org.qbittorrent.qBittorrent.desktop qbittorrent/usr/share/applications/org.qbittorrent.qBittorrent.desktop
|
2023-11-27 19:04:28 +03:00
|
|
|
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
|
2022-12-10 18:12:00 +03:00
|
|
|
|
2023-11-27 19:04:28 +03:00
|
|
|
- name: Package AppImage
|
2022-12-10 18:12:00 +03:00
|
|
|
run: |
|
2024-06-25 08:11:32 +03:00
|
|
|
./linuxdeploy-static-x86_64.AppImage --appdir qbittorrent --plugin qt
|
2022-12-10 18:12:00 +03:00
|
|
|
rm qbittorrent/apprun-hooks/*
|
|
|
|
cp .github/workflows/helper/appimage/export_vars.sh qbittorrent/apprun-hooks/export_vars.sh
|
|
|
|
NO_APPSTREAM=1 \
|
2023-11-27 19:04:28 +03:00
|
|
|
OUTPUT=upload/qbittorrent-CI_Ubuntu_x86_64.AppImage \
|
2024-06-25 08:11:32 +03:00
|
|
|
./linuxdeploy-static-x86_64.AppImage --appdir qbittorrent --output appimage
|
2022-12-10 18:12:00 +03:00
|
|
|
|
2021-08-19 06:21:34 +03:00
|
|
|
- name: Upload build artifacts
|
2024-01-02 11:23:09 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-08-19 06:21:34 +03:00
|
|
|
with:
|
2022-12-10 18:12:00 +03:00
|
|
|
name: qBittorrent-CI_Ubuntu-x64_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}_Qt-${{ matrix.qt_version }}
|
2021-11-06 06:11:47 +03:00
|
|
|
path: upload
|