name: CI - Windows on: [pull_request, push] permissions: actions: write concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: ${{ github.head_ref != '' }} jobs: ci: name: Build runs-on: windows-latest strategy: fail-fast: false matrix: libt_version: ["2.0.9", "1.2.19"] env: boost_path: "${{ github.workspace }}/../boost" libtorrent_path: "${{ github.workspace }}/libtorrent" steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup devcmd uses: ilammy/msvc-dev-cmd@v1 - name: Install build tools run: | choco install ninja # use the preinstalled vcpkg from image # https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#package-management - name: Setup vcpkg uses: lukka/run-vcpkg@v11 with: vcpkgDirectory: C:/vcpkg doNotUpdateVcpkg: true # the preinstalled vcpkg is updated regularly - name: Install dependencies from vcpkg run: | # clear buildtrees after each package installation to reduce disk space requirements $packages = ` "openssl:x64-windows-static-release", "zlib:x64-windows-static-release" ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe upgrade ` --no-dry-run ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install ` --clean-after-build ` $packages - name: Install boost run: | curl ` -L ` -o "${{ runner.temp }}/boost.tar.gz" ` "https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.gz" tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.." move "${{ github.workspace }}/../boost_*" "${{ env.boost_path }}" - name: Install Qt uses: jurplel/install-qt-action@v3 with: version: "6.5.2" archives: qtbase qtsvg qttools - name: Install libtorrent run: | git clone ` --branch v${{ matrix.libt_version }} ` --depth 1 ` --recurse-submodules ` https://github.com/arvidn/libtorrent.git cd libtorrent $env:CXXFLAGS+=" /guard:cf" $env:LDFLAGS+=" /guard:cf" cmake ` -B build ` -G "Ninja" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ` -DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}" ` -DCMAKE_TOOLCHAIN_FILE="${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" ` -DBOOST_ROOT="${{ env.boost_path }}" ` -DBUILD_SHARED_LIBS=OFF ` -Ddeprecated-functions=OFF ` -Dstatic_runtime=OFF ` -DVCPKG_TARGET_TRIPLET=x64-windows-static-release cmake --build build cmake --install build - name: Build qBittorrent run: | $env:CXXFLAGS+=" /WX" cmake ` -B build ` -G "Ninja" ` -DCMAKE_BUILD_TYPE=RelWithDebInfo ` -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ` -DCMAKE_TOOLCHAIN_FILE="${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" ` -DBOOST_ROOT="${{ env.boost_path }}" ` -DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/lib/cmake/LibtorrentRasterbar" ` -DMSVC_RUNTIME_DYNAMIC=ON ` -DTESTING=ON ` -DVCPKG_TARGET_TRIPLET=x64-windows-static-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.Qt6_DIR }}/bin/Qt6Core.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Gui.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Network.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Sql.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Svg.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Widgets.dll" upload/qBittorrent copy "${{ env.Qt6_DIR }}/bin/Qt6Xml.dll" upload/qBittorrent mkdir upload/qBittorrent/plugins/iconengines copy "${{ env.Qt6_DIR }}/plugins/iconengines/qsvgicon.dll" upload/qBittorrent/plugins/iconengines mkdir upload/qBittorrent/plugins/imageformats copy "${{ env.Qt6_DIR }}/plugins/imageformats/qico.dll" upload/qBittorrent/plugins/imageformats copy "${{ env.Qt6_DIR }}/plugins/imageformats/qsvg.dll" upload/qBittorrent/plugins/imageformats mkdir upload/qBittorrent/plugins/platforms copy "${{ env.Qt6_DIR }}/plugins/platforms/qwindows.dll" upload/qBittorrent/plugins/platforms mkdir upload/qBittorrent/plugins/sqldrivers copy "${{ env.Qt6_DIR }}/plugins/sqldrivers/qsqlite.dll" upload/qBittorrent/plugins/sqldrivers mkdir upload/qBittorrent/plugins/styles copy "${{ env.Qt6_DIR }}/plugins/styles/qwindowsvistastyle.dll" upload/qBittorrent/plugins/styles mkdir upload/qBittorrent/plugins/tls copy "${{ env.Qt6_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 libtorrent/build/compile_commands.json upload/cmake/libtorrent - name: Upload build artifacts uses: actions/upload-artifact@v3 with: name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }} path: upload - name: Create installer run: | 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip" makensis /DQBT_DIST_DIR="../../upload/qBittorrent" dist/windows/qbittorrent.nsi - name: Upload installer uses: actions/upload-artifact@v3 with: name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}-setup path: dist/windows/qbittorrent_*_setup.exe