Skip to content

Commit b8fdb14

Browse files
passyfacebook-github-bot
authored andcommitted
Add library verification step (facebook#3436)
Summary: This is pretty dumb but hopefully good enough to prevent accidental regressions. We simply check if there are "enough" `libevent_core.so`s in the bundle. This is obviously not future-proof but it's super cheap to run and if it causes problems at some point, we can always remove it. Apologies for the formatting spam. Didn't notice until I submitted this that my editor got a little passive-aggressive. Pull Request resolved: facebook#3436 Test Plan: CI here. Reviewed By: lblasa Differential Revision: D34210743 Pulled By: passy fbshipit-source-id: a57c397e39456fae33af9f3ceed08b6944eac79e
1 parent 05b1575 commit b8fdb14

File tree

2 files changed

+45
-25
lines changed

2 files changed

+45
-25
lines changed

.github/workflows/android-sample.yml

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
1-
name: Build Sample App
1+
name: Build Android Sample App
22

33
on: [push, pull_request]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98

109
steps:
11-
- uses: actions/checkout@v2
12-
- name: set up JDK
13-
uses: actions/setup-java@v1
14-
with:
15-
java-version: 11
16-
- name: Compute build cache
17-
run: ./scripts/checksum-android.sh checksum-android.txt
18-
- uses: actions/cache@v2
19-
with:
20-
path: |
21-
~/.gradle/caches/modules-*
22-
~/.gradle/caches/jars-*
23-
~/.gradle/caches/build-cache-*
24-
key: gradle-${{ hashFiles('checksum-android.txt') }}
25-
- name: Build sample apps with Gradle
26-
run: ./gradlew :sample:assembleDebug :tutorial:assembleDebug
27-
- name: Build remaining artifacts with Gradle
28-
run: ./gradlew assembleDebug
29-
- name: upload artifact
30-
uses: actions/upload-artifact@v1
31-
with:
32-
name: sample-app.apk
33-
path: android/sample/build/outputs/apk/debug/sample-debug.apk
10+
- uses: actions/checkout@v2
11+
- name: set up JDK
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 11
15+
- name: Compute build cache
16+
run: ./scripts/checksum-android.sh checksum-android.txt
17+
- uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/.gradle/caches/modules-*
21+
~/.gradle/caches/jars-*
22+
~/.gradle/caches/build-cache-*
23+
key: gradle-${{ hashFiles('checksum-android.txt') }}
24+
- name: Build debug artifact
25+
run: ./gradlew :android:assembleDebug
26+
- name: Verify libraries in artifact
27+
run: scripts/verify-android-libraries.sh
28+
- name: Build sample apps with Gradle
29+
run: ./gradlew :sample:assembleDebug :tutorial:assembleDebug
30+
- name: Build remaining artifacts with Gradle
31+
run: ./gradlew assembleDebug
32+
- name: upload artifact
33+
uses: actions/upload-artifact@v1
34+
with:
35+
name: sample-app.apk
36+
path: android/sample/build/outputs/apk/debug/sample-debug.apk

scripts/verify-android-libraries.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
#
4+
# This source code is licensed under the MIT license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
8+
NUM=$(unzip -l "$BASEDIR"/android/build/outputs/aar/android-debug.aar | grep -c libevent_core)
9+
10+
if (( NUM >= 4 )); then
11+
echo "Found $NUM instances of libevent_core. Looks good."
12+
exit 0
13+
else
14+
unzip -l "$BASEDIR"/android/build/outputs/aar/android-debug.aar | grep libevent_core
15+
echo "Expected 4 but found $NUM libevent_core.so files. Expecting one for each architecture. See #3395 for details."
16+
exit 1
17+
fi

0 commit comments

Comments
 (0)