@@ -348,3 +348,137 @@ jobs:
348348 $pkgs = Get-ChildItem -Path com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
349349 nuget push $pkgs[0].Name -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate
350350 shell : pwsh
351+
352+ android :
353+ runs-on : ubuntu-20.04
354+ strategy :
355+ fail-fast : true
356+ matrix :
357+ include :
358+ - arch : ' arm64-v8a'
359+ - arch : ' x86_64'
360+ steps :
361+ - uses : actions/checkout@v3
362+ with :
363+ fetch-depth : 1
364+ path : ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
365+ ref : refs/heads/compnerd/swift
366+ repository : thebrowsercompany/firebase-cpp-sdk
367+
368+ - name : Install Ninja
369+ run : sudo apt-get install -y ninja-build
370+
371+ - name : Download Android NDK
372+ run : |
373+ NDK_VERSION="r21e"
374+ NDK_FILE="android-ndk-${NDK_VERSION}-linux-x86_64.zip"
375+ curl -L -o "${NDK_FILE}" "https://dl.google.com/android/repository/${NDK_FILE}"
376+ unzip -q "${NDK_FILE}"
377+ rm "${NDK_FILE}"
378+ echo "NDK_ROOT=$(pwd)/android-ndk-${NDK_VERSION}" >> $GITHUB_ENV
379+ echo "ANDROID_NDK_HOME=$(pwd)/android-ndk-${NDK_VERSION}" >> $GITHUB_ENV
380+
381+ - name : Install absl-py
382+ run : pip install absl-py
383+
384+ - name : Build
385+ run : |
386+ echo "NDK: $NDK_ROOT"
387+
388+ export SRC=${{ github.workspace }}/SourceCache/firebase-cpp-sdk
389+ export DST=${{ github.workspace }}/SourceCache/firebase-cpp-sdk
390+ function cmake_build {
391+ arch=$1
392+ module=$2
393+ extra_params=$3
394+ src_dir=$SRC
395+ dst_dir=$DST
396+ ndk_dir="$NDK_ROOT"
397+ config_command="cmake \
398+ -H$src_dir \
399+ -B$dst_dir/$module/.externalNativeBuild/cmake/release/$arch \
400+ -DANDROID_ABI=$arch \
401+ -DANDROID_PLATFORM=android-19 \
402+ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$dst_dir/$module/build/intermediates/cmake/release/obj/$arch \
403+ -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr \
404+ -DCMAKE_BUILD_TYPE=Release \
405+ -DANDROID_NDK=$ndk_dir \
406+ -DCMAKE_TOOLCHAIN_FILE=$ndk_dir/build/cmake/android.toolchain.cmake \
407+ -GNinja \
408+ -DFIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF \
409+ -D FIREBASE_GITHUB_ACTION_BUILD=YES \
410+ $extra_params"
411+ echo "Configuring $module..."
412+ eval "$config_command"
413+ echo "Building $module..."
414+ cmake --build $dst_dir/$module/.externalNativeBuild/cmake/release/$arch
415+ }
416+ arch="${{ matrix.arch }}"
417+ cd ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
418+
419+ # Prebuild the gradle app to avoid any gradle <-> cmake issues on GHA workflow.
420+ ./gradlew :app:invites_resources:generateDexJarRelease
421+
422+ # Build the invididual components
423+ cmake_build $arch "app" ""
424+ cmake_build $arch "storage" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_STORAGE=ON"
425+ cmake_build $arch "messaging" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_MESSAGING=ON"
426+ cmake_build $arch "analytics" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_ANALYTICS=ON"
427+ cmake_build $arch "database" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_DATABASE=ON"
428+ cmake_build $arch "gma" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_GMA=ON"
429+ cmake_build $arch "dynamic_links" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_DYNAMIC_LINKS=ON"
430+ cmake_build $arch "installations" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_INSTALLATIONS=ON"
431+ cmake_build $arch "app_check" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_APP_CHECK=ON"
432+ cmake_build $arch "firestore" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_FIRESTORE=ON"
433+ cmake_build $arch "auth" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_AUTH=ON"
434+ cmake_build $arch "functions" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_FUNCTIONS=ON"
435+ cmake_build $arch "remote_config" "-DFIREBASE_CPP_USE_PRIOR_GRADLE_BUILD=ON -DFIREBASE_INCLUDE_REMOTE_CONFIG=ON"
436+
437+ - name : Install (manual)
438+ run : |
439+ echo "Copying static libraries ..."
440+ source="${{ github.workspace }}/SourceCache/firebase-cpp-sdk"
441+ destination_dir=${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/android/${{ matrix.arch }}
442+ mkdir -p $destination_dir
443+ while IFS= read -r file; do
444+ cp "$file" "$destination_dir"
445+ echo "Copied: $file"
446+ done < <(find $source -type f -name "*.a")
447+
448+ - uses : actions/upload-artifact@v3
449+ with :
450+ name : firebase-android-${{ matrix.arch }}
451+ path : ${{ github.workspace }}/BuildRoot/Library/firebase
452+
453+ release_android :
454+ needs : [android]
455+ runs-on : windows-latest
456+ steps :
457+ - name : Download firebase-android-arm64-v8a artifact
458+ uses : actions/download-artifact@v3
459+ with :
460+ name : firebase-android-arm64-v8a
461+ path : ${{ github.workspace }}/firebase-android-arm64-v8a
462+
463+ - name : Download firebase-android-x86_64 artifact
464+ uses : actions/download-artifact@v3
465+ with :
466+ name : firebase-android-x86_64
467+ path : ${{ github.workspace }}/firebase-android-x86_64
468+
469+ - name : Create Release
470+ env :
471+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
472+ run : |
473+ Compress-Archive -Path "${{ github.workspace }}/firebase-android-arm64-v8a" -DestinationPath firebase-android-arm64-v8a.zip
474+ $SHA256_arm64 = Get-FileHash -Path firebase-android-arm64-v8a.zip -Algorithm SHA256 > firebase-android-arm64-v8a.zip.sha256
475+ Compress-Archive -Path "${{ github.workspace }}/firebase-android-x86_64" -DestinationPath firebase-android-x86_64.zip
476+ $SHA256_x86_64 = Get-FileHash -Path firebase-android-x86_64.zip -Algorithm SHA256 > firebase-android-x86_64.zip.sha256
477+ $Date = Get-Date -Format 'yyyyMMdd'
478+ $Release = $(gh release list -R ${{ github.repository }} | Select-String -Pattern $Date -AllMatches).Count
479+ gh release create "$Date.$Release" -R ${{ github.repository }}
480+ gh release upload "$Date.$Release" firebase-android-arm64-v8a.zip -R ${{ github.repository }}
481+ gh release upload "$Date.$Release" firebase-android-arm64-v8a.zip.sha256 -R ${{ github.repository }}
482+ gh release upload "$Date.$Release" firebase-android-x86_64.zip -R ${{ github.repository }}
483+ gh release upload "$Date.$Release" firebase-android-x86_64.zip.sha256 -R ${{ github.repository }}
484+
0 commit comments