CI: Add Android automated building with GitHub Actions (#843)

Authored-By: Brad House (@bradh352)
pull/846/head
Brad House 4 months ago committed by GitHub
parent d693951067
commit 4f2f3427e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 73
      .github/workflows/android.yml
  2. 12
      configure.ac

@ -0,0 +1,73 @@
# 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-26"
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: 26
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-android26"
AS: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-linux-android26"
CXX: "${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-linux-android26"
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

@ -245,8 +245,18 @@ AC_SUBST(CARES_SYMBOL_HIDING_CFLAG)
if test "$enable_warnings" = "yes"; then
AX_APPEND_COMPILE_FLAGS([-std=c90 -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ],
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ],
[AM_CFLAGS], [-Werror])
dnl Android requires c99, all others should use c90
case $host_os in
*android*)
AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror])
;;
*)
AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror])
;;
esac
fi
if test "$ax_cv_c_compiler_vendor" = "intel"; then

Loading…
Cancel
Save