Skip to content

Commit 2449ca9

Browse files
committed
GHA: add Android builds for firebase-cpp-sdk
Introduce the Android builds so that we could start exploring the use of firebase on Android native code.
1 parent f6d6ee2 commit 2449ca9

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/bcny-firebase.yml

+105
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55

66
jobs:
77
windows:
8+
if: false
9+
810
runs-on: windows-latest
911

1012
strategy:
@@ -288,3 +290,106 @@ jobs:
288290
$pkgs = Get-ChildItem -Path com.google.firebase.windows.${{ matrix.arch }}.*.nupkg
289291
nuget push $pkgs[0].Name -Source ${env:NUGET_SOURCE_URL} -SkipDuplicate
290292
shell: pwsh
293+
294+
android:
295+
runs-on: windows-latest
296+
297+
strategy:
298+
fail-fast: false
299+
matrix:
300+
include:
301+
- arch: 'aarch64'
302+
platform: 'arm64-v8a'
303+
304+
steps:
305+
- uses: actions/checkout@v3
306+
with:
307+
fetch-depth: 1
308+
path: ${{ github.workspace }}/SourceCache/flatbuffers
309+
ref: 99aa1ef21dd9dc3f9d4fb0eb82f4b59d0bb5e4c5
310+
repository: google/flatbuffers
311+
312+
- uses: actions/checkout@v3
313+
with:
314+
fetch-depth: 1
315+
path: ${{ github.workspace }}/SourceCache/firebase-cpp-sdk
316+
ref: refs/heads/compnerd/swift
317+
repository: thebrowsercompany/firebase-cpp-sdk
318+
319+
# NOTE(compnerd) we use setup-vsdevenv to get CMake and Ninja into `Path`
320+
- uses: compnerd/gha-setup-vsdevenv@main
321+
with:
322+
host_arch: amd64
323+
324+
- uses: actions/setup-python@v4
325+
id: python
326+
with:
327+
python-version: 3.9
328+
architecture: 'x64'
329+
330+
- name: Install absl-py
331+
run: pip install absl-py
332+
333+
- name: Configure flatbuffers
334+
run:
335+
cmake -B ${{ github.workspace }}/BinaryCache/flatbuffers `
336+
-D CMAKE_BUILD_TYPE=Release `
337+
-G "Visual Studio 17 2022" `
338+
-A x64 `
339+
-S ${{ github.workspace }}/SourceCache/flatbuffers
340+
- name: Build flatc
341+
run: cmake --build ${{ github.workspace }}/BinaryCache/flatbuffers --config Release --target flatc
342+
343+
- uses: actions/setup-java@v3
344+
with:
345+
distribution: 'temurin'
346+
java-version: '21'
347+
348+
- uses: android-actions/setup-android@v3
349+
350+
- name: Configure firebase
351+
run: |
352+
$ANDROID_NDK_ROOT = cygpath -m $env:ANDROID_NDK
353+
354+
cmake -B ${{ github.workspace }}/BinaryCache/firebase `
355+
-D BUILD_SHARED_LIBS=NO `
356+
-D CMAKE_BUILD_TYPE=RelWithDebInfo `
357+
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/BuildRoot/Library/firebase/usr `
358+
-D CMAKE_MAKE_PROGRAM=$((Get-Command Ninja).Source) `
359+
-D CMAKE_SYSTEM_NAME=Android `
360+
-D CMAKE_ANDROID_API=28 `
361+
-D CMAKE_ANDROID_ARCH_ABI=${{ matrix.platform }} `
362+
-D CMAKE_ANDROID_NDK=$ANDROID_NDK_ROOT `
363+
-G Ninja `
364+
-S ${{ github.workspace }}/SourceCache/firebase-cpp-sdk `
365+
-D FLATBUFFERS_BUILD_FLATC=NO `
366+
-D FIREBASE_CPP_BUILD_PACKAGE=YES `
367+
-D FIREBASE_GITHUB_ACTION_BUILD=YES `
368+
-D FIREBASE_INCLUDE_LIBRARY_DEFAULT=OFF `
369+
-D FIREBASE_INCLUDE_AUTH=YES `
370+
-D FIREBASE_INCLUDE_FIRESTORE=YES `
371+
-D FIREBASE_USE_BORINGSSL=YES `
372+
-D FIREBASE_PYTHON_HOST_EXECUTABLE:FILEPATH=${{ steps.python.outputs.python-path }} `
373+
-D FLATBUFFERS_FLATC_EXECUTABLE=${{ github.workspace }}/BinaryCache/flatbuffers/Release/flatc.exe
374+
- name: Build firebase
375+
run: cmake --build ${{ github.workspace }}/BinaryCache/firebase
376+
- name: Install firebase
377+
run: cmake --build ${{ github.workspace }}/BinaryCache/firebase --target install
378+
- name: Install firebase (manual)
379+
run: |
380+
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/firestore_errors.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/firestore_errors.h"
381+
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/geo_point.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/geo_point.h"
382+
Copy-Item "${{ github.workspace }}/BinaryCache/firebase/external/src/firestore/Firestore/core/include/firebase/firestore/timestamp.h" "${{ github.workspace }}/BuildRoot/Library/firebase/usr/include/firebase/firestore/timestamp.h"
383+
384+
Write-Host "Copying static libraries ..."
385+
$source = "${{ github.workspace }}/BinaryCache/firebase"
386+
$libraries = Get-ChildItem -Path $source -File -Recurse -Filter *.a
387+
foreach ($library in $libraries) {
388+
$destination = Join-Path -Path "${{ github.workspace }}/BuildRoot/Library/firebase/usr/libs/android" -ChildPath $library.Name
389+
Copy-Item -Path $library.FullName -Destination $destination -Force
390+
Write-Host "... copied ${destination}"
391+
}
392+
- uses: actions/upload-artifact@v3
393+
with:
394+
name: firebase-android-${{ matrix.arch }}
395+
path: ${{ github.workspace }}/BuildRoot/Library/firebase

0 commit comments

Comments
 (0)