mirror of
https://github.com/foxhole-team/foxhole-guard.git
synced 2026-10-21 10:45:41 +02:00
099e864dd7
Fix profile mutation, notification authorization, runtime ownership and WebApp isolation boundaries. Refresh native dependencies and verify the shipped dependency inventory. Add white accent and monochrome themes with the OpenWrt launcher icon; preserve application icons and flags in color. Restore standard update-source actions. Pin published Core 0.0.5, reuse authenticated release artifacts and run Android boundary tests across supported API levels. Update F-Droid source recipe and release notes.
147 lines
5.7 KiB
YAML
147 lines
5.7 KiB
YAML
name: setup Android and FoxHole Core build
|
|
description: >-
|
|
Install the pinned Java, Android SDK and NDK inputs, fetch the pinned FoxHole Core source,
|
|
and install the Rust toolchain the core pins in its own rust-toolchain.toml.
|
|
|
|
inputs:
|
|
core-repository:
|
|
description: >-
|
|
GitHub repository containing the FoxHole Core workspace. Workflows pass
|
|
`vars.FOXCORE_REPO` here with this default as the fallback placeholder.
|
|
required: false
|
|
default: foxhole-team/foxhole-core
|
|
android-abis:
|
|
description: Space-separated Android ABIs to compile from the pinned native sources.
|
|
required: false
|
|
default: arm64-v8a
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: read pinned FoxHole Core revision
|
|
id: foxcore-pin
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
revision="$(tr -d '[:space:]' < config/foxcore-revision.txt)"
|
|
if [[ ! "$revision" =~ ^[0-9a-f]{40}$ ]]; then
|
|
echo "config/foxcore-revision.txt must contain one full Git commit SHA." >&2
|
|
exit 1
|
|
fi
|
|
echo "revision=$revision" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: checkout pinned public FoxHole Core
|
|
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
|
with:
|
|
repository: ${{ inputs.core-repository }}
|
|
ref: ${{ steps.foxcore-pin.outputs.revision }}
|
|
path: .foxcore-src
|
|
persist-credentials: false
|
|
|
|
- name: setup Java
|
|
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: setup Gradle
|
|
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5
|
|
|
|
- name: install the Rust toolchain pinned by the FoxHole Core workspace
|
|
shell: bash
|
|
env:
|
|
FOXHOLE_ANDROID_ABIS: ${{ inputs.android-abis }}
|
|
run: |
|
|
set -euo pipefail
|
|
# rustup honours the core's rust-toolchain.toml inside .foxcore-src; FOXCORE_RUST_TOOLCHAIN
|
|
# lets steps outside that directory use the same pin.
|
|
toolchain_file=".foxcore-src/rust-toolchain.toml"
|
|
if [[ ! -f "$toolchain_file" ]]; then
|
|
echo "FoxHole Core checkout has no rust-toolchain.toml; the pinned core must declare its toolchain." >&2
|
|
exit 1
|
|
fi
|
|
toolchain="$(sed -n 's/^[[:space:]]*channel[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' "$toolchain_file" | head -n 1)"
|
|
if [[ -z "$toolchain" ]]; then
|
|
echo "Could not read channel from $toolchain_file" >&2
|
|
exit 1
|
|
fi
|
|
rustup toolchain install "$toolchain" --profile minimal --component clippy --component rustfmt
|
|
targets=()
|
|
for abi in $FOXHOLE_ANDROID_ABIS; do
|
|
case "$abi" in
|
|
arm64-v8a) targets+=(aarch64-linux-android) ;;
|
|
armeabi-v7a) targets+=(armv7-linux-androideabi) ;;
|
|
x86_64) targets+=(x86_64-linux-android) ;;
|
|
*) echo "Unsupported Android ABI: $abi" >&2; exit 1 ;;
|
|
esac
|
|
done
|
|
(( ${#targets[@]} > 0 )) || { echo "At least one Android ABI is required" >&2; exit 1; }
|
|
rustup target add --toolchain "$toolchain" "${targets[@]}"
|
|
echo "FOXCORE_RUST_TOOLCHAIN=$toolchain" >> "$GITHUB_ENV"
|
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
|
|
|
- name: cache pinned Rust build intermediates
|
|
uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2
|
|
with:
|
|
workspaces: .foxcore-src -> target
|
|
shared-key: guard-${{ inputs.android-abis }}
|
|
cache-on-failure: false
|
|
|
|
- name: install pinned Android SDK and NDK
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
ANDROID_SDK_ROOT="${ANDROID_SDK_ROOT:-${ANDROID_HOME:-/usr/local/lib/android/sdk}}"
|
|
if [[ ! -d "$ANDROID_SDK_ROOT" ]]; then
|
|
echo "Android SDK root not found: $ANDROID_SDK_ROOT" >&2
|
|
exit 1
|
|
fi
|
|
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"
|
|
if [[ ! -x "$SDKMANAGER" ]]; then
|
|
SDKMANAGER="$(find "$ANDROID_SDK_ROOT/cmdline-tools" -path '*/bin/sdkmanager' | sort | tail -n 1)"
|
|
fi
|
|
if [[ -z "${SDKMANAGER:-}" || ! -x "$SDKMANAGER" ]]; then
|
|
echo "sdkmanager not found under $ANDROID_SDK_ROOT/cmdline-tools" >&2
|
|
exit 1
|
|
fi
|
|
{
|
|
echo "ANDROID_HOME=$ANDROID_SDK_ROOT"
|
|
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
|
|
echo "ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/29.0.14206865"
|
|
echo "FOXCORE_SOURCE_ROOT=$GITHUB_WORKSPACE/.foxcore-src"
|
|
} >> "$GITHUB_ENV"
|
|
{
|
|
dirname "$SDKMANAGER"
|
|
echo "$ANDROID_SDK_ROOT/platform-tools"
|
|
} >> "$GITHUB_PATH"
|
|
set +o pipefail
|
|
yes | "$SDKMANAGER" --licenses >/dev/null
|
|
set -o pipefail
|
|
"$SDKMANAGER" --channel=3 \
|
|
"platform-tools" \
|
|
"platforms;android-37.0" \
|
|
"build-tools;37.0.0" \
|
|
"ndk;29.0.14206865"
|
|
|
|
- name: reuse the authenticated public Core ARM release
|
|
if: inputs.android-abis == 'arm64-v8a'
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: scripts/fetch-core-release.sh "$GITHUB_WORKSPACE/.foxcore-src" "$RUNNER_TEMP/foxcore-public-release" "${{ inputs.core-repository }}"
|
|
|
|
- name: fetch pinned native dependencies
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
scripts/fetch-native-deps.sh
|
|
|
|
- name: install cargo-ndk and fetch locked Rust dependencies
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ "$(cargo "+${FOXCORE_RUST_TOOLCHAIN:?}" ndk --version 2>/dev/null || true)" != "cargo-ndk 4.1.2" ]]; then
|
|
cargo "+${FOXCORE_RUST_TOOLCHAIN:?}" install cargo-ndk --version 4.1.2 --locked
|
|
fi
|
|
cargo "+${FOXCORE_RUST_TOOLCHAIN:?}" fetch --locked --manifest-path .foxcore-src/Cargo.toml
|