Build for multi arch #15417
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Android - Build and test | |
on: | |
workflow_dispatch: | |
push: | |
jobs: | |
generate-debug-keystore: | |
name: Generate debug keystore (migrate to secret) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate keystore | |
run: >- | |
keytool -genkey | |
-keystore debug.keystore | |
-storepass android | |
-alias androiddebugkey | |
-keypass android | |
-keyalg RSA | |
-keysize 2048 | |
-validity 10000 | |
-dname "CN=Android Debug,O=Android,C=US" | |
- name: Upload keystore | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-keystore | |
path: debug.keystore | |
if-no-files-found: error | |
retention-days: 7 | |
generate-relay-list: | |
name: Generate relay list (migrate to secret) | |
runs-on: se-got-github-runner-006 | |
steps: | |
- name: Get date | |
id: get-date | |
shell: bash | |
run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
- name: Cache | |
uses: actions/cache@v4 | |
id: cache-relay-list | |
with: | |
path: android/app/build/extraAssets/relays.json | |
key: relay-list-${{ steps.get-date.outputs.date }} | |
- name: Checkout repository | |
if: steps.cache-relay-list.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
- name: Generate | |
if: steps.cache-relay-list.outputs.cache-hit != 'true' | |
env: | |
CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
run: | | |
mkdir -p android/app/build/extraAssets | |
./building/container-run.sh android cargo run --bin relay_list > android/app/build/extraAssets/relays.json | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: relay-list | |
path: android/app/build/extraAssets/relays.json | |
if-no-files-found: error | |
retention-days: 7 | |
build-native: | |
name: Build native | |
runs-on: se-got-github-runner-006 | |
strategy: | |
matrix: | |
include: | |
- arch: "x86_64" | |
abi: "x86_64" | |
target: "x86_64-linux-android" | |
# - arch: "i686" | |
# abi: "x86" | |
# target: "i686-linux-android" | |
- arch: "aarch64" | |
abi: "arm64-v8a" | |
target: "aarch64-linux-android" | |
# - arch: "armv7" | |
# abi: "armeabi-v7a" | |
# target: "armv7-linux-androideabi" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Checkout wireguard-go-rs recursively | |
run: | | |
git config --global --add safe.directory '*' | |
git submodule update --init --recursive --depth=1 wireguard-go-rs | |
- name: Build native | |
env: | |
CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
run: ./building/container-run.sh android bash -c "ARCHITECTURES=${{ matrix.arch }} ./build-apk.sh --dev-build --skip-apk" | |
- name: Upload native libs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: native-libs-${{ matrix.arch }} | |
path: android/app/build/extraJni | |
if-no-files-found: error | |
retention-days: 7 | |
build-app: | |
name: Build app | |
runs-on: se-got-github-runner-006 | |
needs: [generate-debug-keystore] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: debug-keystore | |
path: .android | |
- name: Compile debug app | |
env: | |
CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
run: ./building/container-run.sh android android/gradlew -p android compileOssProdDebugKotlin | |
- name: Wait for other jobs (native, relay list) | |
uses: kachick/wait-other-jobs@v2.0.3 | |
with: | |
wait-list: | | |
[ | |
{ | |
"workflowFile": "android-app.yml", | |
"jobName": "build-native" | |
}, | |
{ | |
"workflowFile": "android-app.yml", | |
"jobName": "generate-relay-list" | |
} | |
] | |
- uses: actions/download-artifact@v4 | |
with: | |
name: relay-list | |
path: android/app/build/extraAssets | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: native-libs-* | |
name: native-libs | |
path: android/app/build/extraJni | |
merge-multiple: true | |
- name: Temp maybenot fix | |
run: touch android/app/build/extraAssets/maybenot_machines_v2 | |
- name: Assemble debug app | |
env: | |
CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
run: ./building/container-run.sh android android/gradlew -p android assembleOssProdDebug | |
- name: Upload apks | |
uses: actions/upload-artifact@v3 | |
with: | |
name: apks | |
path: android/app/build/outputs/apk | |
if-no-files-found: error | |
retention-days: 7 | |
build-test-apps: | |
name: Build test apps | |
runs-on: se-got-github-runner-006 | |
needs: generate-debug-keystore | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: debug-keystore | |
path: .android | |
- name: Build test apps | |
env: | |
CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
run: ./building/container-run.sh android android/gradlew -p android assembleOssProdAndroidTest | |
# run-lint-and-tests: | |
# name: Run lint and test tasks | |
# needs: generate-debug-keystore | |
# runs-on: se-got-github-runner-006 | |
# strategy: | |
# fail-fast: false | |
# max-parallel: 1 | |
# matrix: | |
# include: | |
# - gradle-task: testDebugUnitTest -x :test:arch:testDebugUnitTest :app:testOssProdDebugUnitTest :service:testOssProdDebugUnitTest :lib:billing:testDebugUnitTest :lib:daemon-grpc:testDebugUnitTest :lib:shared:testDebugUnitTest | |
# - gradle-task: :test:arch:test --rerun-tasks | |
# - gradle-task: detekt | |
# - gradle-task: lint | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - uses: actions/download-artifact@v4 | |
# with: | |
# name: debug-keystore | |
# path: .android | |
# - name: Run gradle test task | |
# env: | |
# CARGO_TARGET_VOLUME_NAME: cargo-target-${{ runner.name }} | |
# CARGO_REGISTRY_VOLUME_NAME: cargo-cache-${{ runner.name }} | |
# GRADLE_CACHE_VOLUME_NAME: gradle-cache-${{ runner.name }} | |
# run: ./building/container-run.sh android android/gradlew -p android ${{ matrix.gradle-task }} |