diff --git a/.github/pages/index.html b/.github/pages/index.html new file mode 100644 index 000000000..367340b07 --- /dev/null +++ b/.github/pages/index.html @@ -0,0 +1,25 @@ + + + + + +Mindbox Android SDK + + + +
+

Mindbox Android SDK

+API referencePublic API of the develop branch +Test coverageUnit test coverage of the develop branch +
+ + diff --git a/.github/workflows/lint_unitTests_build.yml b/.github/workflows/lint_unitTests_build.yml index efc250cd3..4435f5530 100644 --- a/.github/workflows/lint_unitTests_build.yml +++ b/.github/workflows/lint_unitTests_build.yml @@ -10,6 +10,7 @@ on: - opened - reopened - synchronize + workflow_dispatch: permissions: contents: read @@ -24,18 +25,18 @@ jobs: submodules: true - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' - name: Set up Gradle - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' && !startsWith(github.ref, 'refs/heads/mission/') }} - name: Setup Android SDK - uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: packages: 'platform-tools' @@ -81,18 +82,18 @@ jobs: submodules: true - name: Set up JDK 21 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '21' - name: Set up Gradle - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' && !startsWith(github.ref, 'refs/heads/mission/') }} - name: Setup Android SDK - uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: packages: 'platform-tools' @@ -100,7 +101,7 @@ jobs: run: ./gradlew --no-daemon --stacktrace testDebugUnitTest :koverHtmlReportCoverage - name: test report - uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6.4.2 + uses: mikepenz/action-junit-report@a16be3a69023e9bd7e748ede768b3282ea7b30ce # v6.7.1 if: ${{ always() }} with: report_paths: '**/build/test-results/testDebugUnitTest/TEST-*.xml' @@ -109,25 +110,99 @@ jobs: annotate_only: true - name: upload coverage report - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 if: github.ref == 'refs/heads/develop' with: + name: coverage-site path: build/reports/kover/htmlCoverage + retention-days: 1 - deploy-coverage: + api-reference: runs-on: ubuntu-latest - needs: unit if: github.ref == 'refs/heads/develop' + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 + with: + distribution: 'temurin' + java-version: '17' + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 + + - name: Setup Android SDK + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 + with: + packages: 'platform-tools' + + - name: build the API reference + run: ./gradlew --no-daemon :dokkaGenerate + + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: api-reference + path: build/dokka/html + retention-days: 1 + + pages: + runs-on: ubuntu-latest + needs: [unit, api-reference] + if: ${{ !cancelled() && github.ref == 'refs/heads/develop' && needs.unit.result == 'success' }} permissions: + contents: read pages: write id-token: write environment: name: github-pages url: ${{ steps.deploy.outputs.page_url }} steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: download coverage report + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: coverage-site + path: site/coverage + + - name: download API reference + if: needs.api-reference.result == 'success' + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: api-reference + path: api-reference + + - name: cache API reference + if: needs.api-reference.result == 'success' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: api-reference + key: api-reference-${{ github.sha }} + + - name: restore the last API reference + if: needs.api-reference.result != 'success' + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: api-reference + key: api-reference-${{ github.sha }} + restore-keys: api-reference- + + - name: assemble site + run: | + cp .github/pages/index.html site/ + [ -d api-reference ] || { echo "::error::No API reference to deploy; the published site stays as it is"; exit 1; } + mv api-reference site/api + + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + - name: deploy to GitHub Pages id: deploy - uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 build: runs-on: ubuntu-latest @@ -137,13 +212,13 @@ jobs: submodules: true - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' - name: Set up Gradle - uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 + uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 with: cache-read-only: ${{ github.ref != 'refs/heads/develop' && !startsWith(github.ref, 'refs/heads/mission/') }} diff --git a/.github/workflows/manual-prepare_release_branch.yml b/.github/workflows/manual-prepare_release_branch.yml index 599e05a18..8b8f113b1 100644 --- a/.github/workflows/manual-prepare_release_branch.yml +++ b/.github/workflows/manual-prepare_release_branch.yml @@ -142,9 +142,17 @@ jobs: runs-on: ubuntu-latest needs: [bump_and_branch, check_sdk_version] steps: + - name: Create App token + id: app-token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.MOBILE_CI_APP_CLIENT_ID }} + private-key: ${{ secrets.MOBILE_CI_APP_PRIVATE_KEY }} + permission-contents: read + permission-pull-requests: write - name: Create PR via GitHub CLI env: - GH_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} SRC: ${{ needs.bump_and_branch.outputs.release_branch }} DST: ${{ github.event.inputs.target_branch }} REPO: ${{ github.repository }} diff --git a/.github/workflows/prepare_release_branch.yml b/.github/workflows/prepare_release_branch.yml index 628400ac3..7f38f4766 100644 --- a/.github/workflows/prepare_release_branch.yml +++ b/.github/workflows/prepare_release_branch.yml @@ -97,9 +97,18 @@ jobs: with: submodules: recursive + - name: Create App token + id: app-token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.MOBILE_CI_APP_CLIENT_ID }} + private-key: ${{ secrets.MOBILE_CI_APP_PRIVATE_KEY }} + permission-contents: read + permission-pull-requests: write + - name: Create Pull Request env: - GH_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} REF_NAME: ${{ github.ref_name }} run: | gh pr create \ diff --git a/.github/workflows/publish-example-to-play.yml b/.github/workflows/publish-example-to-play.yml index 88c08b031..9db178585 100644 --- a/.github/workflows/publish-example-to-play.yml +++ b/.github/workflows/publish-example-to-play.yml @@ -48,13 +48,13 @@ jobs: echo "version_name=$version_name" >> "$GITHUB_OUTPUT" - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' - name: Setup Android SDK - uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: packages: 'platform-tools' @@ -89,7 +89,7 @@ jobs: -PEXAMPLE_VERSION_CODE="$VERSION_CODE" - name: Attach AAB to workflow run - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: example-release-bundle path: example/app/build/outputs/bundle/release/app-release.aab diff --git a/.github/workflows/publish-from-master-or-support.yml b/.github/workflows/publish-from-master-or-support.yml index f60e6957a..3a07c5f9d 100644 --- a/.github/workflows/publish-from-master-or-support.yml +++ b/.github/workflows/publish-from-master-or-support.yml @@ -25,4 +25,4 @@ jobs: SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} CENTER_PORTAL_USERNAME: ${{ secrets.CENTER_PORTAL_USERNAME }} CENTER_PORTAL_PASSWORD: ${{ secrets.CENTER_PORTAL_PASSWORD }} - PAT_FOR_TRIGGERING_BRANCH_PROTECTION: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} \ No newline at end of file + MOBILE_CI_APP_PRIVATE_KEY: ${{ secrets.MOBILE_CI_APP_PRIVATE_KEY }} \ No newline at end of file diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml index 6c15a81d6..9c6fb1cc5 100644 --- a/.github/workflows/publish-manual.yml +++ b/.github/workflows/publish-manual.yml @@ -34,4 +34,4 @@ jobs: SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }} CENTER_PORTAL_USERNAME: ${{ secrets.CENTER_PORTAL_USERNAME }} CENTER_PORTAL_PASSWORD: ${{ secrets.CENTER_PORTAL_PASSWORD }} - PAT_FOR_TRIGGERING_BRANCH_PROTECTION: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + MOBILE_CI_APP_PRIVATE_KEY: ${{ secrets.MOBILE_CI_APP_PRIVATE_KEY }} diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 68e9dd155..c18b47d14 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -19,7 +19,7 @@ on: required: true CENTER_PORTAL_PASSWORD: required: true - PAT_FOR_TRIGGERING_BRANCH_PROTECTION: + MOBILE_CI_APP_PRIVATE_KEY: required: true permissions: @@ -35,12 +35,12 @@ jobs: submodules: recursive - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' - name: Setup Android SDK - uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: packages: 'platform-tools' - name: lint check @@ -55,12 +55,12 @@ jobs: submodules: recursive - name: Set up JDK 21 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '21' - name: Setup Android SDK - uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4.0.1 + uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4 with: packages: 'platform-tools' - name: unit tests @@ -76,7 +76,7 @@ jobs: submodules: recursive - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' @@ -120,7 +120,7 @@ jobs: ref: ${{ inputs.branch }} submodules: recursive - name: Set up JDK 17 - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 with: distribution: 'temurin' java-version: '17' @@ -178,16 +178,26 @@ jobs: startsWith(github.head_ref, 'release') && github.base_ref == 'master' runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} steps: + - name: Create App token + id: app-token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.MOBILE_CI_APP_CLIENT_ID }} + private-key: ${{ secrets.MOBILE_CI_APP_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write - name: Checkout develop branch uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: develop - name: Create Pull Request + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} run: gh pr create --base develop --head master --title "Merge 'master' into 'develop' after release" --body "Automated Pull Request to merge 'master' into 'develop' after release" - name: Merge Pull Request + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | pr_number=$(gh pr list --base develop --head master --json number --jq '.[0].number') gh pr merge "$pr_number" --merge --auto diff --git a/build.gradle b/build.gradle index 27a8054c4..948a582a7 100644 --- a/build.gradle +++ b/build.gradle @@ -40,17 +40,28 @@ project(':mindbox-common') { } apply plugin: 'org.jetbrains.kotlinx.kover' +apply plugin: 'org.jetbrains.dokka' -dependencies { - kover(project(':sdk')) - kover(project(':mindbox-firebase')) - kover(project(':mindbox-huawei')) - kover(project(':mindbox-rustore')) - kover(project(':mindbox-firebase-starter')) - kover(project(':mindbox-huawei-starter')) - kover(project(':mindbox-rustore-starter')) - kover(project(':mindbox-sdk-starter-core')) - kover(project(':mindbox-embedded-compose')) +def publishedAndroidModules = [ + ':sdk', + ':mindbox-firebase', + ':mindbox-huawei', + ':mindbox-rustore', + ':mindbox-firebase-starter', + ':mindbox-huawei-starter', + ':mindbox-rustore-starter', + ':mindbox-sdk-starter-core', + ':mindbox-embedded-compose', +] + +publishedAndroidModules.each { path -> + project(path) { + apply plugin: 'org.jetbrains.dokka' + } + dependencies { + kover(project(path)) + dokka(project(path)) + } } kover { @@ -59,6 +70,6 @@ kover { } } -tasks.register('clean', Delete) { - delete rootProject.getLayout().getBuildDirectory() +dokka { + moduleName.set('Mindbox Android SDK') } \ No newline at end of file diff --git a/example/app/build.gradle b/example/app/build.gradle index 8556b6b04..91a59c9f8 100644 --- a/example/app/build.gradle +++ b/example/app/build.gradle @@ -38,7 +38,7 @@ android { defaultConfig { applicationId "com.mindbox.example" - minSdk 21 + minSdk 23 targetSdk 36 versionCode EXAMPLE_VERSION_CODE.toInteger() // versionName is taken from SDK_VERSION_NAME in the android-sdk repo root @@ -133,7 +133,7 @@ dependencies { implementation 'com.google.code.gson:gson:2.11.0' // Mindbox - implementation 'cloud.mindbox:mobile-sdk:2.16.0' + implementation 'cloud.mindbox:mobile-sdk:2.17.0' implementation 'cloud.mindbox:mindbox-firebase' implementation 'cloud.mindbox:mindbox-huawei' implementation 'cloud.mindbox:mindbox-rustore' diff --git a/example/app/src/main/res/values-night/themes.xml b/example/app/src/main/res/values-night/themes.xml index 6592f212b..77204d7aa 100644 --- a/example/app/src/main/res/values-night/themes.xml +++ b/example/app/src/main/res/values-night/themes.xml @@ -1,8 +1,8 @@ - +