3 on: [pull_request, push]
9 group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10 cancel-in-progress: ${{ github.head_ref != '' }}
15 runs-on: windows-latest
20 libt_version: ["2.0.10", "1.2.19"]
23 boost_path: "${{ github.workspace }}/../boost"
24 libtorrent_path: "${{ github.workspace }}/../libtorrent"
25 vcpkg_path: "c:/vcpkg"
28 - name: Checkout repository
29 uses: actions/checkout@v4
32 uses: ilammy/msvc-dev-cmd@v1
34 - name: Install build tools
36 if ((Get-Command "ninja.exe" -ErrorAction SilentlyContinue) -eq $null)
43 # https://learn.microsoft.com/en-us/vcpkg/users/binarycaching#gha
44 - name: Set variables for vcpkg
45 uses: actions/github-script@v7
48 core.exportVariable('ACTIONS_CACHE_URL', (process.env.ACTIONS_CACHE_URL || ''));
49 core.exportVariable('ACTIONS_RUNTIME_TOKEN', (process.env.ACTIONS_RUNTIME_TOKEN || ''));
51 - name: Install dependencies with vcpkg
53 # create our own triplet
57 -Path "${{ env.vcpkg_path }}/triplets_overlay/x64-windows-static-md-release.cmake"
58 # OpenSSL isn't compatible with `/guard:cf` flag so we omit it for now, see: https://github.com/openssl/openssl/issues/22554
60 -Path "${{ env.vcpkg_path }}/triplets_overlay/x64-windows-static-md-release.cmake" `
61 -Value @("set(VCPKG_TARGET_ARCHITECTURE x64)",
62 "set(VCPKG_LIBRARY_LINKAGE static)",
63 "set(VCPKG_CRT_LINKAGE dynamic)",
64 "set(VCPKG_BUILD_TYPE release)")
65 # clear buildtrees after each package installation to reduce disk space requirements
67 "openssl:x64-windows-static-md-release",
68 "zlib:x64-windows-static-md-release"
69 ${{ env.vcpkg_path }}/vcpkg.exe upgrade `
71 --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay"
72 ${{ env.vcpkg_path }}/vcpkg.exe install `
73 --binarysource="clear;x-gha,readwrite" `
75 --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay" `
80 BOOST_MAJOR_VERSION: "1"
81 BOOST_MINOR_VERSION: "86"
82 BOOST_PATCH_VERSION: "0"
84 $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"
85 $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"
86 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url"
87 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."
88 if ($LastExitCode -ne 0)
90 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2"
91 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."
93 move "${{ github.workspace }}/../boost_*" "${{ env.boost_path }}"
96 uses: jurplel/install-qt-action@v4
99 arch: win64_msvc2022_64
100 archives: qtbase qtsvg qttools
103 - name: Install libtorrent
106 --branch v${{ matrix.libt_version }} `
108 --recurse-submodules `
109 https://github.com/arvidn/libtorrent.git `
110 ${{ env.libtorrent_path }}
111 cd ${{ env.libtorrent_path }}
112 $env:CXXFLAGS+=" /guard:cf"
113 $env:LDFLAGS+=" /guard:cf"
117 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
118 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
119 -DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}/install" `
120 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
121 -DBOOST_ROOT="${{ env.boost_path }}" `
122 -DBUILD_SHARED_LIBS=OFF `
123 -Ddeprecated-functions=OFF `
124 -Dstatic_runtime=OFF `
125 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release
127 cmake --install build
129 - name: Build qBittorrent
131 $env:CXXFLAGS+="/DQT_FORCE_ASSERTS /WX"
135 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
136 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
137 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
138 -DBOOST_ROOT="${{ env.boost_path }}" `
139 -DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/install/lib/cmake/LibtorrentRasterbar" `
140 -DMSVC_RUNTIME_DYNAMIC=ON `
142 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release `
143 -DVERBOSE_CONFIGURE=ON `
144 --graphviz=build/target_graph.dot
145 cmake --build build --target qbt_update_translations
147 cmake --build build --target check
149 - name: Prepare build artifacts
152 mkdir upload/qBittorrent
153 copy build/qbittorrent.exe upload/qBittorrent
154 copy build/qbittorrent.pdb upload/qBittorrent
155 copy dist/windows/qt.conf upload/qBittorrent
157 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Core.dll" upload/qBittorrent
158 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Gui.dll" upload/qBittorrent
159 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Network.dll" upload/qBittorrent
160 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Sql.dll" upload/qBittorrent
161 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Svg.dll" upload/qBittorrent
162 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Widgets.dll" upload/qBittorrent
163 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Xml.dll" upload/qBittorrent
164 mkdir upload/qBittorrent/plugins/iconengines
165 copy "${{ env.Qt_ROOT_DIR }}/plugins/iconengines/qsvgicon.dll" upload/qBittorrent/plugins/iconengines
166 mkdir upload/qBittorrent/plugins/imageformats
167 copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qico.dll" upload/qBittorrent/plugins/imageformats
168 copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qsvg.dll" upload/qBittorrent/plugins/imageformats
169 mkdir upload/qBittorrent/plugins/platforms
170 copy "${{ env.Qt_ROOT_DIR }}/plugins/platforms/qwindows.dll" upload/qBittorrent/plugins/platforms
171 mkdir upload/qBittorrent/plugins/sqldrivers
172 copy "${{ env.Qt_ROOT_DIR }}/plugins/sqldrivers/qsqlite.dll" upload/qBittorrent/plugins/sqldrivers
173 mkdir upload/qBittorrent/plugins/styles
174 copy "${{ env.Qt_ROOT_DIR }}/plugins/styles/qmodernwindowsstyle.dll" upload/qBittorrent/plugins/styles
175 mkdir upload/qBittorrent/plugins/tls
176 copy "${{ env.Qt_ROOT_DIR }}/plugins/tls/qschannelbackend.dll" upload/qBittorrent/plugins/tls
179 copy build/compile_commands.json upload/cmake
180 copy build/target_graph.dot upload/cmake
181 mkdir upload/cmake/libtorrent
182 copy ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
184 - name: Upload build artifacts
185 uses: actions/upload-artifact@v4
187 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}
190 - name: Create installer
192 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip"
193 makensis /DQBT_DIST_DIR="../../upload/qBittorrent" /WX dist/windows/qbittorrent.nsi
195 - name: Upload installer
196 uses: actions/upload-artifact@v4
198 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}-setup
199 path: dist/windows/qbittorrent_*_setup.exe