Added support for github CI/CD and packaging. A few fixes for iOS build

This commit is contained in:
Petr Pokorny
2020-12-16 18:24:37 +01:00
parent 4b7b90378e
commit d793b7c048
23 changed files with 1193 additions and 71 deletions

149
.github/workflows/android-ci.yml vendored Normal file
View File

@@ -0,0 +1,149 @@
name: android-ci
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
paths-ignore:
- "mapbox-gl-native-ios/**"
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: [self-hosted, petr-ubuntu-acct]
defaults:
run:
working-directory: mapbox-gl-native-android
container:
image: ghcr.io/maptiler/android-ndk-r21b
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
env:
LIBSYSCONFCPUS: 8
JOBS: 8
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
MBGL_ANDROID_STL: c++_static
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: npm install --ignore-scripts
working-directory: mapbox-gl-native-android
- name: Prepare ccache
run: ccache --clear
- name: Cache ccache
uses: actions/cache@v2
env:
cache-name: ccache-v1
with:
path: ~/.ccache'
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}
- name: Clear ccache statistics
run: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
- name: restore-gradle-cache
uses: actions/cache@v2
env:
cache-name: gradle-v1
with:
path: ~/.gradle'
key: ${{ env.cache-name }}-{{ hashFiles 'gradle/dependencies.gradle' }}-{{ hashFiles 'build.gradle' }}-{{ hashFiles 'gradle/wrapper/gradle-wrapper.properties' }}'
restore-keys: |
- ${{ env.cache-name }}
- name: Check code style
run: make android-check
- name: Run Android unit tests
run: make run-android-unit-test
- name: Build libmapbox-gl.so for arm-v8
run: make android-lib-arm-v8
- name: Generate Espresso sanity tests
run: make test-code-android
- name: Build Test APK
run: |
MAPBOX_DEVELOPER_CONFIG_XML='${{ secrets.MAPBOX_DEVELOPER_CONFIG_XML }}'
if [ -n "${MAPBOX_DEVELOPER_CONFIG_XML}" ]; then
echo "${MAPBOX_DEVELOPER_CONFIG_XML}" > MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml
make android-ui-test-arm-v8
else
echo "No secrets.MAPBOX_DEVELOPER_CONFIG_XML variable set, skipping apk build..."
fi
shell: bash
- name: Log in to Google Cloud Platform
run: |
GLCLOUD_SERVICE_JSON='${{ secrets.GLCLOUD_SERVICE_JSON }}'
if [[ -n "${GLCLOUD_SERVICE_JSON}" ]]; then
echo "Activating google cloud account..."
echo "${GLCLOUD_SERVICE_JSON}" > secret.json
gcloud auth activate-service-account --key-file secret.json --project maptiler-gl-mobile
rm secret.json
else
echo "No secrets.GLCLOUD_SERVICE_JSON variable set, skipping google cloud login..."
fi
shell: bash
- name: Run instrumentation tests on Firebase
run: |
GLCLOUD_SERVICE_JSON='${{ secrets.GLCLOUD_SERVICE_JSON }}'
if [[ -n "${GLCLOUD_SERVICE_JSON}" ]]; then
gcloud firebase test android models list
gcloud firebase test android run --type instrumentation \
--app MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk \
--test MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \
--device-ids sailfish --os-version-ids 26 --locales en --orientations portrait --timeout 20m \
--environment-variables coverage=true,coverageFile="/sdcard/coverage.ec" --directories-to-pull /sdcard --results-dir mapbox-android-sdk-${CIRCLE_BUILD_NUM}
else
echo "No secrets.GLCLOUD_SERVICE_JSON variable set, skipping instrumentation tests..."
fi
shell: bash
- name: Store debug artifacts
uses: actions/upload-artifact@v2
with:
name: debug-artifacts
path: |
MapboxGLAndroidSDKTestApp/build/outputs/apk/debug
MapboxGLAndroidSDK/build/reports/lint-results.html
MapboxGLAndroidSDK/lint-baseline.xml
MapboxGLAndroidSDKTestApp/build/reports/lint-results.html
MapboxGLAndroidSDKTestApp/build/reports/lint-results.xml
MapboxGLAndroidSDKTestApp/lint-baseline.xml
MapboxGLAndroidSDK/build/intermediates/cmake/debug/obj

View File

@@ -0,0 +1,29 @@
name: android-base-docker-image
on:
workflow_dispatch
jobs:
push_to_registry:
name: Docker image android-base
runs-on: [self-hosted, petr-ubuntu-acct]
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push android-base image
uses: docker/build-push-action@v2
with:
file: ./mapbox-gl-native-android/docker/android-base
context: ./mapbox-gl-native-android/docker
tags: ghcr.io/maptiler/android-base:latest
push: true

View File

@@ -0,0 +1,29 @@
name: android-ndk-r21b-docker-image
on:
workflow_dispatch
jobs:
push_to_registry:
name: Docker image android-ndk-r21b
runs-on: [self-hosted, petr-ubuntu-acct]
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push android-ndk-r21b image
uses: docker/build-push-action@v2
with:
file: ./mapbox-gl-native-android/docker/android-ndk-r21b
context: ./mapbox-gl-native-android/docker
tags: ghcr.io/maptiler/android-ndk-r21b:latest
push: true

178
.github/workflows/android-release.yml vendored Normal file
View File

@@ -0,0 +1,178 @@
name: android-release
on:
workflow_dispatch:
push:
tags:
- android-v*
branches:
- main
jobs:
build:
runs-on: [self-hosted, petr-ubuntu-acct]
defaults:
run:
working-directory: mapbox-gl-native-android
container:
image: ghcr.io/maptiler/android-ndk-r21b
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
env:
LIBSYSCONFCPUS: 8
JOBS: 8
BUILDTYPE: Release
IS_LOCAL_DEVELOPMENT: false
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: npm install --ignore-scripts
working-directory: mapbox-gl-native-android
- name: Prepare ccache
run: ccache --clear
- name: Cache ccache
uses: actions/cache@v2
env:
cache-name: ccache-v1
with:
path: ~/.ccache'
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}
- name: Clear ccache statistics
run: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
- name: restore-gradle-cache
uses: actions/cache@v2
env:
cache-name: gradle-v1
with:
path: ~/.gradle'
key: ${{ env.cache-name }}-{{ hashFiles 'gradle/dependencies.gradle' }}-{{ hashFiles 'build.gradle' }}-{{ hashFiles 'gradle/wrapper/gradle-wrapper.properties' }}'
restore-keys: |
- ${{ env.cache-name }}
- name: Android nitpick
run: make run-android-nitpick
- name: Update version name
run: |
RELEASE_VERSION="$( git describe --tags --match=android-v*.*.* --abbrev=0 | sed 's/^android-v//' )"
echo "Latest version from tag: $RELEASE_VERSION"
if [ ! -z "$RELEASE_VERSION" ]; then
sed -i -e "s/^VERSION_NAME=.*/VERSION_NAME=${RELEASE_VERSION}/" MapboxGLAndroidSDK/gradle.properties
echo "MapboxGLAndroidSDK/gradle.properties:"
cat MapboxGLAndroidSDK/gradle.properties
fi
shell: bash
- name: Build package
run: make apackage
- name: Build release Test App
run: |
MAPBOX_DEVELOPER_CONFIG_XML='${{ secrets.MAPBOX_DEVELOPER_CONFIG_XML }}'
if [ -n "${MAPBOX_DEVELOPER_CONFIG_XML}" ]; then
echo "${MAPBOX_DEVELOPER_CONFIG_XML}" > MapboxGLAndroidSDKTestApp/src/main/res/values/developer-config.xml
make android
else
echo "No secrets.MAPBOX_DEVELOPER_CONFIG_XML variable set, skipping apk build..."
fi
shell: bash
- name: Generate javadoc
run: make android-javadoc
- name: Log in to Google Cloud Platform
run: |
GLCLOUD_SERVICE_JSON='${{ secrets.GLCLOUD_SERVICE_JSON }}'
if [[ -n "${GLCLOUD_SERVICE_JSON}" ]]; then
echo "Activating google cloud account..."
echo "${GLCLOUD_SERVICE_JSON}" > secret.json
gcloud auth activate-service-account --key-file secret.json --project maptiler-gl-mobile
rm secret.json
else
echo "No secrets.GLCLOUD_SERVICE_JSON variable set, skipping google cloud login..."
fi
shell: bash
- name: Run robotest of release Test App on Firebase
run: |
GLCLOUD_SERVICE_JSON='${{ secrets.GLCLOUD_SERVICE_JSON }}'
if [[ -n "${GLCLOUD_SERVICE_JSON}" ]]; then
gcloud firebase test android run --type robo \
--app MapboxGLAndroidSDKTestApp/build/outputs/apk/release/MapboxGLAndroidSDKTestApp-release.apk \
--device-ids sailfish --os-version-ids "26" --locales en --orientations portrait --timeout 90s
else
echo "No secrets.GLCLOUD_SERVICE_JSON variable set, skipping tests..."
fi
shell: bash
# create github release
- name: Prepare release
id: prepare_release
run: |
RELEASE_NOTES_PATH="${PWD}/release_notes.txt"
./scripts/release-notes.js > ${RELEASE_NOTES_PATH}
echo ::set-output name=release_notes::${RELEASE_NOTES_PATH}
echo ::set-output name=version_tag::$( git describe --tags --match=android-v*.*.* --abbrev=0 )
shell: bash
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.prepare_release.outputs.version_tag }}
release_name: ${{steps.prepare_release.outputs.version_tag }}
body_path: ${{ steps.prepare_release.outputs.release_notes }}
draft: false
prerelease: false
- name: Upload aar
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mapbox-gl-native-android/MapboxGLAndroidSDK/build/outputs/aar/MapboxGLAndroidSDK-release.aar
asset_name: MapboxGLAndroidSDK-release.aar
asset_content_type: application/zip
- name: Clean release
run: |
rm -f ${{ steps.prepare_release.outputs.release_notes }}
shell: bash
# deploy to github maven repo
- name: Publish package
run: make android-maven-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

100
.github/workflows/ios-ci.yml vendored Normal file
View File

@@ -0,0 +1,100 @@
name: ios-ci
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
paths-ignore:
- "mapbox-gl-native-android/**"
branches:
- main
pull_request:
branches:
- main
jobs:
build:
#runs-on: [self-hosted, petr-macos-vbox1]
runs-on: [self-hosted, petr-self-hosted]
env:
BUILDTYPE: Debug
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
defaults:
run:
working-directory: mapbox-gl-native-ios
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Install macos dependencies
run: |
brew list cmake || brew install cmake
brew list ccache || brew install ccache
brew list pkg-config || brew install pkg-config
brew list glfw3 || brew install glfw3
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: /user/local/lib/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: npm install --ignore-scripts
- name: Prepare ccache
run: ccache --clear
- name: Cache ccache
uses: actions/cache@v2
env:
cache-name: ccache-v1
with:
path: ~/.ccache'
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}
- name: Clear ccache statistics
run: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
- name: Install iOS packaging dependencies
run: |
./platform/ios/scripts/install-packaging-dependencies.sh
env:
CILAUNCH: true
- name: Check debug symbols
run: make darwin-check-public-symbols
- name: Lint plist files
run: make ios-lint-plist
- name: Running ios unit tests
run: make ios-test
- name: Build and run SDK unit tests with thread and undefined behavior sanitizers
run: make ios-sanitize
- name: Build and run SDK unit tests with address sanitizer
run: make ios-sanitize-address
- name: Build and run SDK unit tests with the static analyzer
run: make ios-static-analyzer

81
.github/workflows/ios-release.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: ios-release
on:
push:
tags:
- ios-v*
branches:
- main
jobs:
build:
runs-on: [self-hosted, petr-macos-vbox1]
env:
BUILDTYPE: Release
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
defaults:
run:
working-directory: mapbox-gl-native-ios
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Install macos dependencies
run: |
brew list cmake || brew install cmake
brew list ccache || brew install ccache
brew list pkg-config || brew install pkg-config
brew list glfw3 || brew install glfw3
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: npm install
run: npm install --ignore-scripts
- name: Prepare ccache
run: ccache --clear
- name: Cache ccache
uses: actions/cache@v2
env:
cache-name: ccache-v1
with:
path: ~/.ccache'
key: ${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ runner.os }}-${{ github.job }}
- name: Clear ccache statistics
run: |
ccache --zero-stats
ccache --max-size=2G
ccache --show-stats
- name: Install iOS packaging dependencies
run: |
./platform/ios/scripts/install-packaging-dependencies.sh
env:
CILAUNCH: true
- name: Build, package, and upload iOS release
run: platform/ios/scripts/deploy-swift-package.sh
env:
DIST_GITHUB_TOKEN: ${{ secrets.DIST_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}