name: CI - Windows on: [pull_request, push] permissions: {} concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: ${{ github.head_ref != '' }} jobs: ci: name: Build (${{ matrix.libtorrent.version }}, ${{ matrix.config.arch }}) runs-on: ${{ matrix.config.os }} permissions: actions: write strategy: fail-fast: false matrix: libtorrent: - version: "2.0.11" boost_major_version: "1" boost_minor_version: "90" boost_patch_version: "0" - version: "1.2.20" boost_major_version: "1" boost_minor_version: "86" boost_patch_version: "0" config: - os: windows-latest arch: x64 qt_arch: win64_msvc2022_64 env: boost_path: "${{ github.workspace }}/../boost" libtorrent_path: "${{ github.workspace }}/../libtorrent" vcpkg_path: "c:/vcpkg" steps: - name: Checkout repository uses: actions/checkout@v6 with: persist-credentials: false - name: Setup devcmd uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.config.arch }} - name: Install build tools run: | if ((Get-Command "ninja.exe" -ErrorAction SilentlyContinue) -eq $null) { choco install ninja } where.exe ninja ninja --version # https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha - name: Set variables for vcpkg uses: actions/github-script@v8 with: script: | core.exportVariable('ACTIONS_CACHE_URL', (process.env.ACTIONS_CACHE_URL || '')); core.exportVariable('ACTIONS_RUNTIME_TOKEN', (process.env.ACTIONS_RUNTIME_TOKEN || '')); - name: Install dependencies with vcpkg run: | # create our own triplet New-Item ` -Force ` -ItemType File ` -Path "${{ env.vcpkg_path }}/triplets_overlay/${{ matrix.config.arch }}-windows-static-md-release.cmake" # OpenSSL isn't compatible with `/guard:cf` flag so we omit it for now, see: https://github.com/openssl/openssl/issues/22554 Add-Content ` -Path "${{ env.vcpkg_path }}/triplets_overlay/${{ matrix.config.arch }}-windows-static-md-release.cmake" ` -Value @("set(VCPKG_TARGET_ARCHITECTURE ${{ matrix.config.arch }})", "set(VCPKG_LIBRARY_LINKAGE static)", "set(VCPKG_CRT_LINKAGE dynamic)", "set(VCPKG_BUILD_TYPE release)") # clear buildtrees after each package installation to reduce disk space requirements $packages = ` "boost-build:${{ matrix.config.arch }}-windows-static-md-release", "openssl:${{ matrix.config.arch }}-windows-static-md-release", "zlib:${{ matrix.config.arch }}-windows-static-md-release" ${{ env.vcpkg_path }}/vcpkg.exe upgrade ` --no-dry-run ` --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay" ${{ env.vcpkg_path }}/vcpkg.exe install ` --binarysource="clear;x-gha,readwrite" ` --clean-after-build ` --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay" ` $packages - name: Install boost run: | $boost_url="https://archives.boost.io/release/${{ matrix.libtorrent.boost_major_version }}.${{ matrix.libtorrent.boost_minor_version }}.${{ matrix.libtorrent.boost_patch_version }}/source/boost_${{ matrix.libtorrent.boost_major_version }}_${{ matrix.libtorrent.boost_minor_version }}_${{ matrix.libtorrent.boost_patch_version }}.tar.gz" $boost_url2="https://sourceforge.net/projects/boost/files/boost/${{ matrix.libtorrent.boost_major_version }}.${{ matrix.libtorrent.boost_minor_version }}.${{ matrix.libtorrent.boost_patch_version }}/boost_${{ matrix.libtorrent.boost_major_version }}_${{ matrix.libtorrent.boost_minor_version }}_${{ matrix.libtorrent.boost_patch_version }}.tar.gz" curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url" tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.." if ($LastExitCode -ne 0) { curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2" tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.." } move "${{ github.workspace }}/../boost_*" "${{ env.boost_path }}" cd "${{ env.boost_path }}" #.\bootstrap.bat ${{ env.vcpkg_path }}/installed/${{ matrix.config.arch }}-windows-static-md-release/tools/boost-build/b2.exe ` stage ` toolset=msvc ` --stagedir=.\ ` --with-headers - name: Install Qt uses: jurplel/install-qt-action@v4 with: version: "6.10.1" arch: ${{ matrix.config.qt_arch }} archives: qtbase qtsvg qttools modules: qtimageformats cache: true - name: Install libtorrent run: | git clone ` --branch v${{ matrix.libtorrent.version }} ` --depth 1 ` --recurse-submodules ` https://github.com/arvidn/libtorrent.git ` ${{ env.libtorrent_path }} cd ${{ env.libtorrent_path }} $env:CXXFLAGS+=" /guard:cf" $env:LDFLAGS+=" /GUARD:CF" cmake ` -B build ` -G "Ninja" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` -DCMAKE_CXX_STANDARD=20 ` -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ` -DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}/install" ` -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" ` -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" ` -DBUILD_SHARED_LIBS=OFF ` -Ddeprecated-functions=OFF ` -Dstatic_runtime=OFF ` -DVCPKG_TARGET_TRIPLET=${{ matrix.config.arch }}-windows-static-md-release cmake --build build cmake --install build - name: Build qBittorrent run: | $env:CXXFLAGS+="/DQT_FORCE_ASSERTS /WX" cmake ` -B build ` -G "Ninja" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ` -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" ` -DBOOST_ROOT="${{ env.boost_path }}/lib/cmake" ` -DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/install/lib/cmake/LibtorrentRasterbar" ` -DMSVC_RUNTIME_DYNAMIC=ON ` -DTESTING=ON ` -DVCPKG_TARGET_TRIPLET=${{ matrix.config.arch }}-windows-static-md-release ` -DVERBOSE_CONFIGURE=ON ` --graphviz=build/target_graph.dot cmake --build build --target qbt_update_translations cmake --build build cmake --build build --target check - name: Prepare build artifacts run: | mkdir upload mkdir upload/qBittorrent copy build/qbittorrent.exe upload/qBittorrent copy build/qbittorrent.pdb upload/qBittorrent copy dist/windows/qt.conf upload/qBittorrent # runtimes copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Core.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Gui.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Network.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Sql.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Svg.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Widgets.dll" upload/qBittorrent copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Xml.dll" upload/qBittorrent mkdir upload/qBittorrent/plugins/iconengines copy "${{ env.Qt_ROOT_DIR }}/plugins/iconengines/qsvgicon.dll" upload/qBittorrent/plugins/iconengines mkdir upload/qBittorrent/plugins/imageformats # include all imageformats dlls since CI (dev) build links dynamically copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qgif.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qicns.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qico.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qjpeg.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qsvg.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qtga.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qtiff.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qwbmp.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qwebp.dll" upload/qBittorrent/plugins/imageformats mkdir upload/qBittorrent/plugins/platforms copy "${{ env.Qt_ROOT_DIR }}/plugins/platforms/qwindows.dll" upload/qBittorrent/plugins/platforms mkdir upload/qBittorrent/plugins/sqldrivers copy "${{ env.Qt_ROOT_DIR }}/plugins/sqldrivers/qsqlite.dll" upload/qBittorrent/plugins/sqldrivers mkdir upload/qBittorrent/plugins/styles copy "${{ env.Qt_ROOT_DIR }}/plugins/styles/qmodernwindowsstyle.dll" upload/qBittorrent/plugins/styles mkdir upload/qBittorrent/plugins/tls copy "${{ env.Qt_ROOT_DIR }}/plugins/tls/qschannelbackend.dll" upload/qBittorrent/plugins/tls # cmake additionals mkdir upload/cmake copy build/compile_commands.json upload/cmake copy build/target_graph.dot upload/cmake mkdir upload/cmake/libtorrent copy ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent - name: Upload build artifacts uses: actions/upload-artifact@v6 with: name: qBittorrent-CI_Windows-${{ matrix.config.arch }}_libtorrent-${{ matrix.libtorrent.version }} path: upload - name: Install NSIS uses: repolevedavaj/install-nsis@a55ed92772254d1e51d880f85ce9b5719f907801 # v1.1.0 with: nsis-version: '3.11' - name: Create installer run: | 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip" makensis /DQBT_CPU_ARCH="${{ matrix.config.arch }}" /DQBT_DIST_DIR="../../upload/qBittorrent" /WX dist/windows/qbittorrent.nsi - name: Upload installer uses: actions/upload-artifact@v6 with: name: qBittorrent-CI_Windows-${{ matrix.config.arch }}_libtorrent-${{ matrix.libtorrent.version }}-setup path: dist/windows/qbittorrent_*_setup.exe