From 76b70c383c4e4793636da77eef2aa1e969cde867 Mon Sep 17 00:00:00 2001 From: zyphlar Date: Sun, 18 Jan 2026 07:12:46 +0100 Subject: [PATCH] [ci] Fix android-check action (#3242) Co-authored-by: x7z4w Reviewed-on: https://codeberg.org/comaps/comaps/pulls/3242 Reviewed-by: x7z4w Signed-off-by: zyphlar Co-authored-by: zyphlar Co-committed-by: zyphlar --- .forgejo/workflows/android-check.yaml | 87 +++++++++++++++++++++------ android/sdk/build.gradle | 2 +- 2 files changed, 71 insertions(+), 18 deletions(-) diff --git a/.forgejo/workflows/android-check.yaml b/.forgejo/workflows/android-check.yaml index de191b613..c229c8cf2 100644 --- a/.forgejo/workflows/android-check.yaml +++ b/.forgejo/workflows/android-check.yaml @@ -34,19 +34,63 @@ on: - track_generator/** - xcode/** +env: + SUBMODULE_CACHE_PATHS: | + .git/modules + 3party/CMake-MetalShaderSupport + 3party/Vulkan-Headers + 3party/boost + 3party/expat + 3party/fast_double_parser + 3party/fast_obj + 3party/freetype/freetype + 3party/gflags + 3party/glaze + 3party/glfw + 3party/glm + 3party/googletest + 3party/harfbuzz/harfbuzz + 3party/icu/icu + 3party/imgui/imgui + 3party/jansson/jansson + 3party/just_gtfs + 3party/protobuf/protobuf + 3party/pugixml/pugixml + 3party/utfcpp + tools/kothic + tools/osmctools + jobs: lint: name: Android Lint runs-on: ubuntu-latest + container: + image: codeberg.org/comaps/docker-android-sdk:ubuntu-standalone-zy-docker + options: --user root steps: - name: Checkout sources uses: actions/checkout@v4 with: fetch-depth: 1 - - name: Parallel submodules checkout + - name: Cache world map + uses: actions/cache@v4 + with: + path: data/world_mwm + key: world-mwm + + - uses: actions/cache@v4 + with: + path: ${{ env.SUBMODULE_CACHE_PATHS }} + key: submodules-${{ hashFiles('.gitmodules') }} + restore-keys: | + submodules- + + - name: Sync and update submodules shell: bash - run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) + run: | + git submodule sync --recursive + git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) - name: Lint shell: bash @@ -56,6 +100,9 @@ jobs: android-check: name: Build Android Debug runs-on: ubuntu-latest + container: + image: codeberg.org/comaps/docker-android-sdk:ubuntu-standalone-zy-docker + options: --user root strategy: fail-fast: false matrix: @@ -71,23 +118,32 @@ jobs: cancel-in-progress: true steps: - - name: Install build tools and dependencies - shell: bash - run: | - sudo apt-get update -y - sudo apt-get install -y ninja-build - - name: Checkout sources uses: actions/checkout@v4 with: fetch-depth: 200 # enough to get all commits for the current day - - name: Parallel submodules checkout + - name: Cache world map + uses: actions/cache@v4 + with: + path: data/world_mwm + key: world-mwm + + - uses: actions/cache@v4 + with: + path: ${{ env.SUBMODULE_CACHE_PATHS }} + key: submodules-${{ hashFiles('.gitmodules') }} + restore-keys: | + submodules- + + - name: Sync and update submodules shell: bash - run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) + run: | + git submodule sync --recursive + git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) - name: Configure ccache - uses: hendrikmuhs/ccache-action@v1.2 + uses: https://github.com/hendrikmuhs/ccache-action@v1.2 with: key: ${{ github.workflow }}-${{ matrix.flavor }} @@ -97,14 +153,11 @@ jobs: env: CMAKE_C_COMPILER_LAUNCHER: ccache CMAKE_CXX_COMPILER_LAUNCHER: ccache - run: | - cmake --version - ninja --version - ./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }} + run: ./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }} - name: Upload ${{ matrix.flavor }} apk - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 with: name: android-${{ matrix.flavor }} - path: android/app/build/outputs/apk/**/OrganicMaps-*.apk + path: android/app/build/outputs/apk/**/*.apk if-no-files-found: error diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle index b85c933ea..721f7d3eb 100644 --- a/android/sdk/build.gradle +++ b/android/sdk/build.gradle @@ -153,7 +153,7 @@ project.afterEvaluate { final taskName = gradle.startParameter.taskNames - if (['assemble', 'bundle', 'compile', 'install', 'run', 'publish'].any{taskName.any{task->task.startsWith(it)}}) { + if (['assemble', 'bundle', 'compile', 'install', 'lint', 'publish', 'run'].any{taskName.any{task->task.startsWith(it)}}) { exec { workingDir '../..'