# Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT name: Android on: push: pull_request: concurrency: group: ${{ github.ref }}-android cancel-in-progress: true env: CMAKE_DEFAULT_FLAGS: "-DCMAKE_BUILD_TYPE=DEBUG -DCARES_STATIC=ON -DCARES_STATIC_PIC=ON -G Ninja -DANDROID_PLATFORM=android-23" MAKE: make jobs: build: runs-on: ubuntu-latest name: "Android" steps: - name: Install packages uses: awalsh128/cache-apt-pkgs-action@latest with: packages: cmake ninja-build autoconf automake libtool pkg-config version: 1.0 - name: Checkout c-ares uses: actions/checkout@v4 - name: Setup NDK uses: nttld/setup-ndk@v1 id: setup-ndk with: ndk-version: r21e add-to-path: false - name: "CMake: armeabi-v7a build c-ares" env: BUILD_TYPE: CMAKE CMAKE_FLAGS: "${{ env.CMAKE_DEFAULT_FLAGS }} -DANDROID_ABI=armeabi-v7a -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" run: | ./ci/build.sh - name: "CMake: arm64-v8a build c-ares" env: BUILD_TYPE: CMAKE CMAKE_FLAGS: "${{ env.CMAKE_DEFAULT_FLAGS }} -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" run: | ./ci/build.sh - name: "CMake: x86 build c-ares" env: BUILD_TYPE: CMAKE CMAKE_FLAGS: "${{ env.CMAKE_DEFAULT_FLAGS }} -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" run: | ./ci/build.sh - name: "CMake: x86_64 build c-ares" env: BUILD_TYPE: CMAKE CMAKE_FLAGS: "${{ env.CMAKE_DEFAULT_FLAGS }} -DANDROID_ABI=x86_64 -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" run: | ./ci/build.sh - name: "Autotools: aarch64 build c-ares" env: BUILD_TYPE: autotools TOOLCHAIN: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64" TARGET: aarch64-linux-android API: 23 AR: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" CC: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android23" AS: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android23" CXX: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-linux-android23" LD: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/ld" RANLIB: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib" STRIP: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip" CONFIG_OPTS: "--host aarch64-linux-android --disable-shared" run: | ./ci/build.sh