2021-08-19 11:21:34 +08:00
|
|
|
name: CI - macOS
|
2022-02-25 13:34:28 +08:00
|
|
|
|
2021-08-19 11:21:34 +08:00
|
|
|
on: [pull_request, push]
|
|
|
|
|
2023-02-16 16:16:54 +08:00
|
|
|
permissions:
|
|
|
|
actions: write
|
|
|
|
|
2022-02-25 13:34:28 +08:00
|
|
|
concurrency:
|
2022-03-02 13:26:13 +08:00
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
2022-02-25 13:34:28 +08:00
|
|
|
cancel-in-progress: ${{ github.head_ref != '' }}
|
|
|
|
|
2021-08-19 11:21:34 +08:00
|
|
|
jobs:
|
|
|
|
ci:
|
|
|
|
name: Build
|
2021-10-22 12:16:11 +08:00
|
|
|
runs-on: macos-latest
|
2021-08-19 11:21:34 +08:00
|
|
|
|
|
|
|
strategy:
|
2021-10-24 00:57:50 +08:00
|
|
|
fail-fast: false
|
2021-08-19 11:21:34 +08:00
|
|
|
matrix:
|
2024-02-25 19:30:20 +08:00
|
|
|
libt_version: ["2.0.10", "1.2.19"]
|
2021-08-19 11:21:34 +08:00
|
|
|
qbt_gui: ["GUI=ON", "GUI=OFF"]
|
2024-04-22 20:21:16 +08:00
|
|
|
qt_version: ["6.7.0"]
|
2021-08-19 11:21:34 +08:00
|
|
|
|
|
|
|
env:
|
2022-02-26 14:17:38 +08:00
|
|
|
boost_path: "${{ github.workspace }}/../boost"
|
2023-11-30 16:48:25 +08:00
|
|
|
libtorrent_path: "${{ github.workspace }}/../libtorrent"
|
2021-08-19 11:21:34 +08:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-09-05 19:42:07 +08:00
|
|
|
uses: actions/checkout@v4
|
2021-08-19 11:21:34 +08:00
|
|
|
|
|
|
|
- name: Install dependencies
|
2024-04-03 13:00:50 +08:00
|
|
|
uses: Wandalen/wretry.action@v3
|
2023-07-13 13:26:47 +08:00
|
|
|
env:
|
|
|
|
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
|
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
2023-07-03 21:19:01 +08:00
|
|
|
with:
|
|
|
|
attempt_delay: 20000
|
|
|
|
attempt_limit: 6
|
|
|
|
command: |
|
|
|
|
brew update > /dev/null
|
|
|
|
brew install \
|
|
|
|
cmake ninja \
|
2023-09-26 11:51:53 +08:00
|
|
|
openssl@3 zlib
|
2021-08-19 11:21:34 +08:00
|
|
|
|
2021-09-23 12:38:52 +08:00
|
|
|
- name: Setup ccache
|
|
|
|
uses: Chocobo1/setup-ccache-action@v1
|
|
|
|
with:
|
2024-04-01 19:36:45 +08:00
|
|
|
store_cache: ${{ github.ref == 'refs/heads/master' }}
|
2021-09-23 12:38:52 +08:00
|
|
|
update_packager_index: false
|
2024-04-01 19:36:45 +08:00
|
|
|
ccache_options: |
|
|
|
|
max_size=2G
|
2021-09-23 12:38:52 +08:00
|
|
|
|
2022-02-26 14:17:38 +08:00
|
|
|
- name: Install boost
|
2024-02-14 03:36:47 +08:00
|
|
|
env:
|
|
|
|
BOOST_MAJOR_VERSION: "1"
|
2024-08-19 15:59:09 +08:00
|
|
|
BOOST_MINOR_VERSION: "86"
|
2024-02-14 03:36:47 +08:00
|
|
|
BOOST_PATCH_VERSION: "0"
|
2022-02-26 14:17:38 +08:00
|
|
|
run: |
|
2024-02-14 03:36:47 +08: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 15:54:49 +08: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
|
2022-02-26 14:17:38 +08:00
|
|
|
mv "${{ github.workspace }}/.."/boost_* "${{ env.boost_path }}"
|
|
|
|
|
2021-10-24 00:57:50 +08:00
|
|
|
- name: Install Qt
|
2024-06-04 14:15:44 +08:00
|
|
|
uses: jurplel/install-qt-action@v4
|
2021-10-24 00:57:50 +08:00
|
|
|
with:
|
|
|
|
version: ${{ matrix.qt_version }}
|
2022-10-01 21:54:15 +08:00
|
|
|
archives: qtbase qtdeclarative qtsvg qttools
|
|
|
|
# Not sure why Qt made a hard dependency on qtdeclarative, try removing it when Qt > 6.4.0
|
2023-11-17 22:32:33 +08:00
|
|
|
cache: true
|
2021-10-24 00:57:50 +08:00
|
|
|
|
2021-08-19 11:21:34 +08:00
|
|
|
- name: Install libtorrent
|
|
|
|
run: |
|
2021-11-17 15:53:27 +08:00
|
|
|
git clone \
|
|
|
|
--branch v${{ matrix.libt_version }} \
|
|
|
|
--depth 1 \
|
|
|
|
--recurse-submodules \
|
2023-11-30 16:48:25 +08:00
|
|
|
https://github.com/arvidn/libtorrent.git \
|
|
|
|
${{ env.libtorrent_path }}
|
|
|
|
cd ${{ env.libtorrent_path }}
|
2021-08-19 11:21:34 +08:00
|
|
|
cmake \
|
|
|
|
-B build \
|
|
|
|
-G "Ninja" \
|
2023-05-29 12:24:12 +08:00
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
2021-08-19 11:21:34 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_CXX_STANDARD=17 \
|
2021-11-06 11:11:47 +08:00
|
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2022-02-26 14:17:38 +08:00
|
|
|
-DBOOST_ROOT="${{ env.boost_path }}" \
|
2024-06-04 14:15:44 +08:00
|
|
|
-Ddeprecated-functions=OFF
|
2021-08-19 11:21:34 +08:00
|
|
|
cmake --build build
|
|
|
|
sudo cmake --install build
|
|
|
|
|
2023-08-08 23:46:30 +08:00
|
|
|
- name: Build qBittorrent
|
2021-10-24 00:57:50 +08:00
|
|
|
run: |
|
2024-10-06 16:13:14 +08:00
|
|
|
CXXFLAGS="$CXXFLAGS -DQT_FORCE_ASSERTS -Werror -Wno-error=deprecated-declarations" \
|
2023-02-16 16:31:48 +08:00
|
|
|
LDFLAGS="$LDFLAGS -gz" \
|
2021-10-24 00:57:50 +08:00
|
|
|
cmake \
|
|
|
|
-B build \
|
|
|
|
-G "Ninja" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
2021-11-06 11:11:47 +08:00
|
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
2022-02-26 14:17:38 +08:00
|
|
|
-DBOOST_ROOT="${{ env.boost_path }}" \
|
2022-07-10 13:20:27 +08:00
|
|
|
-DTESTING=ON \
|
2021-10-24 00:57:50 +08:00
|
|
|
-DVERBOSE_CONFIGURE=ON \
|
|
|
|
-D${{ matrix.qbt_gui }}
|
2022-05-29 06:08:51 +08:00
|
|
|
cmake --build build --target qbt_update_translations
|
2021-08-19 11:21:34 +08:00
|
|
|
cmake --build build
|
2022-07-10 13:20:27 +08:00
|
|
|
cmake --build build --target check
|
2021-08-19 11:21:34 +08:00
|
|
|
|
2021-11-06 11:11:47 +08:00
|
|
|
- name: Prepare build artifacts
|
|
|
|
run: |
|
2023-05-29 12:24:12 +08:00
|
|
|
# create .dmg
|
|
|
|
appName="qbittorrent"
|
|
|
|
if [ "${{ matrix.qbt_gui }}" = "GUI=OFF" ]; then
|
|
|
|
appName="qbittorrent-nox"
|
|
|
|
fi
|
2024-04-01 19:59:26 +08:00
|
|
|
# package
|
2023-05-29 12:24:12 +08:00
|
|
|
pushd build
|
2024-04-01 19:59:26 +08:00
|
|
|
PACKAGE_RETRY=0
|
|
|
|
while [ "$PACKAGE_RETRY" -lt "3" ]; do
|
2024-04-09 14:22:05 +08:00
|
|
|
macdeployqt "$appName.app" -dmg -no-strip
|
|
|
|
if [ -f "$appName.dmg" ]; then
|
2024-04-01 19:59:26 +08:00
|
|
|
break
|
|
|
|
fi
|
2024-04-09 14:22:05 +08:00
|
|
|
sleep 5
|
2024-04-01 19:59:26 +08:00
|
|
|
PACKAGE_RETRY=$((PACKAGE_RETRY + 1))
|
2024-04-09 14:22:05 +08:00
|
|
|
echo "Retry $PACKAGE_RETRY..."
|
2024-04-01 19:59:26 +08:00
|
|
|
done
|
2023-05-29 12:24:12 +08:00
|
|
|
popd
|
|
|
|
# prepare upload folder
|
2021-11-06 11:11:47 +08:00
|
|
|
mkdir upload
|
2023-05-29 12:24:12 +08:00
|
|
|
cp "build/$appName.dmg" upload
|
2021-11-06 11:11:47 +08:00
|
|
|
mkdir upload/cmake
|
|
|
|
cp build/compile_commands.json upload/cmake
|
|
|
|
mkdir upload/cmake/libtorrent
|
2023-11-30 16:48:25 +08:00
|
|
|
cp ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
|
2021-11-06 11:11:47 +08:00
|
|
|
|
2021-08-19 11:21:34 +08:00
|
|
|
- name: Upload build artifacts
|
2024-01-02 16:23:09 +08:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-08-19 11:21:34 +08:00
|
|
|
with:
|
2023-05-29 12:24:12 +08:00
|
|
|
name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}_Qt-${{ matrix.qt_version }}
|
2021-11-06 11:11:47 +08:00
|
|
|
path: upload
|