Skip to content

Commit

Permalink
[Android][ci] Separate Android client build from the Android Manager …
Browse files Browse the repository at this point in the history
…build to speed-up CI

Signed-off-by: Vitalii Koshura <[email protected]>
  • Loading branch information
AenBleidd committed Aug 11, 2023
1 parent 0880aea commit 86df1fc
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 42 deletions.
180 changes: 147 additions & 33 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ env:
AWS_DEFAULT_REGION: us-west-2

jobs:
build:
name: ${{ matrix.type }}-build
build-client:
name: client-${{ matrix.type }}-build
runs-on: ubuntu-latest
strategy:
matrix:
type: [manager, libs, apps, libs-cmake]
type: [armv6, arm, arm64, x86, x86_64]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -53,6 +53,84 @@ jobs:
sudo apt-get -qq update
sudo apt-get install -y libncurses5
- name: Check if build is running from origin repo
if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }}
run: |
echo "VCPKG_BINARY_SOURCES=clear;x-aws,s3://vcpkg.cache.boinc/,readwrite" >> $GITHUB_ENV
- name: Check if build is running from fork
if: ${{ success() && (env.AWS_ACCESS_KEY_ID == 0 || env.AWS_SECRET_ACCESS_KEY == 0) }}
run: |
echo "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg.cache.boinc/,read" >> $GITHUB_ENV
- name: Unset ANDROID_NDK_ROOT environment variable
if: ${{ success() }}
run: |
echo ANDROID_NDK_ROOT="" >> $GITHUB_ENV
- name: Build client with vcpkg
if: ${{ success() }}
run: ./android/ci_build_vcpkg_client.sh --arch ${{ matrix.type }}

- name: Prepare logs on failure
if: ${{ failure() }}
run: python ./deploy/prepare_deployment.py logs

- name: Upload logs on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: android_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/logs.7z

- name: Upload client on success
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: android_client_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

build-manager:
name: manager-build
runs-on: ubuntu-latest
needs: build-client
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Download armv6 client
uses: actions/download-artifact@v3
with:
name: android_client_armv6_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

- name: Download arm client
uses: actions/download-artifact@v3
with:
name: android_client_arm_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

- name: Download arm64 client
uses: actions/download-artifact@v3
with:
name: android_client_arm64_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

- name: Download x86 client
uses: actions/download-artifact@v3
with:
name: android_client_x86_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

- name: Download x86_64 client
uses: actions/download-artifact@v3
with:
name: android_client_x86_64_${{ github.event.pull_request.head.sha }}
path: android/BOINC/app/src/main/assets/

- name: Setup Java
uses: actions/setup-java@v3
with:
Expand All @@ -62,6 +140,72 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Build manager with vcpkg
run: ./android/ci_build_vcpkg_manager.sh --skip-client-build

- name: Prepare logs on failure
if: ${{ failure() }}
run: python ./deploy/prepare_deployment.py logs

- name: Upload logs on failure
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: android_logs_manager_${{ github.event.pull_request.head.sha }}
path: deploy/logs.7z

- name: Prepare artifacts for deploy
run: python ./deploy/prepare_deployment.py android_manager

- name: Upload generic artifacts
uses: actions/upload-artifact@v3
with:
name: android_manager_${{ github.event.pull_request.head.sha }}
path: deploy/android_manager.7z

- name: Upload xiaomi manager
uses: actions/upload-artifact@v3
with:
name: android_xiaomi_manager_${{ github.event.pull_request.head.sha }}
path: deploy/android_manager_xiaomi.7z

- name: Upload armv6 only manager
uses: actions/upload-artifact@v3
with:
name: android_armv6_manager_${{ github.event.pull_request.head.sha }}
path: deploy/android_manager_armv6.7z

- name: Upload JUnit Tests Results
uses: actions/upload-artifact@v3
if: always()
with:
name: Android_tests_results
path: android/BOINC/app/build/test-results/testDebugUnitTest/TEST-*.xml

- name: Upload coverage report
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
verbose: false

build:
name: ${{ matrix.type }}-build
runs-on: ubuntu-latest
strategy:
matrix:
type: [libs, apps, libs-cmake]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install dependencies
run: |
sudo add-apt-repository universe
sudo apt-get -qq update
sudo apt-get install -y libncurses5
- name: Check if build is running from origin repo
if: ${{ success() && env.AWS_ACCESS_KEY_ID != 0 && env.AWS_SECRET_ACCESS_KEY != 0 }}
run: |
Expand All @@ -77,10 +221,6 @@ jobs:
run: |
echo ANDROID_NDK_ROOT="" >> $GITHUB_ENV
- name: Build manager with vcpkg
if: ${{ success() && matrix.type == 'manager' }}
run: ./android/ci_build_vcpkg_manager.sh

- name: Build libs with vcpkg
if: ${{ success() && matrix.type == 'libs' }}
run: ./android/ci_build_vcpkg_libraries.sh
Expand Down Expand Up @@ -114,29 +254,3 @@ jobs:
with:
name: android_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/android_${{ matrix.type }}.7z
- name: Upload xiaomi manager
uses: actions/upload-artifact@v3
if: ${{ contains(matrix.type, 'manager') }}
with:
name: android_xiaomi_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/android_${{ matrix.type }}_xiaomi.7z
- name: Upload armv6 only manager
uses: actions/upload-artifact@v3
if: ${{ contains(matrix.type, 'manager') }}
with:
name: android_armv6_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/android_${{ matrix.type }}_armv6.7z

- name: Upload JUnit Tests Results
uses: actions/upload-artifact@v3
if: always() && matrix.type == 'manager' # run this step even if previous step failed
with:
name: Android_tests_results
path: android/BOINC/app/build/test-results/testDebugUnitTest/TEST-*.xml

- name: Upload coverage report
uses: codecov/codecov-action@v3
if: ${{ success() && matrix.type == 'manager' }}
with:
fail_ci_if_error: true
verbose: false
19 changes: 14 additions & 5 deletions android/build_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fi

ci=""
component=""
arch=""

while [ $# -gt 0 ]; do
key="$1"
Expand All @@ -26,6 +27,10 @@ while [ $# -gt 0 ]; do
component=$2
shift
;;
--arch)
arch=$2
shift
;;
*)
echo "unrecognized option $key"
;;
Expand All @@ -42,10 +47,14 @@ cd android

rm -rf /tmp/vcpkg_updated

./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch armv6
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch arm
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch arm64
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch x86
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch x86_64
if [ "x$arch" = "x" ]; then
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch armv6
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch arm
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch arm64
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch x86
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch x86_64
else
./buildAndroidBOINC-CI.sh --cache_dir "$ANDROID_TC" --build_dir "$BUILD_DIR" --silent $ci --component $component --arch $arch
fi

cd ..
28 changes: 25 additions & 3 deletions android/ci_build_vcpkg_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ if [ ! -d "android" ]; then
exit 1
fi

echo '===== BOINC Client for all platforms build start ====='
android/build_component.sh --ci --component client
echo '===== BOINC Client for all platforms build done ====='
arch=""

while [ $# -gt 0 ]; do
key="$1"
case $key in
--arch)
arch=$2
shift
;;
*)
echo "unrecognized option $key"
;;
esac
shift # past argument or value
done

if [ "x$arch" = "x" ]; then
echo '===== BOINC Client for all platforms build start ====='
android/build_component.sh --ci --component client
echo '===== BOINC Client for all platforms build done ====='
else
echo '===== BOINC Client for '$arch' build start ====='
android/build_component.sh --ci --component client --arch $arch
echo '===== BOINC Client for '$arch' build done ====='
fi
18 changes: 17 additions & 1 deletion android/ci_build_vcpkg_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@ if [ ! -d "android" ]; then
exit 1
fi

android/ci_build_vcpkg_client.sh
skip_client_build=""
while [ $# -gt 0 ]; do
key="$1"
case $key in
--skip-client-build)
skip_client_build="yes"
;;
*)
echo "unrecognized option $key"
;;
esac
shift # past argument or value
done

if [ "x$skip_client_build" = "x" ]; then
android/ci_build_vcpkg_client.sh
fi

cd android/BOINC

Expand Down

0 comments on commit 86df1fc

Please sign in to comment.