Build Android binaries #79
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
CMAKE_BUILD_PARALLEL_LEVEL: 4 | |
# Required dependencies (does not include packaging and optional dependencies) | |
UBUNTU_DEPS: cmake libxml2-dev zlib1g-dev libssl-dev libflatbuffers-dev | |
jobs: | |
ubuntu: | |
name: Build on Ubuntu ${{ matrix.container }} ${{ matrix.arch }} | |
runs-on: ubuntu-24.04${{ matrix.arch == 'arm64' && '-arm' || '' }} | |
container: ubuntu:${{ matrix.container }} | |
strategy: | |
matrix: | |
container: ['22.04', '24.04', '24.10'] | |
arch: ['amd64', 'arm64'] | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
DEBFULLNAME: github-actions | |
DEBEMAIL: [email protected] | |
steps: | |
- name: Install dependencies | |
run: apt update -qq && apt install --no-install-recommends -y lsb-release build-essential devscripts debhelper lintian pkg-config ${UBUNTU_DEPS} doxygen swig openjdk-17-jdk-headless libpython3-dev python3-setuptools libboost-test-dev | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup changelog | |
run: | | |
export VERSION=$(grep project CMakeLists.txt | egrep -o "([0-9]{1,}\.)+[0-9]{1,}") | |
export VERSIONEX=${VERSION}.${BUILD_NUMBER}.$(lsb_release -rs) | |
dch --distribution $(lsb_release -cs) -v ${VERSIONEX} "Release ${VERSIONEX}." | |
- name: Build packages | |
run: | | |
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${{ matrix.arch }} dpkg-buildpackage -us -uc | |
mv ../libcdoc*.* . | |
- name: Lintian | |
run: lintian *.deb; | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu_${{ matrix.container }}_${{ matrix.arch }} | |
path: libcdoc*.* | |
android: | |
name: Build on Ubuntu for ${{ matrix.target }} | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
include: | |
- target: androidarm | |
triplet: arm-neon-android | |
- target: androidarm64 | |
triplet: arm64-android | |
- target: androidx86_64 | |
triplet: x64-android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45 | |
vcpkgJsonGlob: ./vcpkg.json | |
runVcpkgInstall: true | |
env: | |
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
- name: Build | |
run: | | |
cmake --preset ${{ matrix.target }} "-GUnix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=libcdoc.${{ matrix.target }} | |
cmake --build --preset ${{ matrix.target }} | |
cmake --build --preset ${{ matrix.target }} --target install/strip | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }}.zip | |
path: | | |
libcdoc.${{ matrix.target }} | |
macos: | |
name: Build on macOS for ${{ matrix.target }} | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [macos, iphoneos, iphonesimulator] | |
include: | |
- target: iphoneos | |
triplet: arm64-ios | |
- target: iphonesimulator | |
triplet: arm64-ios-simulator | |
env: | |
DEST: ${{ github.workspace }}/${{ matrix.target }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
brew update | |
brew install --formula ninja flatbuffers swig doxygen boost [email protected] | |
brew unlink [email protected] || true | |
brew unlink [email protected] || true | |
- name: Prepare vcpkg | |
if: matrix.target != 'macos' | |
uses: lukka/run-vcpkg@v11 | |
with: | |
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45 | |
vcpkgJsonGlob: ./vcpkg.json | |
runVcpkgInstall: true | |
env: | |
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
- name: Build | |
run: | | |
cmake --preset ${{ matrix.target }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=${{ env.DEST }} | |
cmake --build --preset ${{ matrix.target }} | |
- name: Test | |
if: matrix.target == 'macos' | |
run: cmake --build --preset ${{ matrix.target }} --target test | |
- name: Install | |
run: cmake --build --preset ${{ matrix.target }} --target install/strip | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: ${{ env.DEST }}/** |