diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ab5b603b4..3191cef1e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,8 +16,8 @@ jobs: strategy: matrix: - qbt_gui: ["GUI=ON", "GUI=OFF"] libt_version: ["v2.0.4", "v1.2.14"] + qbt_gui: ["GUI=ON", "GUI=OFF"] fail-fast: false steps: @@ -26,6 +26,8 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 + with: + key: ${{ runner.os }} - name: Install dependencies run: | @@ -58,7 +60,7 @@ jobs: -Ddeprecated-functions=OFF \ --graphviz=cmake-build-dir/target_graph.dot cmake --build build - sudo cmake --install build --prefix /usr/local + sudo cmake --install build - name: Build qBittorrent run: | @@ -186,95 +188,66 @@ jobs: strategy: matrix: + libt_version: ["v2.0.4", "v1.2.14"] qbt_gui: ["GUI=ON", "GUI=OFF"] fail-fast: false env: - VCPKG_DEST_MACOS: /Users/runner/qbt_tools/vcpkg - - defaults: - run: - shell: pwsh + openssl_root: /usr/local/opt/openssl@1.1 steps: - name: Checkout repository uses: actions/checkout@v2 - # - ninja is needed for building qBittorrent (because it's preferable, not a hard requirement) - # - automake is needed for the installation the vcpkg installation of fontconfig, a dependency of qt5-base - - name: Install build tools - shell: bash - run: | - brew install automake ninja - - - name: Setup vcpkg - uses: lukka/run-vcpkg@v7 + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1 with: - vcpkgDirectory: ${{ env.VCPKG_DEST_MACOS }} - 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: Adjust "C++ standard" cmake flag - run: | - (Get-Content ` - -path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake).Replace( ` - '${FEATURE_OPTIONS}', '${FEATURE_OPTIONS} -DCMAKE_CXX_STANDARD=17') ` - | Set-Content -Path ${{ env.RUNVCPKG_VCPKG_ROOT }}/ports/libtorrent/portfile.cmake + key: ${{ runner.os }} - name: Install dependencies run: | - $packages = ` - "boost-circular-buffer:x64-osx-release", - "libtorrent:x64-osx-release", - "qt5-base:x64-osx-release", - "qt5-svg:x64-osx-release", - "qt5-tools:x64-osx-release", - "qt5-macextras:x64-osx-release" - ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg upgrade ` - --overlay-triplets=${{ github.workspace }}/triplets_overlay ` - --no-dry-run - foreach($package in $packages) - { - ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg install $package ` - --overlay-triplets=${{ github.workspace }}/triplets_overlay ` - --clean-after-build - } + brew update > /dev/null + brew install \ + cmake ninja \ + 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: Build qBittorrent - shell: bash + - name: Install libtorrent run: | + git clone --branch ${{ matrix.libt_version }} --depth 1 https://github.com/arvidn/libtorrent.git + cd libtorrent + git submodule update --init --recursive + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + cmake \ + -B build \ + -G "Ninja" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_CXX_STANDARD=17 \ + -Ddeprecated-functions=OFF \ + -DOPENSSL_ROOT_DIR="${{ env.openssl_root }}" + cmake --build build + sudo cmake --install build + + - name: Build qBittorrent + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" cmake \ -B build \ -G "Ninja" \ -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 }} \ -DVERBOSE_CONFIGURE=ON \ - --graphviz=build/target_graph.dot + -DOPENSSL_ROOT_DIR="${{ env.openssl_root }}" cmake --build build - name: Upload build artifacts uses: actions/upload-artifact@v2 with: - name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }} + name: qBittorrent-CI_macOS_${{ matrix.qbt_gui }}_libtorrent-${{ matrix.libt_version }} path: | - build/compile_commands.json - build/target_graph.dot build/qbittorrent.app build/qbittorrent-nox.app