From d08b0a8d270cae309abf0817149fbccc9b9e864d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Duy=20Ph=E1=BA=A1m?= Date: Thu, 7 Nov 2024 15:03:03 +0700 Subject: [PATCH] Setup GitHub Actions workflow to build and test lib --- .github/workflows/build_test.yml | 45 ++++++++++++++++++++++++++++++++ lib/build.gradle.kts | 8 +++--- 2 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build_test.yml diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 0000000..b92a337 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,45 @@ +name: Build Test + +on: + push: + branches: + - 'task/**' + - 'bug/**' + - 'fix/**' + - 'epic/**' + +jobs: + build-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Java 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '17' + + - name: Chmod permissions + run: sudo chmod +x ./gradlew + + - name: Setup Gradle Cache + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + cache-read-only: false + + - name: Run Instrumental tests + run: ./gradlew lib:pixel7api34DebugAndroidTest + -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true + -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" + -Pandroid.experimental.androidTest.numManagedDeviceShards=1 + -Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 + --max-workers=1 + + - name: Upload test results + uses: actions/upload-artifact@v3 + with: + name: test-results + path: lib/build/outputs/androidTest-results \ No newline at end of file diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 3c06a6a..029f3e3 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -80,13 +80,13 @@ android { testOptions { managedDevices { localDevices { - create("pixel2api30") { + create("pixel7api34") { // Use device profiles you typically see in Android Studio. - device = "Pixel 2" + device = "Pixel 7" // Use only API levels 27 and higher. - apiLevel = 30 + apiLevel = 34 // To include Google services, use "google". - systemImageSource = "aosp" + systemImageSource = "aosp-atd" } } }