mirror of
https://github.com/foxhole-team/foxhole-guard.git
synced 2026-10-21 10:45:41 +02:00
84a78ce32c
Bumps the github-actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `5.1.0` | `7.0.1` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `6.0.0` | `7.0.1` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `7.0.0` | `8.0.1` | | [reactivecircus/android-emulator-runner](https://github.com/reactivecircus/android-emulator-runner) | `2.36.0` | `2.38.0` | | [android-actions/setup-android](https://github.com/android-actions/setup-android) | `4.0.1` | `4.0.4` | Updates `actions/checkout` from 5.1.0 to 7.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09...3d3c42e5aac5ba805825da76410c181273ba90b1) Updates `actions/upload-artifact` from 6.0.0 to 7.0.1 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/b7c566a772e6b6bfb58ed0dc250532a479d7789f...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a) Updates `actions/download-artifact` from 7.0.0 to 8.0.1 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/37930b1c2abaa49bbe596cd826c3c89aef350131...3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c) Updates `reactivecircus/android-emulator-runner` from 2.36.0 to 2.38.0 - [Release notes](https://github.com/reactivecircus/android-emulator-runner/releases) - [Changelog](https://github.com/ReactiveCircus/android-emulator-runner/blob/main/CHANGELOG.md) - [Commits](https://github.com/reactivecircus/android-emulator-runner/compare/5d6e86df22ab11632167a1a6b0c9ab0dc3469586...a421e43855164a8197daf9d8d40fe71c6996bb0d) Updates `android-actions/setup-android` from 4.0.1 to 4.0.4 - [Release notes](https://github.com/android-actions/setup-android/releases) - [Commits](https://github.com/android-actions/setup-android/compare/40fd30fb8d7440372e1316f5d1809ec01dcd3699...be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: actions/download-artifact dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: reactivecircus/android-emulator-runner dependency-version: 2.38.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: android-actions/setup-android dependency-version: 4.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
283 lines
11 KiB
YAML
283 lines
11 KiB
YAML
name: android
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
pull_request:
|
|
paths:
|
|
- ".github/**"
|
|
- "app/**"
|
|
- "config/**"
|
|
- "core/**"
|
|
- "macrobenchmark/**"
|
|
- "gradlew"
|
|
- "gradlew.bat"
|
|
- "gradle/**"
|
|
- "scripts/**"
|
|
- "metadata/**"
|
|
- "third_party/**"
|
|
- "build.gradle.kts"
|
|
- "settings.gradle.kts"
|
|
- "gradle.properties"
|
|
workflow_dispatch:
|
|
inputs:
|
|
foxcore_smoke_only:
|
|
description: "Only build and verify the pinned FoxCore JNI artifact"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
security_scan_only:
|
|
description: "Only run secret and dependency vulnerability scans"
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: android-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
verify:
|
|
name: build/unit/security verified
|
|
runs-on: ubuntu-24.04
|
|
# A cold public checkout compiles FoxCore, i2pd and the Tor transports from source, so the timeout must clear GitHub's uncached network.
|
|
timeout-minutes: 90
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: setup Android and FoxHole Core build
|
|
uses: ./.github/actions/setup-foxcore
|
|
with:
|
|
core-repository: ${{ vars.FOXCORE_REPO || 'foxhole-team/foxhole-core' }}
|
|
|
|
- name: pinned FoxCore native smoke
|
|
if: github.event_name == 'workflow_dispatch' && inputs.foxcore_smoke_only
|
|
run: ./gradlew --no-daemon --console=plain --stacktrace :app:prepareFoxCoreNative
|
|
|
|
- name: release provenance regression tests
|
|
run: python3 -m unittest discover -s scripts/tests -p "test_*.py"
|
|
|
|
# Run the cheap security gates before the cold native build so a policy failure is fast.
|
|
- name: secret scan
|
|
if: github.event_name != 'workflow_dispatch' || inputs.security_scan_only || !inputs.foxcore_smoke_only
|
|
run: scripts/run-gitleaks-scan.sh
|
|
|
|
- name: mandatory dependency vulnerability scan
|
|
if: github.event_name != 'workflow_dispatch' || inputs.security_scan_only || !inputs.foxcore_smoke_only
|
|
run: scripts/run-osv-source-scan.sh
|
|
|
|
- name: verify wrapper
|
|
if: github.event_name != 'workflow_dispatch' || (!inputs.foxcore_smoke_only && !inputs.security_scan_only)
|
|
run: ./gradlew --no-daemon --console=plain --version
|
|
|
|
- name: static analysis, lint, unit tests, and coverage
|
|
if: github.event_name != 'workflow_dispatch' || (!inputs.foxcore_smoke_only && !inputs.security_scan_only)
|
|
run: ./gradlew --no-daemon --console=plain --stacktrace :app:detekt verifyDetektBaseline :app:lintDebug :app:lintRelease :app:lintVitalRelease :app:testDebugUnitTest jacocoDebugUnitTestReport jacocoDebugUnitTestCoverageVerification verifyReleaseBuildConfigDefaults
|
|
|
|
- name: build debug APK
|
|
if: github.event_name != 'workflow_dispatch' || (!inputs.foxcore_smoke_only && !inputs.security_scan_only)
|
|
run: ./gradlew --no-daemon --console=plain --stacktrace :app:assembleDebug
|
|
|
|
device-build:
|
|
name: build Android device test APKs once
|
|
needs: verify
|
|
if: github.event_name != 'workflow_dispatch' || (!inputs.foxcore_smoke_only && !inputs.security_scan_only)
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 90
|
|
env:
|
|
CARGO_BUILD_JOBS: "2"
|
|
I2PD_BUILD_JOBS: "2"
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
- name: setup Android and FoxHole Core build
|
|
uses: ./.github/actions/setup-foxcore
|
|
with:
|
|
core-repository: ${{ vars.FOXCORE_REPO || 'foxhole-team/foxhole-core' }}
|
|
android-abis: x86_64
|
|
- name: build the emulator APK from source
|
|
run: |
|
|
./gradlew --no-daemon --max-workers=2 --console=plain -Pfoxhole.abis=x86_64 \
|
|
:app:assembleDebug :app:assembleDebugAndroidTest :core:runtime:assembleDebugAndroidTest
|
|
- name: store exact device test APKs
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: device-test-apks-${{ github.sha }}
|
|
path: |
|
|
app/build/outputs/apk/debug/*.apk
|
|
app/build/outputs/apk/androidTest/debug/*.apk
|
|
core/runtime/build/outputs/apk/androidTest/debug/*.apk
|
|
retention-days: 3
|
|
if-no-files-found: error
|
|
|
|
- name: retain native build diagnostics
|
|
if: failure()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: device-build-diagnostics-${{ github.sha }}
|
|
path: app/build/reports/
|
|
retention-days: 3
|
|
|
|
device:
|
|
name: Android device boundaries (API ${{ matrix.api }})
|
|
needs: device-build
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# The API 37 image fails APK installation before instrumentation starts.
|
|
# API 26 and 34 retain device coverage until that image can run the suites.
|
|
api: ["26", "34"]
|
|
steps:
|
|
- name: checkout device runner
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: download the single verified device build
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: device-test-apks-${{ github.sha }}
|
|
path: device-apks
|
|
- name: enable emulator acceleration
|
|
run: |
|
|
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
|
|
sudo udevadm control --reload-rules
|
|
sudo udevadm trigger --name-match=kvm
|
|
- name: execute device regression tests
|
|
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
|
|
with:
|
|
api-level: ${{ matrix.api }}
|
|
target: google_apis
|
|
arch: x86_64
|
|
cores: 2
|
|
ram-size: 2048M
|
|
disk-size: 6G
|
|
disable-animations: true
|
|
emulator-options: -no-window -no-audio -no-boot-anim -no-snapshot -gpu swiftshader_indirect
|
|
script: bash scripts/run-packaged-device-tests.sh device-apks
|
|
- name: retain device test reports
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: android-device-api-${{ matrix.api }}-${{ github.sha }}
|
|
path: build/reports/device/
|
|
if-no-files-found: warn
|
|
retention-days: 7
|
|
|
|
release-candidate:
|
|
name: signed release candidate
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
|
needs: [verify, device]
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 90
|
|
steps:
|
|
- name: checkout verified dev commit
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: setup Android and FoxHole Core build
|
|
uses: ./.github/actions/setup-foxcore
|
|
with:
|
|
core-repository: ${{ vars.FOXCORE_REPO || 'foxhole-team/foxhole-core' }}
|
|
|
|
- name: prepare release signing inputs
|
|
shell: bash
|
|
env:
|
|
FOXHOLE_RELEASE_STORE_FILE_B64: ${{ secrets.FOXHOLE_RELEASE_STORE_FILE_B64 }}
|
|
FOXHOLE_RELEASE_STORE_PASSWORD: ${{ secrets.FOXHOLE_RELEASE_STORE_PASSWORD }}
|
|
FOXHOLE_RELEASE_KEY_ALIAS: ${{ secrets.FOXHOLE_RELEASE_KEY_ALIAS }}
|
|
FOXHOLE_RELEASE_KEY_PASSWORD: ${{ secrets.FOXHOLE_RELEASE_KEY_PASSWORD }}
|
|
FOXHOLE_RELEASE_STORE_TYPE: ${{ secrets.FOXHOLE_RELEASE_STORE_TYPE }}
|
|
run: |
|
|
set -euo pipefail
|
|
missing=()
|
|
for secret_name in \
|
|
FOXHOLE_RELEASE_STORE_FILE_B64 \
|
|
FOXHOLE_RELEASE_STORE_PASSWORD \
|
|
FOXHOLE_RELEASE_KEY_ALIAS \
|
|
FOXHOLE_RELEASE_KEY_PASSWORD
|
|
do
|
|
if [[ -z "${!secret_name:-}" ]]; then
|
|
missing+=("$secret_name")
|
|
fi
|
|
done
|
|
if (( ${#missing[@]} > 0 )); then
|
|
printf 'Release signing secrets are required. Missing: %s\n' "${missing[*]}" >&2
|
|
exit 1
|
|
fi
|
|
keystore_path="$RUNNER_TEMP/foxhole-release.p12"
|
|
if ! printf '%s' "$FOXHOLE_RELEASE_STORE_FILE_B64" | base64 --decode > "$keystore_path"; then
|
|
echo "FOXHOLE_RELEASE_STORE_FILE_B64 is not valid base64" >&2
|
|
exit 1
|
|
fi
|
|
chmod 600 "$keystore_path"
|
|
{
|
|
echo "FOXHOLE_RELEASE_STORE_FILE=$keystore_path"
|
|
echo "FOXHOLE_RELEASE_STORE_PASSWORD=$FOXHOLE_RELEASE_STORE_PASSWORD"
|
|
echo "FOXHOLE_RELEASE_KEY_ALIAS=$FOXHOLE_RELEASE_KEY_ALIAS"
|
|
echo "FOXHOLE_RELEASE_KEY_PASSWORD=$FOXHOLE_RELEASE_KEY_PASSWORD"
|
|
echo "FOXHOLE_RELEASE_STORE_TYPE=${FOXHOLE_RELEASE_STORE_TYPE:-PKCS12}"
|
|
} >> "$GITHUB_ENV"
|
|
|
|
- name: resolve published versionCode floor
|
|
id: published
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
version_code="$(scripts/package-release-candidate.sh published-code "$GITHUB_REPOSITORY")"
|
|
echo "version_code=$version_code" >> "$GITHUB_OUTPUT"
|
|
|
|
# This signed candidate approves the source tree before main builds the tagged release.
|
|
- name: build and verify signed GitHub and F-Droid candidates
|
|
run: scripts/build-release-variants.sh "${{ steps.published.outputs.version_code }}"
|
|
|
|
- name: package immutable candidate
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
candidate_dir="$RUNNER_TEMP/foxhole-release-candidate"
|
|
source_tree="$(git rev-parse 'HEAD^{tree}')"
|
|
FOXHOLE_SBOM_PATH=build/reports/cyclonedx/bom.json \
|
|
scripts/package-release-candidate.sh \
|
|
prepare \
|
|
"$candidate_dir" \
|
|
"$GITHUB_SHA" \
|
|
"$source_tree"
|
|
|
|
- name: upload immutable candidate
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: foxhole-app-${{ github.sha }}
|
|
path: ${{ runner.temp }}/foxhole-release-candidate/*
|
|
if-no-files-found: error
|
|
retention-days: 3
|
|
compression-level: 0
|
|
|
|
# Mapping and native symbols stay authenticated Actions artifacts, never attached to the public release.
|
|
- name: retain private diagnostics
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: foxhole-private-diagnostics-${{ github.sha }}
|
|
path: |
|
|
build/release-variants/*/mapping.txt
|
|
app/build/outputs/mapping/publicRelease/mapping.txt
|
|
app/build/outputs/native-debug-symbols/publicRelease/publicRelease-native-symbols.zip
|
|
if-no-files-found: error
|
|
retention-days: 3
|