-
Notifications
You must be signed in to change notification settings - Fork 97
144 lines (120 loc) · 3.79 KB
/
build_and_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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build jsc-android and test
on:
workflow_dispatch: {}
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
steps:
- uses: actions/checkout@v4
- name: 🔨 Use JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: ⬢ Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install coreutils curl git wget python3 ruby gperf -y
shell: bash
- name: Install Android packages
run: |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
yes | sdkmanager --licenses || true
sdkmanager \
"cmake;3.22.1" \
"ndk;27.1.12297006"
# move out builtin icu headers from ndk and prevent icu build errors
mv "${ANDROID_HOME}/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
echo "ANDROID_NDK=$ANDROID_HOME/ndk/27.1.12297006" >> $GITHUB_ENV
echo "PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools" >> $GITHUB_ENV
shell: bash
- name: Build
run: |
yarn install --frozen-lockfile
yarn clean
yarn download
yarn start
shell: bash
- name: Archive
run: |
mkdir -p archive
mv dist archive/
mv dist.unstripped archive/
shell: bash
- uses: actions/upload-artifact@v4
with:
name: archive
path: archive
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 🧹 Cleanup GitHub Linux runner disk space
uses: ./.github/actions/cleanup-linux-disk-space
- name: ⬢ Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: 🔨 Use JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- uses: actions/download-artifact@v4
with:
name: archive
path: archive
- name: Extract archive
run: |
mv archive/dist dist
mv archive/dist.unstripped dist.unstripped
rmdir archive
shell: bash
- name: 🍺 Install Maestro
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
- name: Install node packages
run: yarn install --frozen-lockfile
working-directory: test
- name: ⚙️ Enable KVM for Android virtualization
shell: bash
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: Run test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 24
arch: x86_64
target: google_apis
working-directory: test
script: |
npx expo run:android --variant release --no-bundler
adb logcat -c
set +e
maestro test maestro.yaml
STATUS=$?
adb logcat -d > adb.log
exit $STATUS
- name: Upload failed artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: failure_artifacts
path: |
$HOME/.maestro/tests/**/*
test/android/app/build/outputs/apk/release/app-release.apk
test/adb.log