Files
OpenCL-CTS/.github/workflows/presubmit.yml
Ahmed Hesham e361b387d9 Add Android to the CI build matrix (#2165)
Support building for Android on Arm and AArch64 platforms.

Modify the build matrix to add to new variations. Both variants
download, extract and setup the Android Native Development Kit (NDK) on
a Linux runner. Each variant specifies a `android_arch_abi`, which is
passed to CMake during configuration as its `CMAKE_ANDROID_ARCH_ABI`
option.

The CMake toolchain file provided by the NDK is used when building for
Android. The NDK version used is r27c, which is the latest Long-Term
Support (LTS) version. `ANDROID_PLATFORM` is intentionally not set, so
the NDK can default to the minimum supported version, which is 21. The
compiler (Clang) version used by this NDK is 18.0.3.

The NDK ships with its own sysroot, which has the Linux kernel headers
of version 6.8.0, or `LINUX_VERSION_CODE 395264`.

CMake
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#id23
https://cmake.org/cmake/help/latest/variable/CMAKE_ANDROID_ARCH_ABI.html

NDK
https://developer.android.com/ndk/downloads
2024-12-03 08:56:46 -08:00

100 lines
3.7 KiB
YAML

name: Presubmit
on: [push, pull_request]
jobs:
build:
name: Build ${{ matrix.os }} ${{ matrix.arch }}${{ matrix.extra }}
runs-on: ${{ matrix.os }}
env:
JOB_ARCHITECTURE: ${{ matrix.arch }}
JOB_ENABLE_GL: ${{ matrix.gl }}
JOB_ENABLE_DEBUG: ${{ matrix.debug }}
strategy:
fail-fast: false
matrix:
mainmatrix: [true]
os: [ubuntu-22.04, macos-latest, windows-latest]
include:
- os: ubuntu-22.04
mainmatrix: true
gl: 1
extra: " gl"
- os: ubuntu-22.04
mainmatrix: false
arch: arm
- os: ubuntu-22.04
mainmatrix: false
arch: aarch64
debug: 1
extra: " debug"
- os: ubuntu-22.04
mainmatrix: false
arch: android-arm
android_arch_abi: armeabi-v7a
- os: ubuntu-22.04
mainmatrix: false
arch: android-aarch64
android_arch_abi: arm64-v8a
steps:
- uses: actions/checkout@v4
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Install Arm and AArch64 compilers
if: ${{ matrix.arch == 'arm' || matrix.arch == 'aarch64' }}
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-12-arm-linux-gnueabihf g++-12-arm-linux-gnueabihf \
gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-12 12
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-12 12
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-12 12
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-12 12
- name: Setup OpenGL build dependencies
if: ${{ matrix.gl }}
run: |
sudo apt-get update
sudo apt-get -y install libglu1-mesa-dev freeglut3-dev mesa-common-dev libglew-dev
- name: Setup MSVC with Ninja
uses: ilammy/msvc-dev-cmd@v1
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: ${{ matrix.os }}-${{ matrix.arch }}
- name: Fetch OpenCL Headers
shell: bash
run: |
git clone https://github.com/KhronosGroup/OpenCL-Headers.git
cd OpenCL-Headers
ln -s CL OpenCL # For OSX builds
cd ..
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@main
with:
version: 1.3.275.0
cache: true
- name: Install Android NDK
if: ${{ matrix.arch == 'android-arm' || matrix.arch == 'android-aarch64' }}
run: |
wget https://dl.google.com/android/repository/android-ndk-r27c-linux.zip -O android-ndk.zip
unzip android-ndk.zip -d $HOME
export ANDROID_NDK=$HOME/android-ndk-r27c
echo "ANDROID_NDK=$ANDROID_NDK" >> $GITHUB_ENV
export ANDROID_ARCH_ABI=${{ matrix.android_arch_abi }}
echo "ANDROID_ARCH_ABI=$ANDROID_ARCH_ABI" >> $GITHUB_ENV
- name: Build
shell: bash
run: ./presubmit.sh
formatcheck:
name: Check code format
runs-on: ubuntu-22.04
steps:
- name: Install packages
run: sudo apt install -y clang-format clang-format-14
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check code format
run: ./check-format.sh