mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
e924df0e1a
# Objective Add two features to switch bevy to use `NativeActivity` or `GameActivity` on Android, use `GameActivity` by default. Also close #12058 and probably #12026 . ## Solution Add two features to the corresponding crates so you can toggle it, like what `winit` and `android-activity` crate did. --- ## Changelog Removed default `NativeActivity` feature implementation for Android, added two new features to enable `NativeActivity` and `GameActivity`, and use `GameActivity` by default. ## Migration Guide Because `cargo-apk` is not compatible with `GameActivity`, building/running using `cargo apk build/run -p bevy_mobile_example` is no longer possible. Users should follow the new workflow described in document. --------- Co-authored-by: François Mockers <francois.mockers@vleue.com> Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com> Co-authored-by: Rich Churcher <rich.churcher@gmail.com>
147 lines
4.6 KiB
YAML
147 lines
4.6 KiB
YAML
name: Daily Jobs
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 12 * * *'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-for-iOS:
|
|
if: github.repository == 'bevyengine/bevy'
|
|
runs-on: macos-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Add iOS targets
|
|
run: rustup target add aarch64-apple-ios x86_64-apple-ios
|
|
|
|
- name: Build app for iOS
|
|
run: |
|
|
cd examples/mobile
|
|
make xcodebuild-iphone
|
|
mkdir Payload
|
|
mv build/Build/Products/Debug-iphoneos/bevy_mobile_example.app Payload
|
|
zip -r bevy_mobile_example.zip Payload
|
|
mv bevy_mobile_example.zip bevy_mobile_example.ipa
|
|
|
|
- name: Upload to Browser Stack
|
|
run: |
|
|
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
|
|
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
|
|
-F "file=@examples/mobile/bevy_mobile_example.ipa" \
|
|
-F "custom_id=$GITHUB_RUN_ID"
|
|
|
|
build-for-Android:
|
|
if: github.repository == 'bevyengine/bevy'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
- name: Add Android targets
|
|
run: rustup target add aarch64-linux-android
|
|
|
|
- name: Install Cargo NDK
|
|
run: cargo install --force cargo-ndk
|
|
|
|
- name: Build .so file
|
|
run: cargo ndk -t arm64-v8a -o android_example/app/src/main/jniLibs build --package bevy_mobile_example
|
|
env:
|
|
# This will reduce the APK size from 1GB to ~200MB
|
|
CARGO_PROFILE_DEV_DEBUG: false
|
|
|
|
- name: Build app for Android
|
|
run: cd examples/mobile/android_example && chmod +x gradlew && ./gradlew build
|
|
|
|
- name: Upload to Browser Stack
|
|
run: |
|
|
curl -u "${{ secrets.BROWSERSTACK_USERNAME }}:${{ secrets.BROWSERSTACK_ACCESS_KEY }}" \
|
|
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
|
|
-F "file=@app/build/outputs/apk/debug/app-debug.apk" \
|
|
-F "custom_id=$GITHUB_RUN_ID"
|
|
|
|
nonce:
|
|
if: github.repository == 'bevyengine/bevy'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
outputs:
|
|
result: ${{ steps.nonce.outputs.result }}
|
|
steps:
|
|
- id: nonce
|
|
run: echo "result=${{ github.run_id }}-$(date +%s)" >> $GITHUB_OUTPUT
|
|
|
|
run:
|
|
if: github.repository == 'bevyengine/bevy'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
needs: [nonce, build-for-iOS, build-for-Android]
|
|
env:
|
|
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
|
|
PERCY_PARALLEL_TOTAL: ${{ strategy.job-total }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- device: "iPhone 13"
|
|
os_version: "15"
|
|
- device: "iPhone 14"
|
|
os_version: "16"
|
|
- device: "iPhone 15"
|
|
os_version: "17"
|
|
- device: "Xiaomi Redmi Note 11"
|
|
os_version: "11.0"
|
|
- device: "Google Pixel 6"
|
|
os_version: "12.0"
|
|
- device: "Samsung Galaxy S23"
|
|
os_version: "13.0"
|
|
- device: "Google Pixel 8"
|
|
os_version: "14.0"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run Example
|
|
run: |
|
|
cd .github/start-mobile-example
|
|
npm install
|
|
npm install -g @percy/cli@latest
|
|
npx percy app:exec --parallel -- npm run mobile
|
|
env:
|
|
BROWSERSTACK_APP_ID: ${{ github.run_id }}
|
|
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
|
|
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
|
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
|
DEVICE: ${{ matrix.device }}
|
|
OS_VERSION: ${{ matrix.os_version }}
|
|
|
|
- name: Save screenshots
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: screenshots-${{ matrix.device }}-${{ matrix.os_version }}
|
|
path: .github/start-mobile-example/*.png
|
|
|
|
check-result:
|
|
if: github.repository == 'bevyengine/bevy'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
needs: [run]
|
|
steps:
|
|
- name: Wait for screenshots comparison
|
|
run: |
|
|
npm install -g @percy/cli@latest
|
|
npx percy build:wait --project dede4209/Bevy-Mobile-Example --commit ${{ github.sha }} --fail-on-changes --pass-if-approved
|
|
env:
|
|
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|