mirror of
https://github.com/izzy2lost/docker-android.git
synced 2026-06-19 01:16:28 -07:00
92 lines
3.6 KiB
YAML
92 lines
3.6 KiB
YAML
name: Android Build with Termux
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Up Nix and Devenv
|
|
run: |
|
|
# Install Nix
|
|
curl -L https://nixos.org/nix/install | sh
|
|
|
|
# Source Nix environment to make nix-env available
|
|
. /nix/var/nix/profiles/default/etc/profile.d/nix.sh
|
|
|
|
# Install Devenv
|
|
nix-env -iA nixpkgs.devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable
|
|
|
|
# Ensure config directory exists
|
|
mkdir -p /root/.config/devenv/
|
|
|
|
# Copy devenv configuration files
|
|
cp devenv.nix /root/.config/devenv/
|
|
cp devenv.yaml /root/.config/devenv/
|
|
|
|
# Start the Devenv environment
|
|
devenv up
|
|
|
|
shell: bash
|
|
|
|
- name: Install Android Emulator (AArch64 & ARMv7)
|
|
run: |
|
|
sdkmanager --install "system-images;android-32;google_apis;arm64-v8a"
|
|
sdkmanager --install "system-images;android-25;default;armeabi-v7a"
|
|
avdmanager create avd --force --name my-android-emulator-aarch64 --package "system-images;android-32;google_apis;arm64-v8a"
|
|
avdmanager create avd --force --name my-android-emulator-armv7 --package "system-images;android-25;default;armeabi-v7a"
|
|
echo "Android emulators set up successfully"
|
|
|
|
- name: Start Android Emulator (AArch64)
|
|
run: |
|
|
emulator -avd my-android-emulator-aarch64 -no-window -no-audio -no-boot-anim -no-snapshot -accel on -gpu swiftshader_indirect &
|
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
|
|
echo "AArch64 emulator started successfully"
|
|
|
|
- name: Download and Install Termux
|
|
run: |
|
|
wget -O termux.apk https://f-droid.org/repo/com.termux_118.apk
|
|
adb install termux.apk
|
|
echo "Termux installed successfully"
|
|
|
|
- name: Push and Execute Build Script in Termux (AArch64)
|
|
run: |
|
|
adb push myscript.sh /data/data/com.termux/files/home/myscript.sh
|
|
adb shell chmod +x /data/data/com.termux/files/home/myscript.sh
|
|
adb shell /data/data/com.termux/files/home/myscript.sh aarch64
|
|
echo "Build for AArch64 completed successfully"
|
|
|
|
- name: Start Android Emulator (ARMv7)
|
|
run: |
|
|
emulator -avd my-android-emulator-armv7 -no-window -no-audio -no-boot-anim -no-snapshot -accel on -gpu swiftshader_indirect &
|
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;'
|
|
echo "ARMv7 emulator started successfully"
|
|
|
|
- name: Push and Execute Build Script in Termux (ARMv7)
|
|
run: |
|
|
adb push myscript.sh /data/data/com.termux/files/home/myscript.sh
|
|
adb shell chmod +x /data/data/com.termux/files/home/myscript.sh
|
|
adb shell /data/data/com.termux/files/home/myscript.sh armv7
|
|
echo "Build for ARMv7 completed successfully"
|
|
|
|
- name: Retrieve Built APKs
|
|
run: |
|
|
adb pull /data/data/com.termux/files/home/build/us_pc/sm64coopdx-armv7.apk ./sm64coopdx-armv7.apk
|
|
adb pull /data/data/com.termux/files/home/build/us_pc/sm64coopdx-aarch64.apk ./sm64coopdx-aarch64.apk
|
|
echo "APKs pulled successfully"
|
|
|
|
- name: Upload Built APKs
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: sm64coopdx-apks
|
|
path: |
|
|
./sm64coopdx-armv7.apk
|
|
./sm64coopdx-aarch64.apk
|