From c6776073535759178f8c3afff9f69a2dc3946ec2 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Tue, 3 Sep 2024 15:22:05 -0700 Subject: [PATCH] github: Split Android CI to per ABI builds - Pulled the android continuous workflow into an action - Split the android continuous build into 3 ABIs armv7, armv8a, and x86_64 (note that x86 is not present). - Remove the upload artifacts step from previous workflow. This was meant for letting client try a tip-of-tree Android build. We can revisit this later. (Also removed mention in README.md) - Split the android continous into debug build and a release build commands, enabling deletion of intermediate output directory. --- .github/actions/android-continuous/action.yml | 17 +++++++ .github/workflows/android-continuous.yml | 47 ++++++++++--------- .github/workflows/presubmit.yml | 4 +- .github/workflows/release.yml | 2 +- README.md | 10 ---- build/android/build.sh | 22 ++++++--- 6 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 .github/actions/android-continuous/action.yml diff --git a/.github/actions/android-continuous/action.yml b/.github/actions/android-continuous/action.yml new file mode 100644 index 00000000000..ecf23fc5244 --- /dev/null +++ b/.github/actions/android-continuous/action.yml @@ -0,0 +1,17 @@ +name: 'Android Continuous' +inputs: + build-abi: + description: 'The target platform ABI' + required: true + default: 'armeabi-v7a' +runs: + using: "composite" + steps: + - uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + - name: Run build script + run: | + cd build/android && printf "y" | ./build.sh continuous ${{ inputs.build-abi }} + shell: bash diff --git a/.github/workflows/android-continuous.yml b/.github/workflows/android-continuous.yml index 9bcab7ae8e0..9ade2be0d0e 100644 --- a/.github/workflows/android-continuous.yml +++ b/.github/workflows/android-continuous.yml @@ -8,32 +8,35 @@ on: - rc/** jobs: - build-android: - name: build-android + build-android-armv7: + name: build-android-armv7 runs-on: macos-14 steps: - uses: actions/checkout@v4.1.6 - - uses: actions/setup-java@v3 + - name: Run Android Continuous + uses: ./.github/actions/android-continuous with: - distribution: 'temurin' - java-version: '17' - - name: Run build script - run: | - cd build/android && printf "y" | ./build.sh continuous - - uses: actions/upload-artifact@v1.0.0 - with: - name: filament-android - path: out/filament-android-release.aar - - uses: actions/upload-artifact@v1.0.0 - with: - name: filamat-android-full - path: out/filamat-android-release.aar - - uses: actions/upload-artifact@v1.0.0 + build-abi: armeabi-v7a + + build-android-armv8a: + name: build-android-armv8a + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4.1.6 + - name: Run Android Continuous + uses: ./.github/actions/android-continuous with: - name: gltfio-android-release - path: out/gltfio-android-release.aar - - uses: actions/upload-artifact@v1.0.0 + build-abi: arm64-v8a + + build-android-x86_64: + name: build-android-x86_64 + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4.1.6 + - name: Run Android Continuous + uses: ./.github/actions/android-continuous with: - name: filament-utils-android-release - path: out/filament-utils-android-release.aar + build-abi: x86_64 diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 3fa9918e7ef..c7a160ed982 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -49,8 +49,10 @@ jobs: distribution: 'temurin' java-version: '17' - name: Run build script + # Only build 1 64 bit target during presubmit to cut down build times during presubmit + # Continuous builds will build everything run: | - cd build/android && printf "y" | ./build.sh presubmit + cd build/android && printf "y" | ./build.sh presubmit arm64-v8a build-ios: name: build-iOS diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4b7239a1a5..4d070e50770 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,7 +120,7 @@ jobs: env: TAG: ${{ steps.git_ref.outputs.tag }} run: | - cd build/android && printf "y" | ./build.sh release + cd build/android && printf "y" | ./build.sh release armeabi-v7a,arm64-v8a,x86,x86_64 cd ../.. mv out/filament-android-release.aar out/filament-${TAG}-android.aar mv out/filamat-android-release.aar out/filamat-${TAG}-android.aar diff --git a/README.md b/README.md index f0e9ca349de..bc6b7db01a9 100644 --- a/README.md +++ b/README.md @@ -54,16 +54,6 @@ iOS projects can use CocoaPods to install the latest release: pod 'Filament', '~> 1.54.1' ``` -### Snapshots - -If you prefer to live on the edge, you can download a continuous build by following the following -steps: - -1. Find the [commit](https://github.com/google/filament/commits/main) you're interested in. -2. Click the green check mark under the commit message. -3. Click on the _Details_ link for the platform you're interested in. -4. On the top left click _Summary_, then in the _Artifacts_ section choose the desired artifact. - ## Documentation - [Filament](https://google.github.io/filament/Filament.html), an in-depth explanation of diff --git a/build/android/build.sh b/build/android/build.sh index 3eb0a98a44e..c9821b8fb43 100755 --- a/build/android/build.sh +++ b/build/android/build.sh @@ -60,13 +60,7 @@ if [[ ! -d "${ANDROID_HOME}/ndk/$FILAMENT_NDK_VERSION" ]]; then yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --licenses ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager "ndk;$FILAMENT_NDK_VERSION" fi - -# Only build 1 64 bit target during presubmit to cut down build times during presubmit -# Continuous builds will build everything ANDROID_ABIS= -if [[ "$TARGET" == "presubmit" ]]; then - ANDROID_ABIS="-q arm64-v8a" -fi # Build the Android sample-gltf-viewer APK during release. BUILD_SAMPLES= @@ -74,5 +68,19 @@ if [[ "$TARGET" == "release" ]]; then BUILD_SAMPLES="-k sample-gltf-viewer" fi +function build_android() { + local ABI=$1 + + # Do the following in two steps so that we do not run out of space + if [[ -n "${BUILD_DEBUG}" ]]; then + FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION} ./build.sh -p android -q ${ABI} -c ${BUILD_SAMPLES} ${GENERATE_ARCHIVES} ${BUILD_DEBUG} + rm -rf out/cmake-android-debug-* + fi + if [[ -n "${BUILD_RELEASE}" ]]; then + FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION} ./build.sh -p android -q ${ABI} -c ${BUILD_SAMPLES} ${GENERATE_ARCHIVES} ${BUILD_RELEASE} + rm -rf out/cmake-android-release-* + fi +} + pushd `dirname $0`/../.. > /dev/null -FILAMENT_NDK_VERSION=${FILAMENT_NDK_VERSION} ./build.sh -p android $ANDROID_ABIS -c $BUILD_SAMPLES $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE +build_android $2