Build CartoMobileSDK #107
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: Build CartoMobileSDK | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
required: false | |
description: 'version number' | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} | |
VERSION: ${{ steps.get_version_or_prompt.outputs.result }} | |
VERSION_TAG: v${{ steps.get_version_or_prompt.outputs.result }} | |
steps: | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: actions/github-script@v6 | |
id: get_version_or_prompt | |
with: | |
result-encoding: string | |
script: | | |
if ("${{ github.event.inputs.version }}".length) { | |
return "${{ github.event.inputs.version }}"; | |
} | |
- name: create release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# This pulls from the "Get Changelog Entry" step above, referencing it's ID to get its outputs object. | |
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
tag: v${{ steps.get_version_or_prompt.outputs.result }} | |
name: v${{ steps.get_version_or_prompt.outputs.result }} | |
generateReleaseNotes: true | |
# we create first the release as draft. Will be published once everything is done | |
draft: true | |
allowUpdates: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
strategy: | |
matrix: | |
variant: ['android', 'ios', 'ios_metal'] | |
runs-on: macos-latest | |
needs: [create-release] | |
name: CartoMobileSDK ${{ matrix.variant }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: maxim-lobanov/setup-xcode@v1 | |
if: matrix.variant != 'android' | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Setup Android SDK | |
if: matrix.variant == 'android' | |
uses: android-actions/setup-android@v3 | |
# - if: matrix.variant == 'android' | |
# name: run SDKManager | |
# run: sdkmanager "build-tools;30.0.3" | |
- uses: nttld/setup-ndk@v1 | |
if: matrix.variant == 'android' | |
id: setup-ndk | |
with: | |
ndk-version: r25c | |
- name: Install CMake | |
run: | | |
brew install cmake | |
cmake --version | |
- name: Install gradle | |
if: matrix.variant == 'android' | |
run: | | |
brew install gradle@8 | |
brew info gradle@8 | |
brew link gradle@8 | |
which gradle | |
- name: fetch externals | |
run: | | |
git submodule update --init --remote --recursive | |
- name: prepare boost | |
run: | | |
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.zip | |
unzip boost_1_85_0.zip | |
ln -s ../boost_1_85_0 libs-external/boost | |
cd boost_1_85_0 | |
./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/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.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+valhalla --swig ../mobile-swig/swig | |
- name: Build CartoSDK | |
if: matrix.variant == 'android' | |
run: | | |
cd scripts | |
python build-android.py --profile standard+valhalla --build-aar --build-version ${{ needs.create-release.outputs.VERSION }}--configuration=Release --gradle /opt/homebrew/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 ${{ needs.create-release.outputs.VERSION }} --configuration=Release --build-xcframework | |
- name: Build CartoSDK | |
if: matrix.variant == 'ios_metal' | |
run: | | |
cd scripts | |
python build-ios.py --profile standard+valhalla --build-cocoapod --build-version ${{ needs.create-release.outputs.VERSION }} --configuration=Release --build-xcframework --use-metalangle | |
- uses: actions/upload-artifact@v4 | |
if: matrix.variant == 'android' | |
with: | |
name: CartoMobileSDK-${{matrix.variant}}-${{ needs.create-release.outputs.VERSION }}.zip | |
path: | | |
dist/android/*.aar | |
dist/android/*.jar | |
dist/android/*.pom | |
- uses: actions/upload-artifact@v4 | |
if: matrix.variant != 'android' | |
with: | |
name: CartoMobileSDK-${{matrix.variant}}-${{ needs.create-release.outputs.VERSION }}.zip | |
path: dist/${{matrix.variant}}/*.zip | |
- name: Upload Release Asset | |
if: matrix.variant == 'android' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | |
gh release upload ${{ needs.create-release.outputs.VERSION_TAG }} dist/android/*.aar | |
- name: Upload Release Asset | |
if: matrix.variant != 'android' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | |
gh release upload ${{ needs.create-release.outputs.VERSION_TAG }} dist/${{matrix.variant}}/*.zip | |
build-css2xml: | |
needs: [create-release] | |
strategy: | |
matrix: | |
variant: ['linux', 'darmin'] | |
runs-on: ${{ matrix.variant == 'linux' && 'ubuntu-latest' || 'macos-latest' }} | |
name: CartoMobileSDK CSS2XML ${{ matrix.variant }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
- name: Install gradle | |
if: matrix.variant == 'android' | |
run: | | |
brew install gradle@8 | |
brew info gradle@8 | |
brew link gradle@8 | |
which gradle | |
- name: fetch externals | |
run: | | |
git submodule update --init --remote --recursive | |
- name: prepare boost | |
run: | | |
wget https://boostorg.jfrog.io/artifactory/main/release/1.85.0/source/boost_1_85_0.zip | |
unzip boost_1_85_0.zip | |
ln -s ../boost_1_85_0 libs-external/boost | |
cd boost_1_85_0 | |
./bootstrap.sh | |
./b2 headers | |
- name: build css2xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd libs-carto/cartocss/util | |
cmake -B build -DCMAKE_BUILD_TYPE=Release | |
cd build | |
make css2xml | |
mv css2xml css2xml_${{ matrix.variant }} | |
gh release upload ${{ needs.create-release.outputs.VERSION_TAG }} css2xml_${{ matrix.variant }} | |
- name: Upload Release Asset | |
if: matrix.variant != 'android' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | |
gh release upload ${{ needs.create-release.outputs.VERSION_TAG }} dist/${{matrix.variant}}/*.zip | |
update-release: | |
runs-on: ubuntu-latest | |
needs: [create-release, build, build-css2xml] | |
permissions: | |
contents: write # release changes require contents write | |
steps: | |
- name: Update release | |
uses: irongut/EditRelease@v1.2.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
id: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} | |
draft: false | |