From dc3649f8b0843758a829b083d7f168b1226d1006 Mon Sep 17 00:00:00 2001 From: Mayowa Egbewunmi Date: Tue, 1 Mar 2022 00:09:35 +0100 Subject: [PATCH] create pull request script --- .github/workflows/build_pull_request.yml | 58 +++++++++++++++++++ .../{build+deploy.yml => build_release.yml} | 15 +++-- cameraview/build.gradle.kts | 3 - gradle.properties | 2 +- 4 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build_pull_request.yml rename .github/workflows/{build+deploy.yml => build_release.yml} (81%) diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml new file mode 100644 index 00000000..cf96ef49 --- /dev/null +++ b/.github/workflows/build_pull_request.yml @@ -0,0 +1,58 @@ +name: Pull Request + +on: + pull_request: +jobs: + ANDROID_BUILD_CHECKS: + name: Assemble Debug + runs-on: ubuntu-latest + needs: [ ANDROID_UNIT_TESTS, ANDROID_EMULATOR_TESTS ] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: temurin + cache: gradle + - name: Assemble debug build + run: ./gradlew cameraview:assembleDebug --stacktrace + ANDROID_UNIT_TESTS: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: temurin + cache: gradle + - name: Execute unit tests + run: ./gradlew cameraview:runUnitTests --stacktrace + + ANDROID_EMULATOR_TESTS: + name: Emulator Tests + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + EMULATOR_API: [22] + include: + - EMULATOR_API: 22 + EMULATOR_ARCH: x86 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + java-version: 11 + distribution: temurin + cache: gradle + - name: Execute emulator tests + timeout-minutes: 30 + uses: reactivecircus/android-emulator-runner@v2.21.0 + with: + api-level: ${{ matrix.EMULATOR_API }} + arch: ${{ matrix.EMULATOR_ARCH }} + disable-animations: true + profile: Nexus 5X + emulator-options: -no-snapshot -no-window -no-boot-anim -camera-back emulated -camera-front emulated -gpu swiftshader_indirect + script: ./.github/workflows/emulator_script.sh \ No newline at end of file diff --git a/.github/workflows/build+deploy.yml b/.github/workflows/build_release.yml similarity index 81% rename from .github/workflows/build+deploy.yml rename to .github/workflows/build_release.yml index 8f4a1456..0f439542 100644 --- a/.github/workflows/build+deploy.yml +++ b/.github/workflows/build_release.yml @@ -1,14 +1,15 @@ # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions # Renaming ? Change the README badge. -name: Build +name: Build Release and Publish + on: push: branches: - - mayowa/build-premise-cameraview-artifact + - main pull_request: jobs: - ANDROID_BUILD_CHECKS: - name: Base Checks + ANDROID_BUILD_AND_PUBLISH: + name: Build Release and Publish runs-on: ubuntu-latest needs: [ ANDROID_UNIT_TESTS, ANDROID_EMULATOR_TESTS ] env: @@ -22,8 +23,8 @@ jobs: java-version: 11 distribution: temurin cache: gradle - - name: Perform base checks - run: ./gradlew assembleRelease artifactoryPublish --stacktrace + - name: Assemble release and publish + run: ./gradlew cameraview:assembleRelease artifactoryPublish --stacktrace ANDROID_UNIT_TESTS: name: Unit Tests runs-on: ubuntu-latest @@ -43,8 +44,6 @@ jobs: strategy: fail-fast: false matrix: - # TODO 29 fails due to Mockito issues, probably reproducible locally - # 22-28 work (some of them, with SdkExclude restrictions) EMULATOR_API: [22] include: - EMULATOR_API: 22 diff --git a/cameraview/build.gradle.kts b/cameraview/build.gradle.kts index f47b8c28..1d0b10bf 100644 --- a/cameraview/build.gradle.kts +++ b/cameraview/build.gradle.kts @@ -27,9 +27,6 @@ fun Project.getStringProperty(propertyName: String): String? { return if(property is String) property else null } -group = "com.otaliastudios.cameraview" -version = getStringProperty("libraryVersion") ?: "unspecified" - publishing { publications { register("apkRelease") { diff --git a/gradle.properties b/gradle.properties index edaa62cc..0458dd4d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,4 @@ org.gradle.jvmargs=-Xmx1536m libraryVersion=2.7.2 artifactId=cameraview -groupId=com.otaliastudios.cameraview \ No newline at end of file +groupId=com.otaliastudios \ No newline at end of file