1010 build :
1111 runs-on : ${{ matrix.os }}
1212 container : ${{ matrix.container && matrix.container || '' }}
13- name : ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'ios-sim' && matrix.name != 'ios' && matrix.name != 'apple-xcframework' && ' + test' || ''}}
13+ name : ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'ios-sim' && matrix.name != 'ios' && matrix.name != 'apple-xcframework' && matrix.name != 'android-aar' && ' + test' || ''}}
1414 timeout-minutes : 120
1515 strategy :
1616 fail-fast : false
6969 - os : ubuntu-22.04
7070 arch : arm64-v8a
7171 name : android
72- make : PLATFORM=android ARCH=arm64-v8a LLAMA="-DGGML_CPU_ARM_ARCH=armv8.2-a+dotprod"
72+ make : PLATFORM=android ARCH=arm64-v8a
7373 - os : macos-15
7474 name : ios
7575 make : PLATFORM=ios LLAMA="-DGGML_NATIVE=OFF -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
7979 - os : macos-15
8080 name : apple-xcframework
8181 make : xcframework LLAMA="-DGGML_NATIVE=OFF -DGGML_METAL=ON -DGGML_ACCELERATE=ON -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Apple" WHISPER="-DWHISPER_COREML=ON -DWHISPER_COREML_ALLOW_FALLBACK=ON"
82+ - os : ubuntu-22.04
83+ name : android-aar
84+ make : aar
8285
8386 defaults :
8487 run :
9497 with :
9598 submodules : true
9699
100+ - name : android setup java
101+ if : matrix.name == 'android-aar'
102+ uses : actions/setup-java@v4
103+ with :
104+ distribution : ' temurin'
105+ java-version : ' 17'
106+
97107 - name : calculate cache version hashes for modules and dependencies
98108 id : submodule-hashes
99109 env :
@@ -377,12 +387,64 @@ jobs:
377387 with :
378388 path : artifacts
379389
390+ - name : zip artifacts
391+ run : |
392+ VERSION=$(make version)
393+ for folder in "artifacts"/*; do
394+ if [ -d "$folder" ]; then
395+ name=$(basename "$folder")
396+ if [[ "$name" != "ai-apple-xcframework" && "$name" != "ai-android-aar" ]]; then
397+ tar -czf "${name}-${VERSION}.tar.gz" -C "$folder" .
398+ fi
399+ if [[ "$name" != "ai-android-aar" ]]; then
400+ (cd "$folder" && zip -rq "../../${name}-${VERSION}.zip" .)
401+ else
402+ cp "$folder"/*.aar "${name}-${VERSION}.aar"
403+ fi
404+ fi
405+ done
406+
380407 - name : release tag version from sqlite-ai.h
381408 id : tag
382409 run : |
383410 VERSION=$(make version)
384411 if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
385- LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
412+ LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
413+ LATEST=$(echo "$LATEST_RELEASE" | jq -r '.name')
414+ # Check artifact sizes against previous release
415+ if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
416+ echo "Checking artifact sizes against previous release: $LATEST"
417+ FAILED=0
418+ for artifact in ai-*-${VERSION}.*; do
419+ if [ ! -f "$artifact" ]; then
420+ continue
421+ fi
422+ # Get current artifact size
423+ NEW_SIZE=$(stat -c%s "$artifact" 2>/dev/null || stat -f%z "$artifact")
424+ # Get artifact name for previous release
425+ ARTIFACT_NAME=$(echo "$artifact" | sed "s/${VERSION}/${LATEST}/")
426+ # Get previous artifact size from GitHub API
427+ OLD_SIZE=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name == \"$(basename "$ARTIFACT_NAME")\") | .size")
428+ if [ -z "$OLD_SIZE" ] || [ "$OLD_SIZE" = "null" ]; then
429+ echo "⚠️ Previous artifact not found: $(basename "$ARTIFACT_NAME"), skipping comparison"
430+ continue
431+ fi
432+ # Calculate percentage increase
433+ INCREASE=$(awk "BEGIN {printf \"%.2f\", (($NEW_SIZE - $OLD_SIZE) / $OLD_SIZE) * 100}")
434+ echo "📦 $artifact: $OLD_SIZE → $NEW_SIZE bytes (${INCREASE}% change)"
435+ # Check if increase is more than 5%
436+ if (( $(echo "$INCREASE > 5" | bc -l) )); then
437+ echo "❌ ERROR: $artifact size increased by ${INCREASE}% (limit: 5%)"
438+ FAILED=1
439+ fi
440+ done
441+ if [ $FAILED -eq 1 ]; then
442+ echo ""
443+ echo "❌ One or more artifacts exceeded the 5% size increase limit"
444+ exit 1
445+ fi
446+ echo "✅ All artifacts within 5% size increase limit"
447+ fi
386448 if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
387449 echo "version=$VERSION" >> $GITHUB_OUTPUT
388450 else
@@ -393,24 +455,20 @@ jobs:
393455 echo "❌ SQLITE_AI_VERSION not found in sqlite-ai.h"
394456 exit 1
395457
396- - name : zip artifacts
397- run : |
398- for folder in "artifacts"/*; do
399- if [ -d "$folder" ]; then
400- name=$(basename "$folder")
401- if [[ "$name" != "ai-apple-xcframework" ]]; then
402- tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" .
403- fi
404- (cd "$folder" && zip -rq "../../${name}-${{ steps.tag.outputs.version }}.zip" .)
405- fi
406- done
458+ - uses : actions/setup-java@v4
459+ if : steps.tag.outputs.version != ''
460+ with :
461+ distribution : ' temurin'
462+ java-version : ' 17'
463+
464+ - name : release android aar to maven central
465+ if : steps.tag.outputs.version != ''
466+ run : make aar && cd packages/android && ./gradlew publishAggregationToCentralPortal -PSIGNING_KEY="${{ secrets.SIGNING_KEY }}" -PSIGNING_PASSWORD="${{ secrets.SIGNING_PASSWORD }}" -PSONATYPE_USERNAME="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PSONATYPE_PASSWORD="${{ secrets.MAVEN_CENTRAL_TOKEN }}" -PVERSION="${{ steps.tag.outputs.version }}"
407467
408468 -
uses :
softprops/[email protected] 409469 if : steps.tag.outputs.version != ''
410470 with :
411471 generate_release_notes : true
412472 tag_name : ${{ steps.tag.outputs.version }}
413- files : |
414- ai-*-${{ steps.tag.outputs.version }}.zip
415- ai-*-${{ steps.tag.outputs.version }}.tar.gz
473+ files : ai-*-${{ steps.tag.outputs.version }}.*
416474 make_latest : true
0 commit comments