Browse Source

GHA CI: Use prebuilt library packages on macOS

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
c12e486f59
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 99
      .github/workflows/ci.yaml

99
.github/workflows/ci.yaml

@ -16,8 +16,8 @@ jobs:
strategy: strategy:
matrix: matrix:
qbt_gui: ["GUI=ON", "GUI=OFF"]
libt_version: ["v2.0.4", "v1.2.14"] libt_version: ["v2.0.4", "v1.2.14"]
qbt_gui: ["GUI=ON", "GUI=OFF"]
fail-fast: false fail-fast: false
steps: steps:
@ -26,6 +26,8 @@ jobs:
- name: Setup ccache - name: Setup ccache
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}
- name: Install dependencies - name: Install dependencies
run: | run: |
@ -58,7 +60,7 @@ jobs:
-Ddeprecated-functions=OFF \ -Ddeprecated-functions=OFF \
--graphviz=cmake-build-dir/target_graph.dot --graphviz=cmake-build-dir/target_graph.dot
cmake --build build cmake --build build
sudo cmake --install build --prefix /usr/local sudo cmake --install build
- name: Build qBittorrent - name: Build qBittorrent
run: | run: |
@ -186,95 +188,66 @@ jobs:
strategy: strategy:
matrix: matrix:
libt_version: ["v2.0.4", "v1.2.14"]
qbt_gui: ["GUI=ON", "GUI=OFF"] qbt_gui: ["GUI=ON", "GUI=OFF"]
fail-fast: false fail-fast: false
env: env:
VCPKG_DEST_MACOS: /Users/runner/qbt_tools/vcpkg openssl_root: /usr/local/opt/openssl@1.1
defaults:
run:
shell: pwsh
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
# - ninja is needed for building qBittorrent (because it's preferable, not a hard requirement) - name: Setup ccache
# - automake is needed for the installation the vcpkg installation of fontconfig, a dependency of qt5-base uses: hendrikmuhs/ccache-action@v1
- name: Install build tools
shell: bash
run: |
brew install automake ninja
- name: Setup vcpkg
uses: lukka/run-vcpkg@v7
with: with:
vcpkgDirectory: ${{ env.VCPKG_DEST_MACOS }} key: ${{ runner.os }}
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }}
setupOnly: true
- name: Configure vcpkg triplet overlay
run: |
New-Item `
-Path ${{ github.workspace }} `
-Name "triplets_overlay" `
-ItemType Directory
Copy-Item `
${{ env.RUNVCPKG_VCPKG_ROOT }}/triplets/x64-osx.cmake `
${{ github.workspace }}/triplets_overlay/x64-osx-release.cmake
Add-Content `
${{ github.workspace }}/triplets_overlay/x64-osx-release.cmake `
-Value "set(VCPKG_BUILD_TYPE release)","set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15)"
# NOTE: Avoids a libtorrent ABI issue. See https://github.com/arvidn/libtorrent/issues/4965 - name: Install dependencies
- name: Adjust "C++ standard" cmake flag
run: | run: |
(Get-Content ` brew update > /dev/null
-path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake).Replace( ` brew install \
'${FEATURE_OPTIONS}', '${FEATURE_OPTIONS} -DCMAKE_CXX_STANDARD=17') ` cmake ninja \
| Set-Content -Path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake boost openssl@1.1 qt@5 zlib
brew link --force \
qt@5
# workaround for cmake + Qt
sudo ln -s /usr/local/opt/qt@5/mkspecs /usr/local/mkspecs
sudo ln -s /usr/local/opt/qt@5/plugins /usr/local/plugins
- name: Install dependencies - name: Install libtorrent
run: | run: |
$packages = ` git clone --branch ${{ matrix.libt_version }} --depth 1 https://github.com/arvidn/libtorrent.git
"boost-circular-buffer:x64-osx-release", cd libtorrent
"libtorrent:x64-osx-release", git submodule update --init --recursive
"qt5-base:x64-osx-release", export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
"qt5-svg:x64-osx-release", cmake \
"qt5-tools:x64-osx-release", -B build \
"qt5-macextras:x64-osx-release" -G "Ninja" \
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg upgrade ` -DCMAKE_BUILD_TYPE=RelWithDebInfo \
--overlay-triplets=${{ github.workspace }}/triplets_overlay ` -DCMAKE_CXX_STANDARD=17 \
--no-dry-run -Ddeprecated-functions=OFF \
foreach($package in $packages) -DOPENSSL_ROOT_DIR="${{ env.openssl_root }}"
{ cmake --build build
${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg install $package ` sudo cmake --install build
--overlay-triplets=${{ github.workspace }}/triplets_overlay `
--clean-after-build
}
- name: Build qBittorrent - name: Build qBittorrent
shell: bash
run: | run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake \ cmake \
-B build \ -B build \
-G "Ninja" \ -G "Ninja" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DEST_MACOS }}/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-osx-release \
-D${{ matrix.qbt_gui }} \ -D${{ matrix.qbt_gui }} \
-DVERBOSE_CONFIGURE=ON \ -DVERBOSE_CONFIGURE=ON \
--graphviz=build/target_graph.dot -DOPENSSL_ROOT_DIR="${{ env.openssl_root }}"
cmake --build build cmake --build build
- name: Upload build artifacts - name: Upload build artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }} name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }}
path: | path: |
build/compile_commands.json
build/target_graph.dot
build/qbittorrent.app build/qbittorrent.app
build/qbittorrent-nox.app build/qbittorrent-nox.app

Loading…
Cancel
Save