Skip to content

Commit

Permalink
ci: android ci on linux (#91)
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Nino [email protected]

Description: setup android CI on linux.
Risk Level: low
Testing: adding CI

Part of #42

Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
junr03 authored and jpsim committed Nov 29, 2022
1 parent 9ec868a commit 1dc30c0
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mobile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ git_repository(
# https://github.com/keith/rules_kotlin/blob/master/LICENSE
git_repository(
name = "io_bazel_rules_kotlin",
commit = "af3dea0853f2821e7ece6e028fad57bcd6ce2831", # from branch ks/bazel-fixups
commit = "af3dea0853f2821e7ece6e028fad57bcd6ce2831", # from branch ks/bazel-fixups
remote = "https://github.com/keith/rules_kotlin.git",
shallow_since = "1544305265 -0800",
)
Expand Down
69 changes: 67 additions & 2 deletions mobile/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,71 @@ jobs:
submodules: true
- script: swiftlint lint --strict
displayName: 'Run SwiftLint'
- job: android_dist
pool:
vmImage: 'Ubuntu 16.04'
variables:
android_ndk_home: /usr/local/lib/android/sdk/ndk-bundle
steps:
- checkout: self
submodules: true
- script: ./ci/linux_ci_setup.sh
displayName: 'Install dependencies'
- script: |
export PATH=/usr/lib/llvm-8/bin:$PATH
export CC=clang
export CXX=clang++
displayName: 'Set up clang toolchain'
- script: |
bazel build --fat_apk_cpu=x86 //:android_dist
displayName: 'Build envoy.aar distributable'
- task: PublishPipelineArtifact@0
displayName: 'Publish envoy.aar distributable'
inputs:
artifactName: 'envoy.aar'
targetPath: 'dist/envoy.aar'
- job: android_java_helloworld
dependsOn: android_dist
timeoutInMinutes: 360
pool:
vmImage: 'Ubuntu 16.04'
variables:
android_ndk_home: /usr/local/lib/android/sdk/ndk-bundle
steps:
- checkout: self
submodules: true
- script: ./ci/linux_ci_setup.sh
displayName: 'Install dependencies'
- script: mkdir -p dist/
displayName: 'Create directory for distributable'
- task: DownloadPipelineArtifact@0
displayName: 'Download envoy.aar distributable'
inputs:
artifactName: 'envoy.aar'
targetPath: dist
- script: bazel build --fat_apk_cpu=x86 //examples/java/hello_world:hello_envoy
displayName: 'Build java app'
- job: android_kotlin_helloworld
dependsOn: android_dist
timeoutInMinutes: 360
pool:
vmImage: 'Ubuntu 16.04'
variables:
android_ndk_home: /usr/local/lib/android/sdk/ndk-bundle
steps:
- checkout: self
submodules: true
- script: ./ci/linux_ci_setup.sh
displayName: 'Install dependencies'
- script: mkdir -p dist/
displayName: 'Create directory for distributable'
- task: DownloadPipelineArtifact@0
displayName: 'Download envoy.aar distributable'
inputs:
artifactName: 'envoy.aar'
targetPath: dist
- script: bazel build --fat_apk_cpu=x86 //examples/kotlin/hello_world:hello_envoy_kt
displayName: 'Build kotlin app'
- job: iOS_dist
timeoutInMinutes: 360
pool:
Expand Down Expand Up @@ -61,7 +126,7 @@ jobs:
displayName: 'Download Envoy.framework distributable'
inputs:
artifactName: Envoy.framework
targetPath: ./dist/Envoy.framework
targetPath: dist/Envoy.framework
- script: bazel build --config=ios //examples/objective-c/hello_world:app
displayName: 'Build objective-c app'
- job: iOS_swift
Expand All @@ -80,6 +145,6 @@ jobs:
displayName: 'Download Envoy.framework distributable'
inputs:
artifactName: Envoy.framework
targetPath: ./dist/Envoy.framework
targetPath: dist/Envoy.framework
- script: bazel build --config=ios //examples/swift/hello_world:app
displayName: 'Build swift app'
32 changes: 32 additions & 0 deletions mobile/ci/linux_ci_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

# Set up basic requirements and install them.
sudo apt-get update
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y wget software-properties-common make cmake git \
unzip bc libtool ninja-build automake zip time \
apt-transport-https

# clang 8.
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-add-repository "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main"
sudo apt-get update
sudo apt-get install -y clang-8 lld-8 libc++-8-dev libc++abi-8-dev

sudo update-alternatives --remove-all clang
sudo update-alternatives --remove-all clang++
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100

# Bazel.
wget -c https://github.com/bazelbuild/bazel/releases/download/0.26.1/bazel-0.26.1-installer-linux-x86_64.sh
chmod +x bazel-0.26.1-installer-linux-x86_64.sh
sudo ./bazel-0.26.1-installer-linux-x86_64.sh

# ndk 20
# wget -c https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
# unzip android-ndk-r20-linux-x86_64.zip
# sudo rm -rf /usr/local/lib/android/sdk/ndk-bundle
# sudo mv android-ndk-r20 /usr/local/lib/android/sdk/ndk-bundle
2 changes: 1 addition & 1 deletion mobile/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def setup(app):
'repo': ('https://github.com/lyft/envoy-mobile/blob/{}/%s'.format(blob_sha), ''),
}

# Setup global substitutions
# Set up global substitutions
# substitutions = []

# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 1 addition & 1 deletion mobile/envoy
Submodule envoy updated from db853f to 5dd7cc
2 changes: 1 addition & 1 deletion mobile/examples/kotlin/hello_world/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
licenses(["notice"]) # Apache 2

load("//bazel:envoy_build_system.bzl", "envoy_package")
load("@envoy//bazel:envoy_build_system.bzl", "envoy_package")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_android_library")

envoy_package()
Expand Down

0 comments on commit 1dc30c0

Please sign in to comment.