Skip to content

Commit bd17398

Browse files
committed
[ci] update ci infra
- use ndk r27 - use jdk 17 - use android emulator api 24 - use ubuntu-runner and maestro to run e2e test
1 parent 61ac7a8 commit bd17398

File tree

2 files changed

+73
-27
lines changed

2 files changed

+73
-27
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 650 Industries.
3+
#
4+
5+
name: 'Cleanup GitHub Linux Runner Disk Space'
6+
description: 'Cleanup unused preinstalled packages on the GitHub Ubuntu runners'
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: '🧹 Cleanup preinstalled packages'
12+
shell: bash
13+
run: |
14+
echo 'Disk space before cleanup'
15+
df -aH
16+
sudo apt-get remove -y --purge '^mysql-.*' '^mongodb-.*' '^mssql-.*' '^postgresql-.*' '^aspnetcore-*' '^dotnet-.*' '^php.*-.*' 'mono-complete' '^llvm-.*' 'powershell' 'google-chrome-*' 'microsoft-edge-*' 'firefox' 'nginx' 'apache2'
17+
sudo apt-get autoremove -y
18+
sudo rm -rf /usr/share/dotnet
19+
echo 'Showing Android SDKs'
20+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --list
21+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall 'ndk;24.0.8215888' 'ndk;25.2.9519653' 'ndk;26.2.11394342'
22+
echo 'Removing all Docker images'
23+
docker rmi -f $(docker images -aq)
24+
echo 'Disk space after cleanup'
25+
df -aH

.github/workflows/build_and_test.yml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
11
name: Build jsc-android and test
22

33
on:
4+
workflow_dispatch: {}
45
push:
56
branches: [main]
67
pull_request:
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
11-
container: reactnativecommunity/react-native-android:5.4
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
1515

16-
- name: 🔨 Use JDK 11
17-
uses: actions/setup-java@v3
16+
- name: 🔨 Use JDK 17
17+
uses: actions/setup-java@v4
1818
with:
1919
distribution: 'temurin'
20-
java-version: '11'
20+
java-version: '17'
21+
22+
- name: ⬢ Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 18
2126

2227
- name: Install packages
2328
run: |
24-
apt-get update
25-
apt-get install coreutils curl git subversion wget python3 ruby gperf -y
26-
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
27-
echo 'export NVM_DIR="$HOME/.nvm"' >> "${HOME}/.bashrc"
28-
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "${HOME}/.bashrc"
29-
source "${HOME}/.bashrc"
30-
nvm install 16
31-
nvm use 16
32-
nvm alias default 16
29+
sudo apt-get update
30+
sudo apt-get install coreutils curl git wget python3 ruby gperf -y
3331
shell: bash
3432

3533
- name: Install Android packages
3634
run: |
35+
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
36+
yes | sdkmanager --licenses || true
3737
sdkmanager \
3838
"cmake;3.22.1" \
39-
"ndk;23.2.8568313"
39+
"ndk;27.1.12297006"
4040
# move out builtin icu headers from ndk and prevent icu build errors
41-
mv "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
42-
echo "ANDROID_NDK=$ANDROID_HOME/ndk/23.2.8568313" >> $GITHUB_ENV
41+
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"
42+
43+
echo "ANDROID_NDK=$ANDROID_HOME/ndk/27.1.12297006" >> $GITHUB_ENV
44+
echo "PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools" >> $GITHUB_ENV
4345
shell: bash
4446

4547
- name: Build
@@ -57,38 +59,57 @@ jobs:
5759
mv dist.unstripped archive/
5860
shell: bash
5961

60-
- uses: actions/upload-artifact@v2
62+
- uses: actions/upload-artifact@v4
6163
with:
6264
name: archive
6365
path: archive
6466

6567

6668
test:
6769
needs: build
68-
runs-on: macOS-latest
70+
runs-on: ubuntu-latest
6971

7072
steps:
71-
- uses: actions/checkout@v1
73+
- uses: actions/checkout@v4
74+
75+
- name: 🧹 Cleanup GitHub Linux runner disk space
76+
uses: ./.github/actions/cleanup-linux-disk-space
7277

73-
- name: 🔨 Use JDK 11
74-
uses: actions/setup-java@v3
78+
- name: 🔨 Use JDK 17
79+
uses: actions/setup-java@v4
7580
with:
7681
distribution: 'temurin'
77-
java-version: '11'
82+
java-version: '17'
7883

79-
- uses: actions/download-artifact@v2
84+
- uses: actions/download-artifact@v4
8085
with:
8186
name: archive
8287
path: archive
8388

89+
- name: 🍺 Install Maestro
90+
run: |
91+
curl -Ls "https://get.maestro.mobile.dev" | bash
92+
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
93+
8494
- name: Install node packages
8595
run: yarn install --frozen-lockfile
8696
working-directory: test
8797

98+
- name: ⚙️ Enable KVM for Android virtualization
99+
shell: bash
100+
run: |
101+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
102+
sudo udevadm control --reload-rules
103+
sudo udevadm trigger --name-match=kvm
104+
88105
- name: Run test
89106
uses: reactivecircus/android-emulator-runner@v2
90107
with:
91-
api-level: 21
108+
api-level: 24
92109
arch: x86_64
93-
disable-animations: false
94-
script: mv archive/dist . && cd test && yarn && cd android && ./gradlew :app:assembleRelease :app:assembleAndroidTest :app:connectedAndroidTest
110+
target: google_apis
111+
working-directory: test
112+
script: |
113+
mv ../archive/dist ../dist
114+
npx expo run:android --variant release --no-bundler
115+
maestro test maestro.yaml

0 commit comments

Comments
 (0)