From 22c789a14f7486adeaeff8fc020a0fd8c9174732 Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Mon, 7 Oct 2024 22:46:30 +0200 Subject: [PATCH] Use 16-core GitHub runner Android (#2891) --- .github/actionlint.yaml | 1 + .../action.yml | 25 +++ .github/workflows/android-ci.yml | 153 +++++------------- 3 files changed, 67 insertions(+), 112 deletions(-) create mode 100644 .github/actions/android-build-and-upload-render-test/action.yml diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 2754253c8a8..5a690e9a9dc 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -4,6 +4,7 @@ self-hosted-runner: - macos-14 # can be removed once actionlint is updated - ubuntu-24.04 # can be removed once actionlint is updated - MapLibre_Native_Ubuntu_22_04_ARM_8_core + - MapLibre_Native_Ubuntu_24_04_x84_16_core # Configuration variables in array of strings defined in your repository or # organization. `null` means disabling configuration variables check. # Empty array means no configuration variable is allowed. diff --git a/.github/actions/android-build-and-upload-render-test/action.yml b/.github/actions/android-build-and-upload-render-test/action.yml new file mode 100644 index 00000000000..c61ea9ec119 --- /dev/null +++ b/.github/actions/android-build-and-upload-render-test/action.yml @@ -0,0 +1,25 @@ +name: Build and Upload APKs +description: Build the APK and Android test APK for a given flavor, and upload them as artifacts +inputs: + flavor: + description: 'The build flavor (e.g., opengl, vulkan)' + required: true +runs: + using: "composite" + steps: + - name: Build APK and Android Test APK for ${{ inputs.flavor }} + shell: bash + run: | + ./gradlew assemble${{ inputs.flavor }} assemble${{ inputs.flavor }}AndroidTest + cp app/build/outputs/apk/${{ inputs.flavor }}/release/app-${{ inputs.flavor }}-release.apk RenderTestsApp-${{ inputs.flavor }}.apk + cp app/build/outputs/apk/androidTest/${{ inputs.flavor }}/release/app-${{ inputs.flavor }}-release-androidTest.apk RenderTests-${{ inputs.flavor }}.apk + working-directory: ./render-test/android + + - name: Upload APK files for ${{ inputs.flavor }} + uses: actions/upload-artifact@v4 + with: + name: android-render-tests-${{ inputs.flavor }} + if-no-files-found: error + path: | + ./render-test/android/RenderTestsApp-${{ inputs.flavor }}.apk + ./render-test/android/RenderTests-${{ inputs.flavor }}.apk \ No newline at end of file diff --git a/.github/workflows/android-ci.yml b/.github/workflows/android-ci.yml index 5477d63c1e1..47d23a34d90 100644 --- a/.github/workflows/android-ci.yml +++ b/.github/workflows/android-ci.yml @@ -35,7 +35,7 @@ jobs: files_yaml_from_source_file: .github/changed-files.yml android-build: - runs-on: ubuntu-22.04 + runs-on: MapLibre_Native_Ubuntu_24_04_x84_16_core needs: - pre_job if: needs.pre_job.outputs.should_skip != 'true' @@ -48,18 +48,6 @@ jobs: IS_LOCAL_DEVELOPMENT: false MLN_ANDROID_STL: c++_static steps: - - name: Free Disk Space (Ubuntu) - if: startsWith(runner.name, 'GitHub Actions') - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: false - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false - - uses: actions/checkout@v4 with: submodules: recursive @@ -72,6 +60,12 @@ jobs: distribution: "temurin" java-version: "17" + - name: Get CMake and Ninja + uses: lukka/get-cmake@latest + with: + cmakeVersion: 3.24.1 + ninjaVersion: latest + - name: Cache node modules uses: actions/cache@v4 env: @@ -96,14 +90,20 @@ jobs: run: node platform/android/scripts/generate-style-code.mjs working-directory: . - - uses: pre-commit/action@v3.0.1 + - run: | + python3 -m venv venv + source venv/bin/activate + pip3 install pre-commit + + - run: | + source venv/bin/activate + pre-commit run clang-format --all-files continue-on-error: true # this can mean files are modified, which is not an error - with: - extra_args: clang-format --all-files - - uses: pre-commit/action@v3.0.1 - with: - extra_args: clang-format --all-files + - run: | + source venv/bin/activate + pre-commit run clang-format --all-files + rm -rf venv - uses: infotroph/tree-is-clean@v1 with: @@ -178,105 +178,35 @@ jobs: platform/android/InstrumentationTestApp.apk platform/android/InstrumentationTests.apk - android-build-cpp-test: - runs-on: ubuntu-24.04 - needs: - - pre_job - if: needs.pre_job.outputs.should_skip != 'true' - defaults: - run: - working-directory: test/android - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: "17" - - - name: Get CMake and Ninja - uses: lukka/get-cmake@latest - with: - cmakeVersion: 3.24.1 - ninjaVersion: latest - - - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.job }} - - - name: Create data.zip in assets directory - run: zip -r test/android/app/src/main/assets/data.zip -@ < test/android/app/src/main/assets/to_zip.txt - working-directory: . - - - name: Build C++ Unit Tests App - run: | - ./gradlew assembleDebug assembleAndroidTest - cp app/build/outputs/apk/debug/app-debug.apk . - cp app/build/outputs/apk/androidTest/release/app-release-androidTest.apk . - - - name: Store C++ Unit Tests .apk files - uses: actions/upload-artifact@v4 - with: - name: android-cpp-tests - if-no-files-found: error - path: | - ./test/android/app-debug.apk - ./test/android/app-release-androidTest.apk - - android-build-render-test: - strategy: - fail-fast: false - matrix: - flavor: [opengl, vulkan] - runs-on: ubuntu-latest - needs: - - pre_job - if: needs.pre_job.outputs.should_skip != 'true' - steps: - - name: Free Disk Space (Ubuntu) - if: startsWith(runner.name, 'GitHub Actions') - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: false - dotnet: true - haskell: true - large-packages: true - docker-images: true - swap-storage: false - - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.job }} - - - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: "17" + - name: Create data.zip in assets directory + run: zip -r test/android/app/src/main/assets/data.zip -@ < test/android/app/src/main/assets/to_zip.txt + working-directory: . - - name: Build Render Test App + - name: Build C++ Unit Tests App + working-directory: test/android run: | - ./gradlew assemble${{ matrix.flavor }} assemble${{ matrix.flavor }}AndroidTest - cp app/build/outputs/apk/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.apk RenderTestsApp-${{ matrix.flavor }}.apk - cp app/build/outputs/apk/androidTest/${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release-androidTest.apk RenderTests-${{ matrix.flavor }}.apk - working-directory: ./render-test/android + ./gradlew assembleDebug assembleAndroidTest + cp app/build/outputs/apk/debug/app-debug.apk . + cp app/build/outputs/apk/androidTest/release/app-release-androidTest.apk . - - name: Store Render Test .apk files + - name: Store C++ Unit Tests .apk files uses: actions/upload-artifact@v4 with: - name: android-render-tests-${{ matrix.flavor }} + name: android-cpp-tests if-no-files-found: error path: | - ./render-test/android/RenderTestsApp-${{ matrix.flavor }}.apk - ./render-test/android/RenderTests-${{ matrix.flavor }}.apk + ./test/android/app-debug.apk + ./test/android/app-release-androidTest.apk + + - name: Build and Upload Render Test APKs for OpenGL + uses: ./.github/actions/android-build-and-upload-render-test + with: + flavor: opengl + + - name: Build and Upload Render Test APKs for Vulkan + uses: ./.github/actions/android-build-and-upload-render-test + with: + flavor: vulkan android-ci-result: runs-on: ubuntu-latest @@ -284,7 +214,6 @@ jobs: needs: - pre_job - android-build - - android-build-render-test steps: - name: Mark result as failed if: needs.android-build.result != 'success'