This repository was archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
94 lines (79 loc) · 2.73 KB
/
flutter_android_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Adapted from https://github.com/fzyzcjy/flutter_rust_bridge repo
on:
workflow_call:
inputs:
flutter_version:
required: false
type: string
default: "3.3.1"
rust_version:
required: false
type: string
default: "1.64.0"
device:
required: true
type: string
timeout_minutes:
required: false
type: number
default: 20
jobs:
flutter_android_test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
# #499, https://github.com/actions/virtual-environments/issues/5595
- name: Configure ndk
run: |
ANDROID_HOME=$HOME/Library/Android/sdk
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager
echo y | $SDKMANAGER "ndk;21.4.7075529"
ln -sfn $ANDROID_HOME/ndk/21.4.7075529 $ANDROID_HOME/ndk-bundle
- name: Setup rust toolchain
run: rustup show
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ inputs.flutter_version }}
architecture: x64
- name: Install FFI bindings
run: cargo install flutter_rust_bridge_codegen
- name: Generate FFI bindings
run: make gen
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "8.x" # "betterprogramming.pub" says must be java "8"
cache: "gradle"
- uses: actions/cache@v3
id: cache-deps
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./rust/target
key: ${{ runner.os }}-cargo-integrate-android-${{ hashFiles('**/Cargo.lock') }}-${{ steps.checkout.outputs.rustc_hash }}
- name: Add Rust targets
run: rustup target add x86_64-linux-android
- name: Install `cargo-ndk`
if: steps.cache-deps.outputs.cache-hit != 'true'
run: cargo install cargo-ndk --force
- name: Install Flutter dependencies
run: flutter pub get
- name: Build Rust lib
working-directory: ./rust
# NOTE since run on simulator, need -t to be x86_64. For real devices, of course arm-like ones.
run: cargo ndk -t x86_64 -o ../android/app/src/main/jniLibs build
- name: Run Flutter integration tests
continue-on-error: true
timeout-minutes: ${{ inputs.timeout_minutes }}
uses: Wandalen/[email protected]
with:
action: reactivecircus/android-emulator-runner@v2
with: |
api-level: 29
arch: x86_64
profile: ${{ inputs.device }}
script: flutter test integration_test --verbose