Skip to content

Commit

Permalink
Add UI test GHA flow
Browse files Browse the repository at this point in the history
  • Loading branch information
jheng-hao-lin-cko committed Oct 13, 2023
1 parent a984e91 commit b90e5f6
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
# The branches below must be a subset of the branches above
types: [ opened, synchronize, reopened ]
branches: [ master, "bugfix/*", "feature/*", "release/*" ]
paths:
- 'checkout/**'
- 'example_app_frames/**'
- 'app/**'
- 'frames/**'
- 'buildSrc/**'
- 'build.gradle.kt'
schedule:
- cron: '34 2 * * 0'

Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/ui-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: UI Test

on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ "**" ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
ui-test:
name: UI Test
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Cache Gradle and wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}

- name: Install Android SDK Packages and Launch Emulator
run: chmod +x ./scripts/install-android-sdk-packages.sh && ./scripts/install-android-sdk-packages.sh

- name: UI Test
run: ./gradlew :frames:connectedDebugAndroidTest
7 changes: 7 additions & 0 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
# The branches below must be a subset of the branches above
types: [ opened, synchronize, reopened ]
branches: [ master, "bugfix/*", "feature/*", "release/*" ]
paths:
- 'checkout/**'
- 'example_app_frames/**'
- 'app/**'
- 'frames/**'
- 'buildSrc/**'
- 'build.gradle.kt'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
5 changes: 5 additions & 0 deletions scripts/android-sdk-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
platform-tools
platforms;android-29
build-tools;29.0.3
emulator
system-images;android-29;google_apis;x86_64
12 changes: 12 additions & 0 deletions scripts/install-android-sdk-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Please run this AFTER running scripts/setup-android-env.sh
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --package_file=./scripts/android-sdk-packages --sdk_root=$ANDROID_SDK_ROOT

# Create an AVD
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n testingAVD -d pixel --package "system-images;android-29;google_apis;x86_64"

# Start an emulator
$ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -no-window -no-audio -no-snapshot -no-boot-anim -camera-back none -camera-front none
#$ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -no-audio -no-window -no-boot-anim -no-snapshot -camera-back none -camera-front none -selinux permissive -qemu -vnc :0

0 comments on commit b90e5f6

Please sign in to comment.