Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub ci #459

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build CartoMobileSDK

on: [workflow_dispatch]

jobs:
build:
strategy:
# max-parallel: 1
matrix:
variant: ['android', 'ios']
runs-on: macos-latest
name: CartoMobileSDK ${{ matrix.variant }}
steps:
- uses: actions/checkout@v2

- name: fetch externals
run: |
git submodule update --init --remote --recursive

- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Setup Android SDK
if: matrix.variant == 'android'
uses: android-actions/setup-android@v2

- uses: nttld/setup-ndk@v1
if: matrix.variant == 'android'
id: setup-ndk
with:
ndk-version: r22

- name: prepare boost
run: |
cd libs-external/boost
./bootstrap.sh
./b2 headers

- name: Build swig
run: |
brew install autoconf automake libtool
git clone https://github.com/farfromrefug/mobile-swig.git
cd mobile-swig
wget https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.37/pcre2-10.37.tar.gz
./Tools/pcre-build.sh
./autogen.sh
./configure
make

- name: Build swig-objc
if: matrix.variant != 'android'
run: |
cd scripts
python swigpp-objc.py --profile standard+valhalla --swig ../mobile-swig/swig

- name: Build swig-java
if: matrix.variant == 'android'
run: |
cd scripts
python swigpp-java.py --profile standard --swig ../mobile-swig/swig

- name: Get branch name
shell: bash
run: echo "VERSION_NAME=$(echo ${GITHUB_HEAD_REF} | tr / - | sed "s/^[a-zA-Z]*-//g" | sed "s/^$/4.4.2/")" >> $GITHUB_ENV

- name: Build CartoSDK
if: matrix.variant == 'android'
run: |
brew install gradle@6
cd scripts
python build-android.py --profile standard+valhalla --build-aar --build-version ${{ env.VERSION_NAME }} --configuration=Release --gradle /usr/local/opt/gradle@6/bin/gradle
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

- name: Build CartoSDK
if: matrix.variant == 'ios'
run: |
cd scripts
python build-ios.py --profile standard+valhalla --build-cocoapod --build-version ${{ env.VERSION_NAME }} --build-xcframework

- name: Build CartoSDK
if: matrix.variant == 'ios-metal'
run: |
cd scripts
python build-ios.py --profile standard+valhalla --build-cocoapod --build-version ${{ env.VERSION_NAME }} --build-xcframework

- uses: actions/upload-artifact@v2
if: matrix.variant == 'android'
with:
name: CartoMobileSDK-android-${{env.VERSION_NAME}}.zip
path: |
dist/android/*.aar
dist/android/*.jar
dist/android/*.pom

- uses: actions/upload-artifact@v2
if: matrix.variant != 'android'
with:
name: CartoMobileSDK-ios-${{env.VERSION_NAME}}.zip
path: dist/ios/*.zip
1 change: 1 addition & 0 deletions scripts/build-android.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from build.sdk_build_utils import *

ANDROID_ABIS = ['armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64']
SDK_VERSION = "4.4.2"

def javac(args, dir, *cmdArgs):
return execute(args.javac, dir, *cmdArgs)
Expand Down
7 changes: 4 additions & 3 deletions scripts/build-ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from build.sdk_build_utils import *

IOS_ARCHS = ['i386', 'x86_64', 'armv7', 'arm64', 'arm64-simulator', 'x86_64-maccatalyst', 'arm64-maccatalyst']
SDK_VERSION = "4.4.2"

def getFinalBuildDir(target, arch=None):
return getBuildDir(('%s_metal' % target) if args.metalangle else target, arch)
Expand Down Expand Up @@ -296,14 +297,14 @@ def buildIOSPackage(args, buildCocoapod, buildSwiftPackage):
if 'all' in args.iosarch or args.iosarch == []:
args.iosarch = IOS_ARCHS
if not args.buildxcframework:
args.iosarch = filter(lambda arch: not (arch.endswith('-simulator') or arch.endswith('-maccatalyst')), args.iosarch)
args.iosarch = list(filter(lambda arch: not (arch.endswith('-simulator') or arch.endswith('-maccatalyst')), args.iosarch))
if not args.metalangle:
args.iosarch = filter(lambda arch: not arch.endswith('-maccatalyst'), args.iosarch)
args.iosarch = list(filter(lambda arch: not arch.endswith('-maccatalyst'), args.iosarch))
args.defines += ';' + getProfile(args.profile).get('defines', '')
if args.metalangle:
args.defines += ';' + '_CARTO_USE_METALANGLE'
else:
if filter(lambda arch: arch.endswith('-maccatalyst'), args.iosarch):
if list(filter(lambda arch: arch.endswith('-maccatalyst'), args.iosarch)):
print('Mac Catalyst builds are only supported with MetalANGLE')
sys.exit(-1)
args.cmakeoptions += ';' + getProfile(args.profile).get('cmake-options', '')
Expand Down