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 archives: qtbase qtsvg qttools
102 - name: Install libtorrent
105 --branch v${{ matrix.libt_version }} `
107 --recurse-submodules `
108 https://github.com/arvidn/libtorrent.git `
109 ${{ env.libtorrent_path }}
110 cd ${{ env.libtorrent_path }}
111 $env:CXXFLAGS+=" /guard:cf"
112 $env:LDFLAGS+=" /guard:cf"
116 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
117 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
118 -DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}/install" `
119 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
120 -DBOOST_ROOT="${{ env.boost_path }}" `
121 -DBUILD_SHARED_LIBS=OFF `
122 -Ddeprecated-functions=OFF `
123 -Dstatic_runtime=OFF `
124 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release
126 cmake --install build
128 - name: Build qBittorrent
130 $env:CXXFLAGS+=" /WX"
134 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
135 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
136 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
137 -DBOOST_ROOT="${{ env.boost_path }}" `
138 -DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/install/lib/cmake/LibtorrentRasterbar" `
139 -DMSVC_RUNTIME_DYNAMIC=ON `
141 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release `
142 -DVERBOSE_CONFIGURE=ON `
143 --graphviz=build/target_graph.dot
144 cmake --build build --target qbt_update_translations
146 cmake --build build --target check
148 - name: Prepare build artifacts
151 mkdir upload/qBittorrent
152 copy build/qbittorrent.exe upload/qBittorrent
153 copy build/qbittorrent.pdb upload/qBittorrent
154 copy dist/windows/qt.conf upload/qBittorrent
156 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Core.dll" upload/qBittorrent
157 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Gui.dll" upload/qBittorrent
158 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Network.dll" upload/qBittorrent
159 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Sql.dll" upload/qBittorrent
160 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Svg.dll" upload/qBittorrent
161 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Widgets.dll" upload/qBittorrent
162 copy "${{ env.Qt_ROOT_DIR }}/bin/Qt6Xml.dll" upload/qBittorrent
163 mkdir upload/qBittorrent/plugins/iconengines
164 copy "${{ env.Qt_ROOT_DIR }}/plugins/iconengines/qsvgicon.dll" upload/qBittorrent/plugins/iconengines
165 mkdir upload/qBittorrent/plugins/imageformats
166 copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qico.dll" upload/qBittorrent/plugins/imageformats
167 copy "${{ env.Qt_ROOT_DIR }}/plugins/imageformats/qsvg.dll" upload/qBittorrent/plugins/imageformats
168 mkdir upload/qBittorrent/plugins/platforms
169 copy "${{ env.Qt_ROOT_DIR }}/plugins/platforms/qwindows.dll" upload/qBittorrent/plugins/platforms
170 mkdir upload/qBittorrent/plugins/sqldrivers
171 copy "${{ env.Qt_ROOT_DIR }}/plugins/sqldrivers/qsqlite.dll" upload/qBittorrent/plugins/sqldrivers
172 mkdir upload/qBittorrent/plugins/styles
173 copy "${{ env.Qt_ROOT_DIR }}/plugins/styles/qmodernwindowsstyle.dll" upload/qBittorrent/plugins/styles
174 mkdir upload/qBittorrent/plugins/tls
175 copy "${{ env.Qt_ROOT_DIR }}/plugins/tls/qschannelbackend.dll" upload/qBittorrent/plugins/tls
178 copy build/compile_commands.json upload/cmake
179 copy build/target_graph.dot upload/cmake
180 mkdir upload/cmake/libtorrent
181 copy ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
183 - name: Upload build artifacts
184 uses: actions/upload-artifact@v4
186 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}
189 - name: Create installer
191 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip"
192 makensis /DQBT_DIST_DIR="../../upload/qBittorrent" /WX dist/windows/qbittorrent.nsi
194 - name: Upload installer
195 uses: actions/upload-artifact@v4
197 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}-setup
198 path: dist/windows/qbittorrent_*_setup.exe