@@ -138,7 +138,6 @@ jobs:
138138 files : " ${{ github.workspace }}/artifacts/libsimple-windows-${{ matrix.arch }}.zip"
139139 env :
140140 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141- BUILD_TYPE : ${{ github.ref_type == 'tag' && 'Release' || 'Debug' }}
142141
143142 Linux :
144143 runs-on : ${{ matrix.os }}
@@ -147,14 +146,9 @@ jobs:
147146 matrix :
148147 os : [ubuntu-22.04, ubuntu-24.04-arm, ubuntu-latest]
149148 timeout-minutes : 60
149+ env :
150+ BUILD_TYPE : ${{ startsWith(github.ref, 'refs/tags/') && 'Release' || 'Debug' }}
150151 steps :
151- - name : " Release Build Type"
152- if : startsWith(github.ref, 'refs/tags/')
153- run : echo "BUILD_TYPE=Release" >> $GITHUB_ENV
154- - name : " Debug Build Type"
155- if : startsWith(github.ref, 'refs/tags/') != true
156- run : echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
157-
158152 - uses : actions/checkout@v6
159153 with :
160154 fetch-depth : 0
@@ -187,15 +181,8 @@ jobs:
187181 uses : lukka/run-cmake@v10
188182 continue-on-error : false
189183 with :
190- configurePreset : ' ninja-vcpkg-coverage'
191- buildPreset : ' ninja-vcpkg-coverage'
192-
193- - name : ' Run CMake without coverage'
194- if : startsWith(github.ref, 'refs/tags/')
195- uses : lukka/run-cmake@v10
196- with :
197- configurePreset : ' ninja-vcpkg-release'
198- buildPreset : ' ninja-vcpkg-release'
184+ configurePreset : ${{ startsWith(github.ref, 'refs/tags/') && 'ninja-vcpkg-release' || 'ninja-vcpkg-coverage' }}
185+ buildPreset : ${{ startsWith(github.ref, 'refs/tags/') && 'ninja-vcpkg-release' || 'ninja-vcpkg-coverage' }}
199186
200187 - name : ' Run CTest'
201188 if : ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }}
@@ -292,14 +279,9 @@ jobs:
292279 MacOS :
293280 runs-on : macos-latest
294281 needs : Linux
282+ env :
283+ BUILD_TYPE : ${{ startsWith(github.ref, 'refs/tags/') && 'Release' || 'Debug' }}
295284 steps :
296- - name : " Release Build Type"
297- if : startsWith(github.ref, 'refs/tags/')
298- run : echo "BUILD_TYPE=Release" >> $GITHUB_ENV
299- - name : " Debug Build Type"
300- if : startsWith(github.ref, 'refs/tags/') != true
301- run : echo "BUILD_TYPE=Debug" >> $GITHUB_ENV
302-
303285 - uses : actions/checkout@v6
304286 with :
305287 submodules : true
@@ -380,3 +362,79 @@ jobs:
380362 - name : build-iOS
381363 if : success()
382364 run : ./build-ios.sh
365+
366+ - name : Package iOS
367+ if : startsWith(github.ref, 'refs/tags/')
368+ run : |
369+ mkdir libsimple-ios-xcframework
370+ cp -r output/libsimple.xcframework output/dict libsimple-ios-xcframework/
371+ zip -r libsimple-ios-xcframework.zip libsimple-ios-xcframework
372+ working-directory : " ${{ github.workspace }}"
373+
374+ - name : Release iOS
375+ if : startsWith(github.ref, 'refs/tags/')
376+ uses : softprops/action-gh-release@v2
377+ with :
378+ draft : true
379+ files : " ${{ github.workspace }}/libsimple-ios-xcframework.zip"
380+ env :
381+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
382+
383+ Android :
384+ runs-on : ubuntu-latest
385+ needs : Linux
386+ strategy :
387+ fail-fast : true
388+ matrix :
389+ abi : [arm64-v8a, x86_64]
390+ steps :
391+ - uses : actions/checkout@v6
392+ with :
393+ submodules : true
394+
395+ - name : Resolve Android NDK
396+ run : |
397+ if [ -z "${ANDROID_NDK_LATEST_HOME:-}" ]; then
398+ echo "ANDROID_NDK_LATEST_HOME is not available on this runner." >&2
399+ exit 1
400+ fi
401+ echo "ANDROID_NDK_HOME=${ANDROID_NDK_LATEST_HOME}" >> "$GITHUB_ENV"
402+
403+ - name : Configure Android
404+ run : |
405+ cmake -S "${{ github.workspace }}" -B "${{ github.workspace }}/build-android-${{ matrix.abi }}" \
406+ -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \
407+ -DANDROID_ABI="${{ matrix.abi }}" \
408+ -DANDROID_PLATFORM=android-21 \
409+ -DCMAKE_BUILD_TYPE=Release \
410+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/output-android-${{ matrix.abi }}" \
411+ -DBUILD_TEST_EXAMPLE=OFF \
412+ -DBUILD_SHELL=OFF
413+
414+ - name : Build Android
415+ run : cmake --build "${{ github.workspace }}/build-android-${{ matrix.abi }}" --config Release --parallel
416+
417+ - name : Install Android
418+ run : cmake --install "${{ github.workspace }}/build-android-${{ matrix.abi }}" --config Release
419+
420+ - name : Verify Android outputs
421+ run : |
422+ test -f "output-android-${{ matrix.abi }}/bin/libsimple.so"
423+ test -f "output-android-${{ matrix.abi }}/bin/dict/jieba.dict.utf8"
424+
425+ - name : Package Android
426+ if : startsWith(github.ref, 'refs/tags/')
427+ run : |
428+ mkdir "libsimple-android-${{ matrix.abi }}"
429+ cp -r "output-android-${{ matrix.abi }}/bin/libsimple.so" "output-android-${{ matrix.abi }}/bin/dict" "libsimple-android-${{ matrix.abi }}/"
430+ zip -r "libsimple-android-${{ matrix.abi }}.zip" "libsimple-android-${{ matrix.abi }}"
431+ working-directory : " ${{ github.workspace }}"
432+
433+ - name : Release Android
434+ if : startsWith(github.ref, 'refs/tags/')
435+ uses : softprops/action-gh-release@v2
436+ with :
437+ draft : true
438+ files : " ${{ github.workspace }}/libsimple-android-${{ matrix.abi }}.zip"
439+ env :
440+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments