Skip to content

Instantly share code, notes, and snippets.

@caveda
caveda / Dockerfile
Created January 14, 2024 16:24
Android Base Image
FROM ubuntu:23.10
ENV ANDROID_HOME="/opt/android-sdk"
# support amd64 and arm64
RUN JDK_PLATFORM=$(if [ "$(uname -m)" = "aarch64" ]; then echo "arm64"; else echo "amd64"; fi) && \
echo export JDK_PLATFORM=$JDK_PLATFORM >> /etc/jdk.env && \
echo export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$JDK_PLATFORM/" >> /etc/jdk.env && \
echo . /etc/jdk.env >> /etc/bash.bashrc && \
echo . /etc/jdk.env >> /etc/profile
@caveda
caveda / detectChanges.sh
Last active March 3, 2024 15:27
Script Function to Detect the Modules Modified Between Two Branches
#!/bin/bash
source_branch=$1
target_branch=$2
detectchanges() {
changed_modules=""
git diff $source_branch..$target_branch --name-only | { while read line
do
module_name=${line%%/*}
@caveda
caveda / config.toml
Created January 4, 2024 08:57
Configuration file for Gitlab Runner
concurrent = 3
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "android-runner"
url = "https://GitLab.com"
token = "token"
executor = "docker"
output_limit = 16384
@caveda
caveda / launchEmulator.sh
Created January 3, 2024 20:01
Script to Launch an Emulator and Wait for it
#!/bin/sh
$ANDROID_SDK_HOME/emulator/emulator -avd testDevice -no-audio -no-boot-anim -no-window -read-only &
echo "Waiting for emulator to launch"
timeout 5m adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 5; done;'
@caveda
caveda / Dockerfile
Created January 3, 2024 19:53
Android Emulator Docker
FROM android-build:1.0
RUN apt-get update -qq > /dev/null && \
apt-get install -qq locales > /dev/null && \
locale-gen "$LANG" > /dev/null && \
apt-get install -qq --no-install-recommends libpulse0 libxcomposite-dev libxcursor-dev libxdamage-dev cpu-checker
ENV PATH="$PATH:$ANDROID_HOME/cmdline-tools/7.0/bin/:$ANDROID_HOME/cmdline-tools/latest/bin/"
RUN sdkmanager "emulator"