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.9", "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"
59 -Path "${{ env.vcpkg_path }}/triplets_overlay/x64-windows-static-md-release.cmake" `
60 -Value @("set(VCPKG_TARGET_ARCHITECTURE x64)",
61 "set(VCPKG_LIBRARY_LINKAGE static)",
62 "set(VCPKG_CRT_LINKAGE dynamic)",
63 "set(VCPKG_BUILD_TYPE release)",
64 "set(VCPKG_C_FLAGS /guard:cf)",
65 "set(VCPKG_CXX_FLAGS /guard:cf)",
66 "set(VCPKG_LINKER_FLAGS /guard:cf)")
67 # clear buildtrees after each package installation to reduce disk space requirements
69 "openssl:x64-windows-static-md-release",
70 "zlib:x64-windows-static-md-release"
71 ${{ env.vcpkg_path }}/vcpkg.exe upgrade `
73 --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay"
74 ${{ env.vcpkg_path }}/vcpkg.exe install `
75 --binarysource="clear;x-gha,readwrite" `
77 --overlay-triplets="${{ env.vcpkg_path }}/triplets_overlay" `
82 $boost_url="https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.gz"
83 $boost_url2="https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.gz"
84 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url"
85 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."
86 if ($LastExitCode -ne 0)
88 curl -L -o "${{ runner.temp }}/boost.tar.gz" "$boost_url2"
89 tar -xf "${{ runner.temp }}/boost.tar.gz" -C "${{ github.workspace }}/.."
91 move "${{ github.workspace }}/../boost_*" "${{ env.boost_path }}"
94 uses: jurplel/install-qt-action@v3
97 archives: qtbase qtsvg qttools
100 - name: Install libtorrent
103 --branch v${{ matrix.libt_version }} `
105 --recurse-submodules `
106 https://github.com/arvidn/libtorrent.git `
107 ${{ env.libtorrent_path }}
108 cd ${{ env.libtorrent_path }}
109 $env:CXXFLAGS+=" /guard:cf"
110 $env:LDFLAGS+=" /guard:cf"
114 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
115 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
116 -DCMAKE_INSTALL_PREFIX="${{ env.libtorrent_path }}/install" `
117 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
118 -DBOOST_ROOT="${{ env.boost_path }}" `
119 -DBUILD_SHARED_LIBS=OFF `
120 -Ddeprecated-functions=OFF `
121 -Dstatic_runtime=OFF `
122 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release
124 cmake --install build
126 - name: Build qBittorrent
128 $env:CXXFLAGS+=" /WX"
132 -DCMAKE_BUILD_TYPE=RelWithDebInfo `
133 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
134 -DCMAKE_TOOLCHAIN_FILE="${{ env.vcpkg_path }}/scripts/buildsystems/vcpkg.cmake" `
135 -DBOOST_ROOT="${{ env.boost_path }}" `
136 -DLibtorrentRasterbar_DIR="${{ env.libtorrent_path }}/install/lib/cmake/LibtorrentRasterbar" `
137 -DMSVC_RUNTIME_DYNAMIC=ON `
139 -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-release `
140 -DVERBOSE_CONFIGURE=ON `
141 --graphviz=build/target_graph.dot
142 cmake --build build --target qbt_update_translations
144 cmake --build build --target check
146 - name: Prepare build artifacts
149 mkdir upload/qBittorrent
150 copy build/qbittorrent.exe upload/qBittorrent
151 copy build/qbittorrent.pdb upload/qBittorrent
152 copy dist/windows/qt.conf upload/qBittorrent
154 copy "${{ env.Qt6_DIR }}/bin/Qt6Core.dll" upload/qBittorrent
155 copy "${{ env.Qt6_DIR }}/bin/Qt6Gui.dll" upload/qBittorrent
156 copy "${{ env.Qt6_DIR }}/bin/Qt6Network.dll" upload/qBittorrent
157 copy "${{ env.Qt6_DIR }}/bin/Qt6Sql.dll" upload/qBittorrent
158 copy "${{ env.Qt6_DIR }}/bin/Qt6Svg.dll" upload/qBittorrent
159 copy "${{ env.Qt6_DIR }}/bin/Qt6Widgets.dll" upload/qBittorrent
160 copy "${{ env.Qt6_DIR }}/bin/Qt6Xml.dll" upload/qBittorrent
161 mkdir upload/qBittorrent/plugins/iconengines
162 copy "${{ env.Qt6_DIR }}/plugins/iconengines/qsvgicon.dll" upload/qBittorrent/plugins/iconengines
163 mkdir upload/qBittorrent/plugins/imageformats
164 copy "${{ env.Qt6_DIR }}/plugins/imageformats/qico.dll" upload/qBittorrent/plugins/imageformats
165 copy "${{ env.Qt6_DIR }}/plugins/imageformats/qsvg.dll" upload/qBittorrent/plugins/imageformats
166 mkdir upload/qBittorrent/plugins/platforms
167 copy "${{ env.Qt6_DIR }}/plugins/platforms/qwindows.dll" upload/qBittorrent/plugins/platforms
168 mkdir upload/qBittorrent/plugins/sqldrivers
169 copy "${{ env.Qt6_DIR }}/plugins/sqldrivers/qsqlite.dll" upload/qBittorrent/plugins/sqldrivers
170 mkdir upload/qBittorrent/plugins/styles
171 copy "${{ env.Qt6_DIR }}/plugins/styles/qwindowsvistastyle.dll" upload/qBittorrent/plugins/styles
172 mkdir upload/qBittorrent/plugins/tls
173 copy "${{ env.Qt6_DIR }}/plugins/tls/qschannelbackend.dll" upload/qBittorrent/plugins/tls
176 copy build/compile_commands.json upload/cmake
177 copy build/target_graph.dot upload/cmake
178 mkdir upload/cmake/libtorrent
179 copy ${{ env.libtorrent_path }}/build/compile_commands.json upload/cmake/libtorrent
181 - name: Upload build artifacts
182 uses: actions/upload-artifact@v4
184 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}
187 - name: Create installer
189 7z x -o"dist/windows/" "dist/windows/NSISPlugins.zip"
190 makensis /DQBT_DIST_DIR="../../upload/qBittorrent" dist/windows/qbittorrent.nsi
192 - name: Upload installer
193 uses: actions/upload-artifact@v4
195 name: qBittorrent-CI_Windows-x64_libtorrent-${{ matrix.libt_version }}-setup
196 path: dist/windows/qbittorrent_*_setup.exe