Files
client/.gitea/workflows/android.yml
T
bit9992 6e69516f79
android-ci / android-arm64 (push) Failing after 14m36s
Restore normal Android release builds on migrated runner
2026-11-12 11:43:27 +03:00

221 lines
9.4 KiB
YAML

# Trusted mobile-branch pushes only; never execute fork pull requests on the shared runner.
# Installs occur only inside the disposable Ubuntu container. No releases or phone actions.
name: android-ci
on:
push:
branches: [feature/mobile-port]
workflow_dispatch:
inputs:
mode:
description: Build the test APK, or inspect resources only
required: true
default: build
type: choice
options: [build, inventory]
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
android-arm64:
runs-on: ubuntu-latest
container:
image: ubuntu:24.04
timeout-minutes: 360
env:
TARGET: aarch64-linux-android
EXPECTED_REVISION: ${{ github.sha }}
CI_RUN_ID: ${{ github.run_id }}
ANDROID_CI_PROVISION: container
CARGO_TERM_COLOR: never
CARGO_BUILD_JOBS: "4"
CARGO_TARGET_DIR: ${{ github.workspace }}/.android-ci/cargo-target
CMAKE_BUILD_PARALLEL_LEVEL: "4"
steps:
- name: Resource gate before checkout, cache restore or tool installation
id: resources
run: |
set -euo pipefail
test "$(uname -s)" = Linux
test "$(uname -m)" = x86_64
test -f /.dockerenv
printf 'Architecture: '; uname -m
printf 'CPU count: '; getconf _NPROCESSORS_ONLN
df -Pk . /
while IFS=: read -r key value; do
case "$key" in MemTotal|MemAvailable) printf '%s:%s\n' "$key" "$value" ;; esac
done < /proc/meminfo
if [ '${{ github.event.inputs.mode }}' = inventory ]; then exit 0; fi
for path in . /; do
free=$(df --output=avail -B1 "$path")
free=${free##*$'\n'}
if ! [[ "$free" =~ ^[[:space:]]*[0-9]+[[:space:]]*$ ]] || (( free < 107374182400 )); then
echo "BLOCKED: Android cold source build requires 100 GiB free on workspace and container root; no tools installed. Ask runner administrator for build storage."
exit 1
fi
done
available=0
while read -r key value unit; do if [ "$key" = MemAvailable: ]; then available=$value; fi; done < /proc/meminfo
if (( available < 8388608 )); then echo 'BLOCKED: at least 8 GiB available RAM required'; exit 1; fi
- name: Bootstrap utilities inside the disposable job container
if: ${{ github.event.inputs.mode != 'inventory' }}
run: |
set -euo pipefail
test -f /.dockerenv
test "$(id -u)" = 0
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends ca-certificates git nodejs python3 zstd
- uses: actions/checkout@v4
if: ${{ github.event.inputs.mode != 'inventory' }}
with:
clean: true
persist-credentials: false
- name: Restore isolated tool and Cargo cache
if: ${{ github.event.inputs.mode != 'inventory' }}
id: cache
uses: actions/cache/restore@v3
with:
path: |
.android-ci/tools/downloads
.android-ci/tools/rustup
.android-ci/tools/cargo
.android-ci/tools/android-sdk
.android-ci/tools/skia-m153-0.101.2
.android-ci/tools/gradle
.android-ci/cargo-target
key: android-arm64-v1-${{ hashFiles('.gitea/android-ci-tools.json', '.gitea/setup-android-ci.sh', 'Cargo.lock', 'rust-toolchain.toml', 'platform/android/gradle/wrapper/gradle-wrapper.properties') }}-${{ github.sha }}
restore-keys: |
android-arm64-v1-${{ hashFiles('.gitea/android-ci-tools.json', '.gitea/setup-android-ci.sh', 'Cargo.lock', 'rust-toolchain.toml', 'platform/android/gradle/wrapper/gradle-wrapper.properties') }}-
- name: Provision pinned Android tools in the job container
if: ${{ github.event.inputs.mode != 'inventory' }}
id: tools
run: bash .gitea/setup-android-ci.sh
- name: Require exact revision and no production signing
if: ${{ github.event.inputs.mode != 'inventory' }}
run: |
set -euo pipefail
test "$(git rev-parse HEAD)" = "$EXPECTED_REVISION"
test ! -e dist/android
for name in TEAMSPEACH_ANDROID_KEYSTORE TEAMSPEACH_ANDROID_STORE_PASSWORD TEAMSPEACH_ANDROID_KEY_ALIAS TEAMSPEACH_ANDROID_KEY_PASSWORD; do
if [[ -v "$name" ]]; then echo 'Production signing environment forbidden in test CI'; exit 1; fi
done
cargo run --locked -p xtask -- check-version
cargo test --locked -p xtask
- name: Compute source dependency cache identity
if: ${{ github.event.inputs.mode != 'inventory' }}
id: dependency-key
run: |
python3 - <<'PY'
import hashlib, json, os, pathlib
policy = json.loads(pathlib.Path('native/native-deps.lock.json').read_text())
policy.pop('builds', None)
digest = hashlib.sha256(json.dumps(policy, sort_keys=True, separators=(',', ':')).encode())
for name in ('.gitea/android-ci-tools.json', 'xtask/src/deps.rs', 'xtask/src/build_native.rs'):
digest.update(name.encode() + b'\0' + pathlib.Path(name).read_bytes())
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
out.write('key=android-webrtc-linux-arm64-v1-' + digest.hexdigest() + '\n')
PY
- name: Restore pinned WebRTC source and object checkpoint
if: ${{ github.event.inputs.mode != 'inventory' }}
id: webrtc-cache
uses: actions/cache/restore@v3
with:
path: target/native-deps/aarch64-linux-android
key: ${{ steps.dependency-key.outputs.key }}
# Source provenance is regenerated and verified, never trusted from an Actions cache.
- name: Build pinned WebRTC dependencies with bounded CI parallelism
if: ${{ github.event.inputs.mode != 'inventory' }}
id: dependencies
run: |
set -euo pipefail
python3 .gitea/prepare-android-dependency-cache.py
cargo run --locked -p xtask -- deps --target "$TARGET" --llvm-dir "$LLVM_HOME" --jobs "$CARGO_BUILD_JOBS"
- name: Checkpoint verified WebRTC before application build
if: ${{ success() && github.event.inputs.mode != 'inventory' && steps.webrtc-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: target/native-deps/aarch64-linux-android
key: ${{ steps.dependency-key.outputs.key }}
- name: Checkpoint provisioned tools before application build
if: ${{ success() && github.event.inputs.mode != 'inventory' && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: |
.android-ci/tools/downloads
.android-ci/tools/rustup
.android-ci/tools/cargo
.android-ci/tools/android-sdk
.android-ci/tools/skia-m153-0.101.2
.android-ci/tools/gradle
.android-ci/cargo-target
key: ${{ steps.cache.outputs.cache-primary-key }}-checkpoint
- name: Build and verify full-feature test APK
if: ${{ github.event.inputs.mode != 'inventory' }}
run: |
set -euo pipefail
export TEAMSPEACH_ANDROID_LOW_MEMORY=false
unset RUSTC_WORKSPACE_WRAPPER
mkdir -p .android-ci/diagnostics
bash .gitea/android-memory-report.sh | tee .android-ci/diagnostics/before.txt
trap 'status=$?; trap - EXIT; bash .gitea/android-memory-report.sh | tee .android-ci/diagnostics/after.txt; exit "$status"' EXIT
/usr/bin/time -v -o .android-ci/diagnostics/build-time.txt bash .gitea/build-android-variant.sh harness
- name: Report container memory evidence on build failure
if: ${{ always() && steps.tools.outcome == 'success' && github.event.inputs.mode != 'inventory' }}
run: |
set -eu
if [ -f .android-ci/diagnostics/build-time.txt ]; then cat .android-ci/diagnostics/build-time.txt; fi
bash .gitea/android-memory-report.sh
- name: Retain native compiler resource diagnostics
if: ${{ always() && steps.tools.outcome == 'success' && github.event.inputs.mode != 'inventory' }}
uses: actions/upload-artifact@v3
with:
name: android-build-resources-${{ github.sha }}
path: .android-ci/diagnostics/*.txt
if-no-files-found: warn
retention-days: 7
- name: Upload installable Android test APK and provenance
if: ${{ github.event.inputs.mode != 'inventory' }}
uses: actions/upload-artifact@v3
with:
name: android-harness-arm64-${{ github.sha }}
path: |
dist/android/harness/*-harness-test.apk
dist/android/harness/build-info.json
dist/android/harness/aarch64-linux-android/*.json
if-no-files-found: error
retention-days: 14
- name: Save verified build tool and Cargo cache
if: ${{ success() && github.event.inputs.mode != 'inventory' && steps.cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v3
with:
path: |
.android-ci/tools/downloads
.android-ci/tools/rustup
.android-ci/tools/cargo
.android-ci/tools/android-sdk
.android-ci/tools/skia-m153-0.101.2
.android-ci/tools/gradle
.android-ci/cargo-target
key: ${{ steps.cache.outputs.cache-primary-key }}