diff --git a/.github/workflows/auto_merge_dependabot_pr.yml b/.github/workflows/auto_merge_dependabot_pr.yml new file mode 100644 index 00000000..281d9674 --- /dev/null +++ b/.github/workflows/auto_merge_dependabot_pr.yml @@ -0,0 +1,51 @@ +name: Auto-Merge Dependabot PRs on CI Success + +on: + repository_dispatch: + types: [ checks-complete ] +jobs: + auto-merge: + runs-on: ubuntu-latest + steps: + - run: echo "PR_NUMBER=${{ toJson(github.event.client_payload.prNumber) }}" >> $GITHUB_ENV + - name: Wait for 10 seconds + run: sleep 10 + - name: Check CI status and Merge PR + uses: actions/github-script@v7 + with: + script: | + const prNumber = process.env.PR_NUMBER; + if (!prNumber) { + console.log("No PR number found."); + return; + } + + const { data: pullRequest } = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + if(pullRequest.merged) { + console.log(`PR #${prNumber} is already merged.`); + return; + } + const { data: listCheckRuns } = await github.rest.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: pullRequest.head.sha, + }); + console.log("checks: ", listCheckRuns); + const allChecksPassed = listCheckRuns.check_runs.every(check => check.conclusion === 'success' || check.name === 'Inclusive Language' || check.conclusion === 'skipped'); + + if (allChecksPassed) { + await github.rest.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + }); + console.log(`Merged PR #${prNumber}`); + } else { + console.log(`Not all checks passed for PR #${prNumber}`); + } + + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/nightly_e2e_workflow.yml b/.github/workflows/nightly_e2e_workflow.yml index 0cd3361b..6c4c6a48 100644 --- a/.github/workflows/nightly_e2e_workflow.yml +++ b/.github/workflows/nightly_e2e_workflow.yml @@ -11,7 +11,6 @@ env: RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }} - GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png SLACK_TITLE: Commit status @@ -31,7 +30,7 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -50,13 +49,13 @@ jobs: run: ./gradlew assembleAndroidTest -x lint - name: upload sample app artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: sample path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk - name: upload emarsys-e2e-test test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: emarsys-e2e-test path: emarsys-e2e-test/build/outputs/apk/androidTest/debug/emarsys-e2e-test-debug-androidTest.apk @@ -79,12 +78,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download Emarsys E2E tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: emarsys-e2e-test diff --git a/.github/workflows/nightly_workflow.yml b/.github/workflows/nightly_workflow.yml index 1e9bcc5d..88058c2d 100644 --- a/.github/workflows/nightly_workflow.yml +++ b/.github/workflows/nightly_workflow.yml @@ -11,7 +11,6 @@ env: RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }} - GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png SLACK_TITLE: Nightly build status @@ -30,7 +29,7 @@ jobs: fetch-depth: 0 # 0 indicates all history - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -48,55 +47,55 @@ jobs: run: ./gradlew assembleAndroidTest -x lint - name: upload sample app artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: sample path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk - name: upload core test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: core path: core/build/outputs/apk/androidTest/debug/core-debug-androidTest.apk - name: upload mobile-engage test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: mobile-engage path: mobile-engage/build/outputs/apk/androidTest/debug/mobile-engage-debug-androidTest.apk - name: upload predict test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: predict path: predict/build/outputs/apk/androidTest/debug/predict-debug-androidTest.apk - name: upload emarsys test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: emarsys path: emarsys/build/outputs/apk/androidTest/debug/emarsys-debug-androidTest.apk - name: upload emarsys-sdk test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: emarsys-sdk path: emarsys-sdk/build/outputs/apk/androidTest/debug/emarsys-sdk-debug-androidTest.apk - name: upload common test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: common path: common/build/outputs/apk/androidTest/debug/common-debug-androidTest.apk - name: upload emarsys-firebase test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: emarsys-firebase path: emarsys-firebase/build/outputs/apk/androidTest/debug/emarsys-firebase-debug-androidTest.apk - name: upload emarsys-huawei test apk artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: emarsys-huawei path: emarsys-huawei/build/outputs/apk/androidTest/debug/emarsys-huawei-debug-androidTest.apk @@ -118,7 +117,7 @@ jobs: fetch-depth: 0 # 0 indicates all history - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -147,7 +146,7 @@ jobs: fetch-depth: 0 # 0 indicates all history - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -170,7 +169,7 @@ jobs: run: ./gradlew :sample:bundleRelease - name: Upload bundle - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: mobile-sdk-sample path: sample/build/outputs/bundle/release/sample-release.aab @@ -188,12 +187,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download core tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: core @@ -217,12 +216,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download mobile-engage tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: mobile-engage @@ -246,12 +245,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download predict tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: predict @@ -275,12 +274,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download emarsys-sdk tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: emarsys-sdk @@ -307,12 +306,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download emarsys tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: emarsys @@ -336,12 +335,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download common tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: common @@ -365,12 +364,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download emarsys-firebase tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: emarsys-firebase @@ -394,12 +393,12 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: sample - name: Download emarsys-huawei tests - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: emarsys-huawei @@ -423,7 +422,7 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: mobile-sdk-sample @@ -434,7 +433,7 @@ jobs: json: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON }} - name: Playstore upload - uses: r0adkll/upload-google-play@v1.0.15 + uses: r0adkll/upload-google-play@v1.1.3 with: serviceAccountJson: google-play-services.json packageName: com.emarsys.sample diff --git a/.github/workflows/on_push_workflow.yml b/.github/workflows/on_push_workflow.yml index 1fb4f5cc..fbaa14d9 100644 --- a/.github/workflows/on_push_workflow.yml +++ b/.github/workflows/on_push_workflow.yml @@ -1,17 +1,30 @@ -name: Last push build +name: On Push on: - workflow_dispatch: + pull_request: + types: [ opened, reopened, synchronize ] push: - branches: [ dev ] + branches-ignore: + - 'dependabot/**' + workflow_dispatch: env: - RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD }} - RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} - RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} - RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} - DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }} - GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} + USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }} + RELEASE_MODE: ${{ vars.RELEASE_MODE }} + ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }} + ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} + ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} + ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} + FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }} + FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }} + GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }} + SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} + SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 }} SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png SLACK_TITLE: Commit status @@ -19,452 +32,119 @@ env: SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }} jobs: - Build: - # The type of runner that the job will run on + Test: + permissions: + contents: read + id-token: write runs-on: ubuntu-latest - name: Build job + name: Test & Lint + strategy: + matrix: + include: + - task: core + - task: mobile-engage + - task: predict + - task: emarsys-firebase + - task: emarsys-huawei + - task: emarsys-sdk + - task: lint steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: dev submodules: true fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - name: set up JDK 1.17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - name: create-google services json - uses: jsdaniell/create-json@1.1.2 - with: - name: google-services.json - json: ${{ secrets.GOOGLE_SERVICES_JSON }} - dir: sample - - - name: create local.properties - run: echo $ANDROID_HOME > local.properties - - - name: Build with Gradle - run: ./gradlew clean assembleAndroidTest -x lint - - - name: upload sample app artifact - uses: actions/upload-artifact@v2 - with: - name: sample - path: sample/build/outputs/apk/androidTest/debug/sample-debug-androidTest.apk - - - name: upload core test apk artifact - uses: actions/upload-artifact@v2 - with: - name: core - path: core/build/outputs/apk/androidTest/debug/core-debug-androidTest.apk - - - name: upload mobile-engage test apk artifact - uses: actions/upload-artifact@v2 - with: - name: mobile-engage - path: mobile-engage/build/outputs/apk/androidTest/debug/mobile-engage-debug-androidTest.apk - - - name: upload emarsys-sdk test apk artifact - uses: actions/upload-artifact@v2 - with: - name: predict - path: predict/build/outputs/apk/androidTest/debug/predict-debug-androidTest.apk - - - name: upload emarsys test apk artifact - uses: actions/upload-artifact@v2 - with: - name: emarsys - path: emarsys/build/outputs/apk/androidTest/debug/emarsys-debug-androidTest.apk - - - name: upload emarsys-sdk test apk artifact - uses: actions/upload-artifact@v2 - with: - name: emarsys-sdk - path: emarsys-sdk/build/outputs/apk/androidTest/debug/emarsys-sdk-debug-androidTest.apk - - - name: upload common test apk artifact - uses: actions/upload-artifact@v2 - with: - name: common - path: common/build/outputs/apk/androidTest/debug/common-debug-androidTest.apk - - - name: upload emarsys-firebase test apk artifact - uses: actions/upload-artifact@v2 - with: - name: emarsys-firebase - path: emarsys-firebase/build/outputs/apk/androidTest/debug/emarsys-firebase-debug-androidTest.apk - - - name: upload emarsys-huawei test apk artifact - uses: actions/upload-artifact@v2 - with: - name: emarsys-huawei - path: emarsys-huawei/build/outputs/apk/androidTest/debug/emarsys-huawei-debug-androidTest.apk - - - name: create testlab services json - uses: jsdaniell/create-json@1.1.2 - with: - name: sacc_key.json - json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - GradleLint: - name: Run lint on project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - name: set up JDK 1.17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - name: create-google services json - uses: jsdaniell/create-json@1.1.2 - with: - name: google-services.json - json: ${{ secrets.GOOGLE_SERVICES_JSON }} - dir: sample - - - name: create local.properties - run: echo $ANDROID_HOME > local.properties - - - name: Lint project with Gradle - run: ./gradlew lint - CreateReleaseBundle: - name: Create release bundle - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - name: set up JDK 1.17 - uses: actions/setup-java@v3 + - name: Set up JDK 1.17 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 - - name: create-google services json - uses: jsdaniell/create-json@1.1.2 - with: - name: google-services.json - json: ${{ secrets.GOOGLE_SERVICES_JSON }} - dir: sample - - - name: create local.properties - run: echo $ANDROID_HOME > local.properties - - - name: Create release keystore file - shell: bash - run: | - echo "${{ secrets.ANDROID_KEYSTORE }}" > mobile-team-android.jks.asc - gpg -d --passphrase "${{ secrets.ANDROID_GPG_PASSWORD }}" --batch mobile-team-android.jks.asc > sample/mobile-team-android.jks - - name: Create release sample app with Gradle - run: ./gradlew :sample:bundleRelease - - - name: Upload bundle - uses: actions/upload-artifact@v2 - with: - name: mobile-sdk-sample - path: sample/build/outputs/bundle/release/sample-release.aab - - TestCore: - name: Run core tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample - - - name: Download core tests - uses: actions/download-artifact@v2 - with: - name: core - - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:core' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - TestMobileEngage: - name: Run mobile-engage tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample - - - name: Download mobile-engage tests - uses: actions/download-artifact@v2 - with: - name: mobile-engage - - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:mobile-engage' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - TestPredict: - name: Run predict tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - name: Download sample app - uses: actions/download-artifact@v2 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 with: - name: sample + gradle-version: 8.6 + cache-overwrite-existing: true + gradle-home-cache-cleanup: true - - name: Download predict tests - uses: actions/download-artifact@v2 - with: - name: predict - - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:predict' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - TestEmarsysSDK: - name: Run emarsys-sdk tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample - - - name: Download emarsys-sdk tests - uses: actions/download-artifact@v2 - with: - name: emarsys-sdk - - - name: Display structure of downloaded files - run: ls -R - - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-sdk' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - TestEmarsys: - name: Run emarsys tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample - - - name: Download emarsys tests - uses: actions/download-artifact@v2 - with: - name: emarsys - - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:emarsys' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} - - TestCommon: - name: Run common tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample + - name: Prepare CI + run: make prepare-ci - - name: Download common tests - uses: actions/download-artifact@v2 + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2.1.2 with: - name: common + workload_identity_provider: 'projects/395478287999/locations/global/workloadIdentityPools/github-actions/providers/github-actions' + service_account: 'firebase-test-lab-service-acco@ems-mobile-sdk.iam.gserviceaccount.com' + create_credentials_file: true - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:common' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v2 - TestEmarsysFirebase: - name: Run emarsys-firebase tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" + - name: Build + run: make build-test - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample + - name: Test core + if: matrix.task == 'core' + run: make test-android-firebase-emulator MODULE_NAME=core - - name: Download emarsys-firebase tests - uses: actions/download-artifact@v2 - with: - name: emarsys-firebase + - name: Test mobile-engage + if: matrix.task == 'mobile-engage' + run: make test-android-firebase-emulator MODULE_NAME=mobile-engage - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-firebase' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + - name: Test predict + if: matrix.task == 'predict' + run: make test-android-firebase-emulator MODULE_NAME=predict - TestEmarsysHuawei: - name: Run emarsys-huawei tests on Firebase - needs: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" + - name: Test emarsys-firebase + if: matrix.task == 'emarsys-firebase' + run: make test-android-firebase-emulator MODULE_NAME=emarsys-firebase - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: sample + - name: Test emarsys-huawei + if: matrix.module == 'emarsys-huawei' + run: make task-android-firebase-emulator MODULE_NAME=emarsys-huawei - - name: Download emarsys-huawei tests - uses: actions/download-artifact@v2 - with: - name: emarsys-huawei + - name: Test emarsys-sdk + if: matrix.task == 'emarsys-sdk' + run: make test-android-firebase-emulator MODULE_NAME=emarsys-sdk - - name: Run tests - uses: asadmansr/Firebase-Test-Lab-Action@v1.0 - with: - arg-spec: 'testWithSomeVirtualDevices.yml:emarsys-huawei' - env: - SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + - name: Run lint + if: matrix.task == 'lint' + run: make lint - ReleaseSample: - name: Release sample app + Report: + if: always() + needs: [ Test ] runs-on: ubuntu-latest - needs: [ Build, TestCore, TestMobileEngage, TestPredict, TestEmarsysSDK, TestEmarsys, TestCommon, TestEmarsysFirebase, TestEmarsysHuawei, CreateReleaseBundle, GradleLint ] steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Download sample app - uses: actions/download-artifact@v2 - with: - name: mobile-sdk-sample - - - name: create-google services json - uses: jsdaniell/create-json@1.1.2 - with: - name: google-play-services.json - json: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON }} - - - name: Playstore upload - uses: r0adkll/upload-google-play@v1.0.15 + - name: Report on Slack (Error) + if: ${{ !cancelled() && contains(needs.*.result, 'failure') }} + uses: megamegax/slack_action@0.3.1 with: - serviceAccountJson: google-play-services.json - packageName: com.emarsys.sample - releaseFile: sample-release.aab - track: alpha + webhook_url: '${{env.SLACK_WEBHOOK}}' + channel: '${{env.SLACK_CHANNEL}}' + message: 'On push workflow failed! :man-gesturing-no: :blobcatfearful:' + user_name: '${{env.SLACK_USERNAME}}' + job_status: 'failure' + user_icon: '${{env.SLACK_ICON}}' + actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]' - SlackNotification: - name: Send slack notification - runs-on: ubuntu-latest - needs: [ ReleaseSample ] - steps: - - name: Slack Notification - uses: megamegax/slack_action@0.2.3 + - name: Report on Slack (Success) + if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }} + uses: megamegax/slack_action@0.3.1 with: + webhook_url: '${{env.SLACK_WEBHOOK}}' channel: '${{env.SLACK_CHANNEL}}' - message: 'Last push build successful! :man-gesturing-ok: :bananadance:' + message: 'On push workflow successful! :man-gesturing-ok: :success-kid:' user_name: '${{env.SLACK_USERNAME}}' job_status: 'success' user_icon: '${{env.SLACK_ICON}}' actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" },{ "type": "button", "text": "Install page", "url": "http://ems-mobileteam-artifacts.s3-website-eu-west-1.amazonaws.com/index-ems.html" }]' - - SlackNotificationOnError: - name: Send slack on error - runs-on: ubuntu-latest - needs: [ ReleaseSample ] - if: ${{ failure() }} - steps: - - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 # 0 indicates all history - - run: git fetch --all || echo "==> Accept any result" - - - name: Slack Notification - uses: megamegax/slack_action@0.2.3 + - name: Trigger automerge + if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') && github.event.pull_request != null && github.actor == 'dependabot[bot]' && github.event.pull_request.merged == false}} + uses: peter-evans/repository-dispatch@v3 with: - channel: '${{env.SLACK_CHANNEL}}' - message: 'Last push build failed! :man-gesturing-no: :blobcatfearful:' - user_name: '${{env.SLACK_USERNAME}}' - job_status: 'failure' - user_icon: '${{env.SLACK_ICON}}' - actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]' + token: ${{ secrets.AUTO_MERGE_TOKEN }} + event-type: checks-complete + client-payload: '{ "prNumber": "${{ github.event.pull_request.number }}"}' \ No newline at end of file diff --git a/.github/workflows/on_tag_workflow.yml b/.github/workflows/on_tag_workflow.yml index cbd6a140..9cf573e8 100644 --- a/.github/workflows/on_tag_workflow.yml +++ b/.github/workflows/on_tag_workflow.yml @@ -11,7 +11,6 @@ env: RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} RELEASE_STORE_FILE: ${{ secrets.RELEASE_STORE_FILE }} DEVELOPMENT_MODE: ${{ secrets.DEVELOPMENT_MODE }} - GOOGLE_SERVICES_API_KEY: ${{ secrets.GOOGLE_SERVICES_API_KEY }} SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png SLACK_TITLE: New SDK Release @@ -35,7 +34,7 @@ jobs: fetch-depth: 0 # 0 indicates all history - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -77,7 +76,7 @@ jobs: fetch-depth: 0 # 0 indicates all history - run: git fetch --all || echo "==> Accept any result" - name: set up JDK 1.17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 17 @@ -103,7 +102,7 @@ jobs: run: ./gradlew :sample:bundleRelease - name: Upload bundle - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: mobile-sdk-sample path: sample/build/outputs/bundle/release/sample-release.aab @@ -120,7 +119,7 @@ jobs: - run: git fetch --all || echo "==> Accept any result" - name: Download sample app - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: mobile-sdk-sample @@ -131,7 +130,7 @@ jobs: json: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON }} - name: Playstore upload - uses: r0adkll/upload-google-play@v1.1.1 + uses: r0adkll/upload-google-play@v1.1.3 with: serviceAccountJson: google-play-services.json packageName: com.emarsys.sample diff --git a/.github/workflows/release_sample_app_workflow.yml b/.github/workflows/release_sample_app_workflow.yml new file mode 100644 index 00000000..bc794bd1 --- /dev/null +++ b/.github/workflows/release_sample_app_workflow.yml @@ -0,0 +1,96 @@ +name: Release Sample + +on: + workflow_run: + workflows: [ "On Push" ] + types: + - completed + +env: + USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }} + RELEASE_MODE: ${{ vars.RELEASE_MODE }} + ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }} + ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} + ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} + ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} + FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }} + FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }} + GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }} + GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }} + SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} + SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 }} + SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} + SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png + SLACK_TITLE: Commit status + SLACK_USERNAME: Emarsys SDK - Android + SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }} + +jobs: + ReleaseSampleApp: + name: Release Sample App + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 # 0 indicates all history + - name: set up JDK 1.17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-disabled: true + + - name: Prepare CI + run: make prepare-ci + + - name: Prepare keystore file + run: make base64-secret-to-file SECRET=ANDROID_RELEASE_STORE_FILE_BASE64 FILE=sample/mobile-team-android.jks + + - name: Create sample app release bundle + run: ./gradlew :sample:bundleRelease + + - name: PlayStore upload + uses: r0adkll/upload-google-play@v1.1.3 + with: + serviceAccountJson: ./sample/google-services.json + packageName: com.emarsys.sample + releaseFile: sample/build/outputs/bundle/release/sample-release.aab + track: alpha + + Report: + if: always() + needs: [ ReleaseSampleApp ] + runs-on: ubuntu-latest + steps: + - name: Report on Slack (Error) + if: ${{ !cancelled() && contains(needs.*.result, 'failure') }} + uses: megamegax/slack_action@0.3.1 + with: + webhook_url: '${{env.SLACK_WEBHOOK}}' + channel: '${{env.SLACK_CHANNEL}}' + message: 'Release sample app failed! :man-gesturing-no: :blobcatfearful:' + user_name: '${{env.SLACK_USERNAME}}' + job_status: 'failure' + user_icon: '${{env.SLACK_ICON}}' + actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]' + + - name: Report on Slack (Success) + if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }} + uses: megamegax/slack_action@0.3.1 + with: + webhook_url: '${{env.SLACK_WEBHOOK}}' + channel: '${{env.SLACK_CHANNEL}}' + message: 'Sample app released! :man-gesturing-ok: :success-kid:' + user_name: '${{env.SLACK_USERNAME}}' + job_status: 'success' + user_icon: '${{env.SLACK_ICON}}' + actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" },{ "type": "button", "text": "Install page", "url": "http://ems-mobileteam-artifacts.s3-website-eu-west-1.amazonaws.com/index-ems.html" }]'