Debian Codegraph @

.github/workflows/build-windows.yml

raw
1 ---
2 name: Windows
3
4 on:
5 push:
6 branches: [master]
7 tags: ['v*']
8 pull_request:
9 branches: [master]
10
11
12 concurrency:
13 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14 cancel-in-progress: true
15
16 env:
17 QT_VERSION: '6.10.2'
18 KF_VERSION: '6.23'
19 KF_PATCH: '0'
20 KF_BRANCH: stable
21 SNORETOAST_VERSION: '0.9.1'
22 QCA_VERSION: '2.3.10'
23 QTKEYCHAIN_VERSION: '0.15.0'
24 COPYQ_TESTS_SKIP_DRAG_AND_DROP: '1'
25 COPYQ_TESTS_SKIP_BASH: '1'
26 COPYQ_TESTS_NO_SYMLINKS: '1'
27 # There is no audio device on the CI system
28 COPYQ_TESTS_SKIP_AUDIO: '1'
29
30 jobs:
31 build:
32 permissions:
33 contents: read
34 name: Windows
35 runs-on: windows-2025
36 defaults:
37 run:
38 shell: bash
39 steps:
40 - name: Checkout source code
41 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5
42 with:
43 submodules: false
44 persist-credentials: false
45 # Full commit history needed for sortable version string (git describe in CMake).
46 # Blobless filter skips file content for historical commits to speed up clone.
47 fetch-depth: 0
48 filter: blob:none
49
50 - name: Set up MSVC
51 shell: pwsh
52 run: |
53 $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
54 $vsPath = & $vswhere -latest -property installationPath
55 cmd /c "`"$vsPath\VC\Auxiliary\Build\vcvarsall.bat`" x64 && set" | ForEach-Object {
56 if ($_ -match '^([^=]+)=(.*)$') {
57 "$($matches[1])=$($matches[2])" >> $env:GITHUB_ENV
58 }
59 }
60
61 - name: Install Qt
62 uses: jurplel/install-qt-action@48d3ad6db93f3627c8ee7a0454bc6f3744f7e730 # v4
63 with:
64 version: ${{ env.QT_VERSION }}
65 arch: win64_msvc2022_64
66 modules: qtimageformats qt5compat
67 cache: true
68 set-env: true
69
70 - name: Set OpenSSL path
71 run: echo "OPENSSL_ROOT_DIR=C:/Program Files/OpenSSL" >> "$GITHUB_ENV"
72
73 - name: Enable sccache
74 uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
75 with:
76 variant: sccache
77 key: windows-msvc
78
79 - name: Set up dependency paths
80 run: |
81 DEPS_PREFIX="${GITHUB_WORKSPACE}/deps/install"
82 echo "DEPS_PREFIX=$DEPS_PREFIX" >> "$GITHUB_ENV"
83 echo "$DEPS_PREFIX/bin" >> "$GITHUB_PATH"
84 # Extend CMAKE_PREFIX_PATH with Qt and KDE deps.
85 # install-qt-action sets QT_ROOT_DIR but may not set CMAKE_PREFIX_PATH.
86 echo "CMAKE_PREFIX_PATH=${DEPS_PREFIX}/lib/cmake;${DEPS_PREFIX}/share/ECM/cmake;${QT_ROOT_DIR}/lib/cmake" >> "$GITHUB_ENV"
87
88 - name: Cache KDE dependencies
89 id: cache-deps
90 uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
91 with:
92 path: ${{ github.workspace }}/deps/install
93 key: >-
94 windows-deps
95 -kf${{ env.KF_VERSION }}.${{ env.KF_PATCH }}
96 -qca${{ env.QCA_VERSION }}
97 -qtkeychain${{ env.QTKEYCHAIN_VERSION }}
98 -snoretoast${{ env.SNORETOAST_VERSION }}
99 -${{ hashFiles('utils/patches/**') }}
100
101 - name: Build KDE dependencies
102 if: steps.cache-deps.outputs.cache-hit != 'true'
103 run: utils/github/build-windows-deps.sh
104
105 - name: Save dependency cache
106 if: github.event_name == 'push'
107 uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
108 with:
109 path: ${{ github.workspace }}/deps/install
110 key: >-
111 windows-deps
112 -kf${{ env.KF_VERSION }}.${{ env.KF_PATCH }}
113 -qca${{ env.QCA_VERSION }}
114 -qtkeychain${{ env.QTKEYCHAIN_VERSION }}
115 -snoretoast${{ env.SNORETOAST_VERSION }}
116 -${{ hashFiles('utils/patches/**') }}
117
118 - name: Download miniaudio
119 uses: ./.github/actions/download-miniaudio
120
121 - name: Build with CMake
122 env:
123 VCPKG_ROOT: ''
124 run: |
125 cmake --preset Windows \
126 -DWITH_NATIVE_NOTIFICATIONS=TRUE \
127 -DWITH_QCA_ENCRYPTION=TRUE \
128 -DWITH_KEYCHAIN=TRUE
129 cmake --build --preset Windows
130
131
132 - name: Get version string
133 id: version
134 uses: ./.github/actions/get-version
135 with:
136 build_dir: ${{ github.workspace }}/build/copyq/Windows
137
138 - name: Compute numeric version for installer
139 id: version_numeric
140 shell: bash
141 run: |
142 # VersionInfoVersion requires numeric-only (x.x.x or x.x.x.x).
143 numeric="$APP_VERSION"
144 numeric="${numeric%-g*}"
145 echo "value=$numeric" >> "$GITHUB_OUTPUT"
146 env:
147 APP_VERSION: ${{ steps.version.outputs.version }}
148
149 - name: Deploy application
150 run: utils/github/deploy-windows.sh
151 env:
152 APP_VERSION: ${{ steps.version.outputs.version }}
153 BUILD_DIR: ${{ github.workspace }}/build/copyq/Windows
154
155 - name: Set up GPG for tests
156 shell: pwsh
157 run: |
158 $env:PATH = "C:\Program Files\Git\usr\bin;$env:PATH"
159 New-Item -ItemType Directory -Force "$HOME\.gnupg" | Out-Null
160 gpg --version
161
162 - name: Test
163 working-directory: ${{ github.workspace }}/copyq-${{ steps.version.outputs.version }}
164 run: |
165 PATH="$(pwd):/c/Program Files/Git/usr/bin"
166 export PATH
167 ./copyq-tests.exe
168 env:
169 QT_FORCE_STDERR_LOGGING: 1
170 COPYQ_LOG_LEVEL: DEBUG
171 COPYQ_TESTS_RERUN_FAILED: 1
172 COPYQ_PLUGINS: ${{ github.workspace }}\copyq-${{ steps.version.outputs.version }}\itemtests.dll
173
174 - name: Separate test files from portable app
175 run: |
176 APP="copyq-${APP_VERSION}"
177 mkdir -p "${APP}-tests"
178 mv "${APP}/copyq-tests.exe" "${APP}-tests/"
179 mv "${APP}/itemtests.dll" "${APP}-tests/"
180 mv "${APP}/Qt6Test.dll" "${APP}-tests/"
181 env:
182 APP_VERSION: ${{ steps.version.outputs.version }}
183
184 - name: Build installer
185 shell: pwsh
186 run: |
187 & "C:/Program Files (x86)/Inno Setup 6/ISCC.exe" `
188 /O"$env:GITHUB_WORKSPACE" `
189 /DAppVersion="$env:APP_VERSION" `
190 /DAppVersionNumeric="$env:APP_VERSION_NUMERIC" `
191 /DRoot="$env:GITHUB_WORKSPACE/copyq-$env:APP_VERSION" `
192 /DSource="$env:GITHUB_WORKSPACE" `
193 "$env:GITHUB_WORKSPACE/shared/copyq.iss"
194 env:
195 APP_VERSION: ${{ steps.version.outputs.version }}
196 APP_VERSION_NUMERIC: ${{ steps.version_numeric.outputs.value }}
197
198 - name: Create portable zip
199 run: 7z a "copyq-${APP_VERSION}.zip" "copyq-${APP_VERSION}"
200 env:
201 APP_VERSION: ${{ steps.version.outputs.version }}
202
203 - name: Upload portable zip
204 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
205 with:
206 name: copyq-${{ steps.version.outputs.version }}.zip
207 path: copyq-${{ steps.version.outputs.version }}.zip
208 archive: false
209
210 - name: Upload installer
211 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
212 with:
213 name: copyq-${{ steps.version.outputs.version }}-setup.exe
214 path: copyq-${{ steps.version.outputs.version }}-setup.exe
215 archive: false
216
217 - name: Upload tests
218 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
219 with:
220 name: copyq-${{ steps.version.outputs.version }}-tests.zip
221 path: copyq-${{ steps.version.outputs.version }}-tests
222 archive: true
223
224
225 release:
226 if: startsWith(github.ref, 'refs/tags/v')
227 needs: build
228 runs-on: ubuntu-latest
229 permissions:
230 contents: write
231 steps:
232 - name: Download artifacts
233 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
234
235 - name: Upload to release
236 run: |
237 gh release create "$GITHUB_REF_NAME" --draft --notes "" 2>/dev/null || true
238 gh release upload "$GITHUB_REF_NAME" copyq-*/*.zip copyq-*/*.exe --clobber
239 env:
240 GH_TOKEN: ${{ github.token }}
241 GH_REPO: ${{ github.repository }}