@@ -31,42 +31,51 @@ jobs:
3131 - arch : arm64
3232
3333 steps :
34- - name : " Set Build Type"
34+ - name : " Set Build Type and Presets "
3535 id : build_type
3636 shell : pwsh
3737 run : |
38- if ("${{ github.ref }}".StartsWith("refs/tags/")) {
39- echo "BUILD_TYPE=Release" >> $env:GITHUB_OUTPUT
40- } else {
41- echo "BUILD_TYPE=Debug" >> $env:GITHUB_OUTPUT
38+ $buildType = if ("${{ github.ref }}".StartsWith("refs/tags/")) { "Release" } else { "Debug" }
39+ echo "BUILD_TYPE=$buildType" >> $env:GITHUB_OUTPUT
40+
41+ $arch = "${{ matrix.arch }}"
42+ switch ($arch) {
43+ "x64" {
44+ $configurePreset = "windows-msvc-vs17"
45+ $buildDir = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "..\..\_temp\windows-x64")).Replace('\', '/')
46+ }
47+ "x86" {
48+ $configurePreset = "windows-msvc-vs17-x86"
49+ $buildDir = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "..\..\_temp\windows-x86")).Replace('\', '/')
50+ }
51+ "arm64" {
52+ $configurePreset = "windows-msvc-vs17-arm64"
53+ $buildDir = [System.IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "..\..\_temp\windows-arm64")).Replace('\', '/')
54+ }
55+ default {
56+ throw "Unsupported matrix.arch: $arch"
57+ }
4258 }
4359
44- if ("${{ matrix.arch }}" -eq "x64") {
45- echo "Arch:x64";
46- echo "::set-output name=BUILD_ARCH::x64";
47- } elseif ("${{ matrix.arch }}" -eq "arm64") {
48- echo "Arch:ARM64";
49- echo "::set-output name=BUILD_ARCH::ARM64";
50- } else {
51- echo "Arch:Win32";
52- echo "::set-output name=BUILD_ARCH::Win32";
53- }
54-
60+ $buildPreset = if ($buildType -eq "Release") { "${configurePreset}-release" } else { $configurePreset }
61+ echo "CONFIGURE_PRESET=$configurePreset" >> $env:GITHUB_OUTPUT
62+ echo "BUILD_PRESET=$buildPreset" >> $env:GITHUB_OUTPUT
63+ echo "BUILD_DIR=$buildDir" >> $env:GITHUB_OUTPUT
5564
5665 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
57- - uses : actions/checkout@v4
66+ - uses : actions/checkout@v6
5867 with :
5968 submodules : true
6069
6170 # - name: Install MSVC problem matcher
6271 # uses: ammaraskar/msvc-problem-matcher@master
6372
6473 # Install latest CMake
65- - uses : lukka/get-cmake@v3.31.6
74+ - uses : lukka/get-cmake@v4.2.0
6675
6776 # Restore from cache the previously built ports
6877 - name : Restore artifacts, or setup vcpkg
69- uses : lukka/run-vcpkg@v10
78+ uses : lukka/run-vcpkg@v11
7079 with :
7180 vcpkgDirectory : ' ${{ github.workspace }}/vcpkg'
7281
@@ -80,14 +89,14 @@ jobs:
8089 uses : lukka/run-cmake@v10
8190 continue-on-error : false
8291 with :
83- configurePreset : ' windows-msvc-vs17 '
84- buildPreset : ${{ startsWith(github.ref, 'refs/tags/') && 'windows-msvc-vs17-release' || 'windows-msvc-vs17' }}
92+ configurePreset : ${{ steps.build_type.outputs.CONFIGURE_PRESET }}
93+ buildPreset : ${{ steps.build_type.outputs.BUILD_PRESET }}
8594
8695 - name : " Check file existence"
8796 uses : andstor/file-existence-action@v3
8897 with :
8998 allow_failure : true
90- files : " ${{ github.workspace }}/../../_temp/windows/ src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll, ${{ github.workspace }}/../../_temp/windows /cppjieba/src/cppjieba/dict/jieba.dict.utf8"
99+ files : " ${{ steps.build_type.outputs.BUILD_DIR }}/src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll, ${{ steps.build_type.outputs.BUILD_DIR }}/cppjieba/src/cppjieba/dict/jieba.dict.utf8"
91100
92101 # can't build
93102 # npm run
@@ -120,7 +129,7 @@ jobs:
120129 mkdir libsimple-windows-${{ matrix.arch }}
121130 Copy-Item -Path src/${{ steps.build_type.outputs.BUILD_TYPE }}/simple.dll,cppjieba/src/cppjieba/dict/ -Destination libsimple-windows-${{ matrix.arch }}/ -Recurse
122131 Compress-Archive -Path libsimple-windows-${{ matrix.arch }} -DestinationPath "$outputDir\libsimple-windows-${{ matrix.arch }}.zip"
123- working-directory : " ${{ github.workspace }}/../../_temp/windows/ "
132+ working-directory : " ${{ steps.build_type.outputs.BUILD_DIR }}"
124133 - name : Release
125134 if : startsWith(github.ref, 'refs/tags/')
126135 uses : softprops/action-gh-release@v2
@@ -146,7 +155,7 @@ jobs:
146155 if : startsWith(github.ref, 'refs/tags/') != true
147156 run : echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
148157
149- - uses : actions/checkout@v4
158+ - uses : actions/checkout@v6
150159 with :
151160 fetch-depth : 0
152161 submodules : true
@@ -161,19 +170,14 @@ jobs:
161170 sudo apt-get install -y gcc g++
162171
163172 - name : Restore artifacts, or setup vcpkg
164- uses : lukka/run-vcpkg@v10
173+ uses : lukka/run-vcpkg@v11
165174 with :
166175 vcpkgDirectory : ' ${{ github.workspace }}/vcpkg'
167176
168177 - name : Install lcov
169178 if : startsWith(github.ref, 'refs/tags/') != true
170179 run : sudo apt-get install lcov
171180
172- - name : Install codecov
173- if : startsWith(github.ref, 'refs/tags/') != true
174- shell : bash
175- run : sudo pip install codecov
176-
177181 - run : |
178182 echo "RUNVCPKG_NO_CACHE=1" >> $GITHUB_ENV
179183 if: ${{ failure() || cancelled() }}
@@ -210,7 +214,12 @@ jobs:
210214 run : lcov --list coverage_filter.info
211215 - name : Code coverage - Upload to CodeCov
212216 if : ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }}
213- run : bash <(curl -s https://codecov.io/bash) -f coverage_filter.info || echo "Codecov did not collect coverage reports"
217+ uses : codecov/codecov-action@v5
218+ with :
219+ files : coverage_filter.info
220+ token : ${{ secrets.CODECOV_TOKEN }}
221+ fail_ci_if_error : false
222+ verbose : true
214223
215224 - name : " Check file existence"
216225 uses : andstor/file-existence-action@v3
@@ -219,7 +228,7 @@ jobs:
219228 files : " ${{ github.workspace }}/build/src/libsimple.so, ${{ github.workspace }}/build/test/dict/jieba.dict.utf8"
220229
221230 # npm run
222- - uses : actions/setup-node@v4
231+ - uses : actions/setup-node@v6
223232 if : startsWith(github.ref, 'refs/tags/') != true
224233 with :
225234 node-version : ' 20'
@@ -232,7 +241,7 @@ jobs:
232241 npm run b -- --ext_path="${{ github.workspace }}/build/src/" --dict_path="${{ github.workspace }}/build/test/dict/"
233242
234243 # python run
235- - uses : actions/setup-python@v5
244+ - uses : actions/setup-python@v6
236245 if : startsWith(github.ref, 'refs/tags/') != true
237246 with :
238247 python-version : ' 3.13' # Version range or exact version of a Python version to use, using SemVer's version range syntax
@@ -245,7 +254,7 @@ jobs:
245254 - name : " Build Changelog"
246255 id : build_changelog
247256 if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' }}
248- uses : mikepenz/release-changelog-builder-action@v1
257+ uses : mikepenz/release-changelog-builder-action@v6
249258 env :
250259 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
251260 - name : Package
@@ -265,7 +274,7 @@ jobs:
265274 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
266275 - name : Release
267276 if : ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' }}
268- uses : softprops/action-gh-release@v1
277+ uses : softprops/action-gh-release@v2
269278 with :
270279 draft : true
271280 files : ${{ github.workspace }}/build/libsimple-linux-${{ matrix.os }}.zip
@@ -291,7 +300,7 @@ jobs:
291300 if : startsWith(github.ref, 'refs/tags/') != true
292301 run : echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
293302
294- - uses : actions/checkout@v4
303+ - uses : actions/checkout@v6
295304 with :
296305 submodules : true
297306
@@ -301,7 +310,7 @@ jobs:
301310
302311 # Restore from cache the previously built ports
303312 - name : Restore artifacts, or setup vcpkg
304- uses : lukka/run-vcpkg@v10
313+ uses : lukka/run-vcpkg@v11
305314 with :
306315 vcpkgDirectory : ' ${{ github.workspace }}/vcpkg'
307316
@@ -327,11 +336,11 @@ jobs:
327336 allow_failure : true
328337 files : " ${{ github.workspace }}/../../_temp/macos/src/libsimple.dylib, ${{ github.workspace }}/../../_temp/macos/test/dict/jieba.dict.utf8"
329338
330- - uses : actions/setup-node@v4
339+ - uses : actions/setup-node@v6
331340 with :
332341 node-version : ' 20'
333342
334- # - uses: actions/setup-python@v5
343+ # - uses: actions/setup-python@v6
335344 # with:
336345 # python-version: '3.12' # Version range or exact version of a Python version to use, using SemVer's version range syntax
337346 # npm run
@@ -361,7 +370,7 @@ jobs:
361370
362371 - name : Release
363372 if : startsWith(github.ref, 'refs/tags/')
364- uses : softprops/action-gh-release@v1
373+ uses : softprops/action-gh-release@v2
365374 with :
366375 draft : true
367376 files : " ${{ github.workspace }}/../../_temp/macos/libsimple-osx-x64.zip"
0 commit comments