-
Notifications
You must be signed in to change notification settings - Fork 33
114 lines (95 loc) · 4.14 KB
/
Copy pathtests-react-native.yaml
File metadata and controls
114 lines (95 loc) · 4.14 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Tests (React Native Android)
on:
workflow_dispatch:
jobs:
tests-react-native-android:
runs-on: ubuntu-latest
steps:
- name: Enable KVM
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: Checkout bee-js
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Install bee-js dependencies
run: npm ci
- name: Pack bee-js
run: echo "BEE_JS_PACK=$(npm pack --json | jq -r '.[0].filename')" >> $GITHUB_ENV
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.BEE_RUNNER_APP_ID }}
private-key: ${{ secrets.BEE_RUNNER_KEY }}
repositories: bee-js-react-native-test
- name: Checkout bee-js-react-native-test
uses: actions/checkout@v6
with:
repository: ethersphere/bee-js-react-native-test
path: rn-test
token: ${{ steps.app-token.outputs.token }}
- name: Install test project deps with local bee-js
working-directory: rn-test
# Drop the lockfile before installing the locally-packed bee-js so npm
# resolves the full transitive tree from scratch. With `npm ci` + a
# follow-up `npm install ../tgz`, npm dedupes against the already-pinned
# transitives and can leave stale versions (e.g. cafe-utility 33.x)
# even when the new bee-js declares a higher range.
run: |
rm -f package-lock.json
npm install ../${{ env.BEE_JS_PACK }}
- name: Probe Metro resolution per-package (pre-flight)
working-directory: rn-test
# Sub-second per-package resolution check: for each bee-js transitive
# asks Metro which file it would pick on Android, flags any landing on
# `.mjs`, and requires each resolved file in Node. Cheap diagnostic
# that prints a per-package pass/fail before the bundle probe runs.
run: npm run test:probe-resolution
- name: Bundle bee-js with Metro and load it (fast pre-flight)
working-directory: rn-test
# ~1-second check that produces the actual Metro bundle bee-js would
# ship to the device (Android conditions, Expo's resolver config), then
# evaluates it in Node with RN-shaped globals. Catches packaging
# regressions (broken exports map, CJS↔ESM interop bug, missing
# transitive) before spending 10 min on Gradle + emulator. Misses
# Hermes-specific behaviour and real bee-node interactions — those are
# what the emulator job below is for.
run: npm run test:probe
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Cache Gradle
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('rn-test/android/**/*.gradle*', 'rn-test/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: gradle-
- name: Install global dependencies
run: npm install --global @ethersphere/bee-factory @ethersphere/swarm-cli npxie
- name: Start bee-factory
run: bee-factory start --tag v2.8.0
- name: Create postage batch
run: echo "STAMP=$(swarm-cli stamp buy --depth 20 --amount 1b --quiet)" >> $GITHUB_ENV
- name: Build APK
working-directory: rn-test
run: npm run test:build
- name: Run tests on emulator
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
arch: x86_64
profile: pixel
avd-name: Pixel_API_34
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
script: cd rn-test && npm run test:run