From 79915aa180d52fb99e4dff544287db6508ea0f7c Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Fri, 13 Oct 2023 23:04:03 +0100 Subject: [PATCH 01/15] Add UI test GHA flow --- .github/workflows/codeql-analysis.yml | 7 ++++ .github/workflows/ui-test.yml | 47 +++++++++++++++++++++++++ .github/workflows/verify-pr.yml | 7 ++++ scripts/android-sdk-packages | 5 +++ scripts/install-android-sdk-packages.sh | 12 +++++++ 5 files changed, 78 insertions(+) create mode 100644 .github/workflows/ui-test.yml create mode 100644 scripts/android-sdk-packages create mode 100644 scripts/install-android-sdk-packages.sh diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 66c27c002..8c995d86e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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' diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml new file mode 100644 index 000000000..1be56f8e9 --- /dev/null +++ b/.github/workflows/ui-test.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index 9c7c01591..9230cc4f0 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -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 }} diff --git a/scripts/android-sdk-packages b/scripts/android-sdk-packages new file mode 100644 index 000000000..74c3207f7 --- /dev/null +++ b/scripts/android-sdk-packages @@ -0,0 +1,5 @@ +platform-tools +platforms;android-29 +build-tools;29.0.3 +emulator +system-images;android-29;google_apis;x86_64 \ No newline at end of file diff --git a/scripts/install-android-sdk-packages.sh b/scripts/install-android-sdk-packages.sh new file mode 100644 index 000000000..bc6484eb1 --- /dev/null +++ b/scripts/install-android-sdk-packages.sh @@ -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 + From f8f682b1be0fc5a7b9797186f959f1060cca2117 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Fri, 13 Oct 2023 23:17:02 +0100 Subject: [PATCH 02/15] Experiment using macOs-latest to run --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 1be56f8e9..bf93edfb1 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -12,7 +12,7 @@ concurrency: jobs: ui-test: name: UI Test - runs-on: ubuntu-latest + runs-on: macos-latest strategy: fail-fast: true From 41de53979ab6124754b1652eeaffd87a385a615d Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Fri, 13 Oct 2023 23:43:47 +0100 Subject: [PATCH 03/15] Experiment using macOs-latest to run --- .github/workflows/ui-test.yml | 1 + scripts/install-android-sdk-packages.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index bf93edfb1..15cda3a0c 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -13,6 +13,7 @@ jobs: ui-test: name: UI Test runs-on: macos-latest + timeout-minutes: 5 strategy: fail-fast: true diff --git a/scripts/install-android-sdk-packages.sh b/scripts/install-android-sdk-packages.sh index bc6484eb1..310ca851e 100644 --- a/scripts/install-android-sdk-packages.sh +++ b/scripts/install-android-sdk-packages.sh @@ -6,7 +6,10 @@ yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --package_file=./scr # 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" +# List AVDs +$ANDROID_SDK_ROOT/emulator/emulator -list-avds + # 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-accel -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 From 66a540efb6ff00e46c470e2af47f02ea1e9da15e Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Fri, 13 Oct 2023 23:49:46 +0100 Subject: [PATCH 04/15] Experiment using macOs-latest to run --- scripts/install-android-sdk-packages.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/install-android-sdk-packages.sh b/scripts/install-android-sdk-packages.sh index 310ca851e..2b78ffa36 100644 --- a/scripts/install-android-sdk-packages.sh +++ b/scripts/install-android-sdk-packages.sh @@ -9,7 +9,10 @@ $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager create avd -n testingAVD - # List AVDs $ANDROID_SDK_ROOT/emulator/emulator -list-avds +# Update +$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --update + # Start an emulator -$ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -no-accel -no-window -no-audio -no-snapshot -no-boot-anim -camera-back none -camera-front none +$ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -no-accel -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 From ffbbef5d27d41299a28ddcda78d842414fb9f825 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Fri, 13 Oct 2023 23:57:01 +0100 Subject: [PATCH 05/15] Experiment using macOs-latest to run --- .github/workflows/ui-test.yml | 10 +++++----- ...tall-android-sdk-packages.sh => launch-emulator.sh} | 9 +-------- 2 files changed, 6 insertions(+), 13 deletions(-) rename scripts/{install-android-sdk-packages.sh => launch-emulator.sh} (56%) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 15cda3a0c..bd83bd7b9 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -11,9 +11,9 @@ concurrency: jobs: ui-test: - name: UI Test + name: Run UI Test + # Run on macOS because we need to run the emulator and the emulator is not supported on Linux runs-on: macos-latest - timeout-minutes: 5 strategy: fail-fast: true @@ -41,8 +41,8 @@ jobs: ~/.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: Launch Emulator + run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh - - name: UI Test + - name: Run UI Test run: ./gradlew :frames:connectedDebugAndroidTest \ No newline at end of file diff --git a/scripts/install-android-sdk-packages.sh b/scripts/launch-emulator.sh similarity index 56% rename from scripts/install-android-sdk-packages.sh rename to scripts/launch-emulator.sh index 2b78ffa36..55eae5929 100644 --- a/scripts/install-android-sdk-packages.sh +++ b/scripts/launch-emulator.sh @@ -1,18 +1,11 @@ #!/bin/sh -# Please run this AFTER running scripts/setup-android-env.sh +# Install required packages 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" -# List AVDs -$ANDROID_SDK_ROOT/emulator/emulator -list-avds - -# Update -$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --update - # Start an emulator $ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -no-accel -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 From 2cb347fb9b540f0ade368978c306bf5da70abf6a Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Sat, 14 Oct 2023 00:11:16 +0100 Subject: [PATCH 06/15] Experiment using macOs-latest to run --- .github/workflows/ui-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index bd83bd7b9..2331a4ffd 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -45,4 +45,4 @@ jobs: run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh - name: Run UI Test - run: ./gradlew :frames:connectedDebugAndroidTest \ No newline at end of file + run: ./gradlew connectedCheck \ No newline at end of file From c6e4830efdf3591697bb9c56ff7f06b951b7f0e8 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Sat, 14 Oct 2023 00:16:14 +0100 Subject: [PATCH 07/15] change rebase --- .github/workflows/ui-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 2331a4ffd..93926fcd4 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -23,10 +23,10 @@ jobs: with: fetch-depth: 0 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle From 796f55e393e348e0c5511edcef26f8fe66eb05d8 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Sat, 14 Oct 2023 00:42:15 +0100 Subject: [PATCH 08/15] update workflow --- .github/workflows/ui-test.yml | 42 ++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 93926fcd4..9065bca1a 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -10,8 +10,8 @@ concurrency: cancel-in-progress: true jobs: - ui-test: - name: Run UI Test + connected-check: + name: Run Connected Check # Run on macOS because we need to run the emulator and the emulator is not supported on Linux runs-on: macos-latest strategy: @@ -45,4 +45,40 @@ jobs: run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh - name: Run UI Test - run: ./gradlew connectedCheck \ No newline at end of file + run: ./gradlew connectedCheck --stacktrace + frames-android-tests: + name: Run Frames Android Tests + # Run on macOS because we need to run the emulator and the emulator is not supported on Linux + runs-on: macos-latest + strategy: + fail-fast: true + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + 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: Launch Emulator + run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh + + - name: Run UI Test + run: ./gradlew connectedDebugAndroidTest --stacktrace \ No newline at end of file From ba6c2b348f07a721e651ca122e49c20011a244d1 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Sat, 14 Oct 2023 01:08:08 +0100 Subject: [PATCH 09/15] update workflow --- scripts/launch-emulator.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/launch-emulator.sh b/scripts/launch-emulator.sh index 55eae5929..49a5c4ed0 100644 --- a/scripts/launch-emulator.sh +++ b/scripts/launch-emulator.sh @@ -7,5 +7,5 @@ yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --package_file=./scr $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-accel -no-window -no-audio -no-snapshot -no-boot-anim -camera-back none -camera-front none & +$ANDROID_SDK_ROOT/emulator/emulator -avd testingAVD -partition-size 512 -no-window -no-audio -no-snapshot -no-boot-anim -camera-back none -camera-front none & From 17de1b072c6ed2359c9938ac8c1b6e18f5bfa821 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 15:34:54 +0100 Subject: [PATCH 10/15] Abstract workflows --- .github/workflows/android-lint.yml | 14 ++++ .github/workflows/assemble-module.yml | 18 +++++ .github/workflows/gradle-task.yml | 40 ++++++++++ .github/workflows/ktlint.yml | 14 ++++ .github/workflows/ui-test.yml | 53 +++---------- .github/workflows/unit-test.yml | 14 ++++ .github/workflows/verification-flow.yml | 77 +++++++++++++++++++ .github/workflows/verify-app.yml | 28 +++++++ .github/workflows/verify-checkout.yml | 27 +++++++ .../workflows/verify-example-app-frames.yml | 29 +++++++ .github/workflows/verify-frames.yml | 29 +++++++ buildSrc/src/main/java/FramesConfig.kt | 2 +- 12 files changed, 301 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/android-lint.yml create mode 100644 .github/workflows/assemble-module.yml create mode 100644 .github/workflows/gradle-task.yml create mode 100644 .github/workflows/ktlint.yml create mode 100644 .github/workflows/unit-test.yml create mode 100644 .github/workflows/verification-flow.yml create mode 100644 .github/workflows/verify-app.yml create mode 100644 .github/workflows/verify-checkout.yml create mode 100644 .github/workflows/verify-example-app-frames.yml create mode 100644 .github/workflows/verify-frames.yml diff --git a/.github/workflows/android-lint.yml b/.github/workflows/android-lint.yml new file mode 100644 index 000000000..8ecf2bb0a --- /dev/null +++ b/.github/workflows/android-lint.yml @@ -0,0 +1,14 @@ +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string +jobs: + android-lint: + uses: ./.github/workflows/gradle-task.yml + with: + module: ${{ inputs.module }} + task: lint + task-name: Run Android Lint Check diff --git a/.github/workflows/assemble-module.yml b/.github/workflows/assemble-module.yml new file mode 100644 index 000000000..0b3969845 --- /dev/null +++ b/.github/workflows/assemble-module.yml @@ -0,0 +1,18 @@ +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string + variant: + description: 'Variant to build' + required: true + type: string +jobs: + assemble: + uses: ./.github/workflows/gradle-task.yml + with: + module: ${{ inputs.module }} + task: assemble${{inputs.variant}} + task-name: Assemble ${{inputs.module}} - ${{inputs.variant}} diff --git a/.github/workflows/gradle-task.yml b/.github/workflows/gradle-task.yml new file mode 100644 index 000000000..c9913b3ed --- /dev/null +++ b/.github/workflows/gradle-task.yml @@ -0,0 +1,40 @@ +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string + task: + description: 'Task to run' + required: true + type: string + task-name: + description: 'Task Name' + required: true + type: string + +jobs: + task: + name: ${{ inputs.task-name }} + runs-on: [ self-hosted, cko-mobile-default-runners-github-runners ] + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + 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: Run unit tests with Gradle + run: ./gradlew :${{ inputs.module }}:${{ inputs.task }} diff --git a/.github/workflows/ktlint.yml b/.github/workflows/ktlint.yml new file mode 100644 index 000000000..796918e10 --- /dev/null +++ b/.github/workflows/ktlint.yml @@ -0,0 +1,14 @@ +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string +jobs: + ktlint: + uses: ./.github/workflows/gradle-task.yml + with: + module: ${{ inputs.module }} + task: ktlint + task-name: Run Ktlint Check diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 9065bca1a..ec3e85465 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -1,17 +1,20 @@ name: UI Test on: - pull_request: - types: [ opened, synchronize, reopened ] - branches: [ "**" ] + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - connected-check: - name: Run Connected Check + connected-android-tests: + name: Run Connected Android Tests # Run on macOS because we need to run the emulator and the emulator is not supported on Linux runs-on: macos-latest strategy: @@ -44,41 +47,5 @@ jobs: - name: Launch Emulator run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh - - name: Run UI Test - run: ./gradlew connectedCheck --stacktrace - frames-android-tests: - name: Run Frames Android Tests - # Run on macOS because we need to run the emulator and the emulator is not supported on Linux - runs-on: macos-latest - strategy: - fail-fast: true - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - 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: Launch Emulator - run: chmod +x ./scripts/launch-emulator.sh && ./scripts/launch-emulator.sh - - - name: Run UI Test - run: ./gradlew connectedDebugAndroidTest --stacktrace \ No newline at end of file + - name: Run UI Test on ${{ inputs.module }} + run: ./gradlew :${{ inputs.module }}:connectedAndroidTest --stacktrace \ No newline at end of file diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 000000000..ef2e5a3c6 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,14 @@ +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string +jobs: + unit-test: + uses: ./.github/workflows/gradle-task.yml + with: + module: ${{ inputs.module }} + task: test + task-name: Run Unit Tests diff --git a/.github/workflows/verification-flow.yml b/.github/workflows/verification-flow.yml new file mode 100644 index 000000000..f0261911c --- /dev/null +++ b/.github/workflows/verification-flow.yml @@ -0,0 +1,77 @@ +name: Verification + +on: + workflow_call: + inputs: + module: + description: 'Module to run' + required: true + type: string + run-android-lint: + description: 'Should Run Android Lint' + required: false + type: boolean + default: false + run-ktlint: + description: 'Should Run Ktlint' + required: false + type: boolean + default: false + run-assemble: + description: 'Should Run Assemble' + required: false + type: boolean + default: false + assemble-variant: + description: 'Variant to Run Assemble' + required: false + type: string + default: '' + run-unit-test: + description: 'Should Run Unit Tests' + required: false + type: boolean + default: false + run-ui-test: + description: 'Should Run UI Tests' + required: false + type: boolean + default: false + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + android-lint: + if: ${{ inputs.run-android-lint }} + uses: ./.github/workflows/android-lint.yml + with: + module: ${{ inputs.module }} + ktlint: + if: ${{ inputs.run-ktlint }} + uses: ./.github/workflows/ktlint.yml + with: + module: ${{ inputs.module }} + assemble: + if: ${{ inputs.run-assemble }} + uses: ./.github/workflows/assemble-module.yml + # Add ktlint after ktlint is applied to all modules + needs: android-lint + with: + module: ${{ inputs.module }} + variant: ${{ inputs.assemble-variant }} + unit-test: + if: ${{ inputs.run-unit-test }} + uses: ./.github/workflows/unit-test.yml + # Add ktlint after ktlint is applied to all modules + needs: android-lint + with: + module: ${{ inputs.module }} + ui-test: + if: ${{ inputs.run-ui-test }} + uses: ./.github/workflows/ui-test.yml + # Add ktlint after ktlint is applied to all modules + needs: android-lint + with: + module: ${{ inputs.module }} diff --git a/.github/workflows/verify-app.yml b/.github/workflows/verify-app.yml new file mode 100644 index 000000000..c215bb961 --- /dev/null +++ b/.github/workflows/verify-app.yml @@ -0,0 +1,28 @@ +name: Verify App + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + branches: [ master, "bugfix/*", "feature/*", "release/*" ] + paths: + - 'app/**' + - 'checkout/**' + - 'frames/**' + - 'buildSrc/**' + - 'build.gradle.kt' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + verify-app: + uses: ./.github/workflows/verification-flow.yml + with: + module: app + run-android-lint: true + run-assemble: true + run-unit-test: true \ No newline at end of file diff --git a/.github/workflows/verify-checkout.yml b/.github/workflows/verify-checkout.yml new file mode 100644 index 000000000..5c50fc3ad --- /dev/null +++ b/.github/workflows/verify-checkout.yml @@ -0,0 +1,27 @@ +name: Verify Checkout + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + branches: [ master, "bugfix/*", "feature/*", "release/*" ] + paths: + - 'checkout/**' + - 'buildSrc/**' + - 'build.gradle.kt' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + verify-app: + uses: ./.github/workflows/verification-flow.yml + with: + module: checkout + run-android-lint: true + run-ktlint: true + run-assemble: true + run-unit-test: true diff --git a/.github/workflows/verify-example-app-frames.yml b/.github/workflows/verify-example-app-frames.yml new file mode 100644 index 000000000..cb4726c5b --- /dev/null +++ b/.github/workflows/verify-example-app-frames.yml @@ -0,0 +1,29 @@ +name: Verify Example App Frames + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + branches: [ master, "bugfix/*", "feature/*", "release/*" ] + paths: + - 'checkout/**' + - 'frames/**' + - 'example_app_frames/**' + - 'buildSrc/**' + - 'build.gradle.kt' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + verify-app: + uses: ./.github/workflows/verification-flow.yml + with: + module: example_app_frames + run-android-lint: true + run-ktlint: true + run-assemble: true + run-unit-test: true diff --git a/.github/workflows/verify-frames.yml b/.github/workflows/verify-frames.yml new file mode 100644 index 000000000..3014ac289 --- /dev/null +++ b/.github/workflows/verify-frames.yml @@ -0,0 +1,29 @@ +name: Verify Frames + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + branches: [ master, "bugfix/*", "feature/*", "release/*" ] + paths: + - 'checkout/**' + - 'frames/**' + - 'buildSrc/**' + - 'build.gradle.kt' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + verify-app: + uses: ./.github/workflows/verification-flow.yml + with: + module: frames + run-android-lint: true + run-ktlint: true + run-assemble: true + run-unit-test: true + run-ui-test: true diff --git a/buildSrc/src/main/java/FramesConfig.kt b/buildSrc/src/main/java/FramesConfig.kt index 88185a80b..3f11841d4 100644 --- a/buildSrc/src/main/java/FramesConfig.kt +++ b/buildSrc/src/main/java/FramesConfig.kt @@ -1,5 +1,5 @@ object FramesConfig { - const val productVersion = "4.1.0" + const val productVersion = "4.1.1" const val productArtefactId = "frames-android" const val productGroupId = "com.github.checkout" const val loggingGroupId = "com.checkout" From 9b82c0e28438db1dd8c8f1b9055852bfa9bf1202 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 16:04:33 +0100 Subject: [PATCH 11/15] update workflows --- .github/workflows/gradle-task.yml | 2 +- .github/workflows/verify-pr.yml | 69 ------------------------------- 2 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 .github/workflows/verify-pr.yml diff --git a/.github/workflows/gradle-task.yml b/.github/workflows/gradle-task.yml index c9913b3ed..157961b80 100644 --- a/.github/workflows/gradle-task.yml +++ b/.github/workflows/gradle-task.yml @@ -17,7 +17,7 @@ on: jobs: task: name: ${{ inputs.task-name }} - runs-on: [ self-hosted, cko-mobile-default-runners-github-runners ] + runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v3 diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml deleted file mode 100644 index 9230cc4f0..000000000 --- a/.github/workflows/verify-pr.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Verify Pull Request - -on: - push: - branches: [ master ] - pull_request: - # 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 }} - cancel-in-progress: true - -jobs: - lint: - name: Code Lint - runs-on: ubuntu-latest - permissions: - pull-requests: read - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - 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: Run Android Lint - run: ./gradlew lint - - name: Run KtLint - run: ./gradlew ktlint - - test: - name: Unit Tests - runs-on: ubuntu-latest - permissions: - pull-requests: read - needs: lint - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Run unit tests - run: ./gradlew test From 37eceb62adccd54282758e49f3cd6e18a92bb134 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 16:21:41 +0100 Subject: [PATCH 12/15] update workflows --- .github/workflows/verify-app.yml | 6 +++--- .github/workflows/verify-checkout.yml | 2 +- .github/workflows/verify-example-app-frames.yml | 2 +- .github/workflows/verify-frames.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verify-app.yml b/.github/workflows/verify-app.yml index c215bb961..4e05ba741 100644 --- a/.github/workflows/verify-app.yml +++ b/.github/workflows/verify-app.yml @@ -1,4 +1,4 @@ -name: Verify App +name: Verify Frames on: push: @@ -19,10 +19,10 @@ concurrency: cancel-in-progress: true jobs: - verify-app: + verify-module: uses: ./.github/workflows/verification-flow.yml with: module: app run-android-lint: true run-assemble: true - run-unit-test: true \ No newline at end of file + run-unit-test: true diff --git a/.github/workflows/verify-checkout.yml b/.github/workflows/verify-checkout.yml index 5c50fc3ad..6ceb0c37f 100644 --- a/.github/workflows/verify-checkout.yml +++ b/.github/workflows/verify-checkout.yml @@ -17,7 +17,7 @@ concurrency: cancel-in-progress: true jobs: - verify-app: + verify-module: uses: ./.github/workflows/verification-flow.yml with: module: checkout diff --git a/.github/workflows/verify-example-app-frames.yml b/.github/workflows/verify-example-app-frames.yml index cb4726c5b..12dd8fcfe 100644 --- a/.github/workflows/verify-example-app-frames.yml +++ b/.github/workflows/verify-example-app-frames.yml @@ -19,7 +19,7 @@ concurrency: cancel-in-progress: true jobs: - verify-app: + verify-module: uses: ./.github/workflows/verification-flow.yml with: module: example_app_frames diff --git a/.github/workflows/verify-frames.yml b/.github/workflows/verify-frames.yml index 3014ac289..5a6f87c0f 100644 --- a/.github/workflows/verify-frames.yml +++ b/.github/workflows/verify-frames.yml @@ -18,7 +18,7 @@ concurrency: cancel-in-progress: true jobs: - verify-app: + verify-module: uses: ./.github/workflows/verification-flow.yml with: module: frames From c66bb570c7fea612dc3c007bbb9da798571821d4 Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 16:29:05 +0100 Subject: [PATCH 13/15] update workflows --- .github/workflows/ui-test.yml | 4 ---- .github/workflows/verification-flow.yml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index ec3e85465..16e3106dd 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -8,10 +8,6 @@ on: required: true type: string -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: connected-android-tests: name: Run Connected Android Tests diff --git a/.github/workflows/verification-flow.yml b/.github/workflows/verification-flow.yml index f0261911c..7195c1503 100644 --- a/.github/workflows/verification-flow.yml +++ b/.github/workflows/verification-flow.yml @@ -38,10 +38,6 @@ on: type: boolean default: false -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: android-lint: if: ${{ inputs.run-android-lint }} From 73ee22f3fdd502eef0fa3af975e4c50e809c312e Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 16:34:34 +0100 Subject: [PATCH 14/15] update workflows --- .github/workflows/verify-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-app.yml b/.github/workflows/verify-app.yml index 4e05ba741..5d5d003e5 100644 --- a/.github/workflows/verify-app.yml +++ b/.github/workflows/verify-app.yml @@ -1,4 +1,4 @@ -name: Verify Frames +name: Verify App on: push: From 418841b6da2592105a75262ac72f19f7518afcfa Mon Sep 17 00:00:00 2001 From: Jheng-Hao Lin Date: Mon, 16 Oct 2023 16:57:06 +0100 Subject: [PATCH 15/15] restore version change --- buildSrc/src/main/java/FramesConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/FramesConfig.kt b/buildSrc/src/main/java/FramesConfig.kt index 3f11841d4..88185a80b 100644 --- a/buildSrc/src/main/java/FramesConfig.kt +++ b/buildSrc/src/main/java/FramesConfig.kt @@ -1,5 +1,5 @@ object FramesConfig { - const val productVersion = "4.1.1" + const val productVersion = "4.1.0" const val productArtefactId = "frames-android" const val productGroupId = "com.github.checkout" const val loggingGroupId = "com.checkout"