From e7796b870259e8cdcfb11fdc1967ec96ffc0b0e2 Mon Sep 17 00:00:00 2001 From: Keeyou Date: Thu, 31 Oct 2024 11:25:24 +0800 Subject: [PATCH] Reapply "gh actions: silence missing tzdata warning on android build" This reverts commit 5c2b1cefd5ccfaf7be1e72870e8d0eb19265e3a8. --- .github/workflows/releases-android-binary.yml | 9 +++++++-- scripts/get-android-sys.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/releases-android-binary.yml b/.github/workflows/releases-android-binary.yml index f0be3aa65..66fcb1f71 100644 --- a/.github/workflows/releases-android-binary.yml +++ b/.github/workflows/releases-android-binary.yml @@ -119,7 +119,7 @@ jobs: with: path: | ${{ env.SYSROOT }} - key: android-sysroot-${{ matrix.arch }}-v1 + key: android-sysroot-${{ matrix.arch }}-v1-with-tzdata - uses: actions/setup-go@v5 with: go-version: '>=1.20.0' @@ -194,19 +194,24 @@ jobs: if: ${{ matrix.arch == 'x86' || matrix.arch == 'x64' }} run: | # android sysimg doesn't like resolv.conf - mkdir -p $SYSROOT/etc/ssl/certs $SYSROOT/dev $SYSROOT/proc $SYSROOT/data/local/tmp + mkdir -p $SYSROOT/sys $SYSROOT/etc/ssl/certs $SYSROOT/dev $SYSROOT/proc $SYSROOT/data/local/tmp bwrap --die-with-parent --ro-bind $SYSROOT / \ --ro-bind /sys /sys \ --ro-bind /etc/ssl/certs /etc/ssl/certs \ --proc /proc --dev /dev \ --unshare-all --share-net \ --bind $PWD/build-android${{ matrix.apilevel }}-${{ matrix.arch }} /data/local/tmp \ + --setenv ANDROID_DATA /data \ + --setenv ANDROID_ROOT /system \ + --setenv TMPDIR /data/local/tmp \ /data/local/tmp/yass_test - name: Run tests (non x86, under qemu emulation) if: ${{ matrix.arch != 'x86' && matrix.arch != 'x64' }} run: | # TMPDIR is required by leveldb unittests qemu-${{ matrix.qemu_suffix }} -L $SYSROOT \ + -E ANDROID_DATA=$SYSROOT/data \ + -E ANDROID_ROOT=$SYSROOT/system \ -E TMPDIR=$PWD/build-android${{ matrix.apilevel }}-${{ matrix.arch }} \ $PWD/build-android${{ matrix.apilevel }}-${{ matrix.arch }}/yass_test - name: Install the Release certificate diff --git a/scripts/get-android-sys.sh b/scripts/get-android-sys.sh index 359d1b788..4c5f5614b 100755 --- a/scripts/get-android-sys.sh +++ b/scripts/get-android-sys.sh @@ -25,11 +25,13 @@ if [ "$WITH_ANDROID_IMG" -a ! -d out/sysroot-build/android/"$WITH_ANDROID_IMG"/s curl -O https://dl.google.com/android/repository/sys-img/android/$WITH_ANDROID_IMG.zip mkdir -p $WITH_ANDROID_IMG/mount unzip $WITH_ANDROID_IMG.zip '*/system.img' -d $WITH_ANDROID_IMG - sudo mount $WITH_ANDROID_IMG/*/system.img $WITH_ANDROID_IMG/mount + sudo mount -o ro $WITH_ANDROID_IMG/*/system.img $WITH_ANDROID_IMG/mount mkdir -p $SYSROOT/system/bin $SYSROOT/system/etc - cp $WITH_ANDROID_IMG/mount/bin/linker* $SYSROOT/system/bin - cp $WITH_ANDROID_IMG/mount/etc/hosts $SYSROOT/system/etc - cp -r $WITH_ANDROID_IMG/mount/lib* $SYSROOT/system + cp -v $WITH_ANDROID_IMG/mount/bin/linker* $SYSROOT/system/bin + cp -v $WITH_ANDROID_IMG/mount/etc/hosts $SYSROOT/system/etc + cp -rv $WITH_ANDROID_IMG/mount/lib* $SYSROOT/system + mkdir -p $SYSROOT/system/usr/share + cp -rv $WITH_ANDROID_IMG/mount/usr/share/zoneinfo $SYSROOT/system/usr/share/ sudo umount $WITH_ANDROID_IMG/mount rm -rf $WITH_ANDROID_IMG $WITH_ANDROID_IMG.zip fi