diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 980af09772..50651ba718 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,8 +6,12 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "weekly" + interval: "daily" + commit-message: + prefix: "TP-52884 | " - package-ecosystem: "gradle" directory: "/" schedule: - interval: "weekly" + interval: "daily" + commit-message: + prefix: "TP-52884 | " diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index b8374148e1..7d773a417d 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -22,6 +22,14 @@ jobs: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + build-qa-release: + if: github.event_name == 'push' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) + uses: ./.github/workflows/generate_build.yml + with: + environment: qa + type: release + output: APK + generate-apk-diff: if: github.event_name == 'pull_request' && github.base_ref == 'development' uses: ./.github/workflows/generate_apk_diff.yml @@ -37,11 +45,3 @@ jobs: secrets: AWS_ACCESS_KEY_GITHUB_CACHE: ${{ secrets.AWS_ACCESS_KEY_GITHUB_CACHE }} AWS_SECRET_KEY_GITHUB_CACHE: ${{ secrets.AWS_SECRET_KEY_GITHUB_CACHE }} - - build-qa-release: - if: github.event_name == 'push' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release-')) - uses: ./.github/workflows/generate_build.yml - with: - environment: qa - type: release - output: APK diff --git a/.github/workflows/android_checkstyle.yml b/.github/workflows/android_checkstyle.yml index 28a9985d20..a3e7e42a60 100644 --- a/.github/workflows/android_checkstyle.yml +++ b/.github/workflows/android_checkstyle.yml @@ -12,7 +12,7 @@ jobs: spotless: runs-on: [ default ] steps: - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v4 - name: Fetch origin/development run: git fetch origin development diff --git a/.github/workflows/branch_cut.yml b/.github/workflows/branch_cut.yml index bea5bfc87a..5a199fb425 100644 --- a/.github/workflows/branch_cut.yml +++ b/.github/workflows/branch_cut.yml @@ -17,7 +17,7 @@ jobs: runs-on: [ default ] environment: RELEASE_BRANCH_CUT steps: - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v4 with: token: ${{ secrets.GH_PAT }} @@ -33,6 +33,6 @@ jobs: sed -i 's/def VERSION_NAME = "[0-9].*"/def VERSION_NAME = "${{ github.event.inputs.version_name }}"/g' app/build.gradle sed -i 's/def VERSION_CODE = [0-9].*/def VERSION_CODE = ${{ github.event.inputs.version_code }}/g' app/build.gradle - name: Commit Version Changes - run: git commit app/build.gradle -m "Bump Project Version to ${{ github.event.inputs.version_name }} (${{ github.event.inputs.version_code }})" + run: git commit app/build.gradle -m "TP-52887 | Bump Project Version to ${{ github.event.inputs.version_name }} (${{ github.event.inputs.version_code }})" - name: Push release-${{ github.event.inputs.version_name }} Branch run: git push -u origin release-${{ github.event.inputs.version_name }} diff --git a/.github/workflows/generate_apk_diff.yml b/.github/workflows/generate_apk_diff.yml index d5dee7d65c..cac2543b10 100644 --- a/.github/workflows/generate_apk_diff.yml +++ b/.github/workflows/generate_apk_diff.yml @@ -1,4 +1,5 @@ -name: APK Diff CI +name: APK Size Difference CI + on: workflow_call: secrets: @@ -8,16 +9,15 @@ on: AWS_SECRET_KEY_GITHUB_CACHE: description: Secret Key required: true + jobs: generate-apk-diff: - runs-on: self-hosted + runs-on: [ default ] steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v4 - name: Clear Cache - run: | - sudo rm -rf ~/Python - + run: sudo rm -rf ~/Python - name: Download Artifact id: download uses: actions/download-artifact@v4 @@ -26,8 +26,7 @@ jobs: - name: Echo Download Path run: echo ${{steps.download.outputs.download-path}} - name: List Files - run: | - ls -R ${{steps.download.outputs.download-path}} + run: ls -R ${{steps.download.outputs.download-path}} - name: Set up Python uses: actions/setup-python@v5 with: @@ -36,7 +35,7 @@ jobs: run: pip install -r .github/actions/s3_file_transfer/dependencies.txt - name: Download File run: python .github/actions/s3_file_transfer/script.py download ${{ secrets.AWS_ACCESS_KEY_GITHUB_CACHE }} ${{ secrets.AWS_SECRET_KEY_GITHUB_CACHE }} app/build/outputs/apk/dev/debug/latest_build.apk - - name: Compare APK Size Diff + - name: Compare APK Size Difference id: apk-diff run: | previous_apk_path="app/build/outputs/apk/dev/debug/latest_build.apk" @@ -51,9 +50,9 @@ jobs: id: size-diff-check run: | size_diff=${{ steps.apk-diff.outputs.size_diff }} - if [[ $size_diff -gt 153600 ]]; then + if [[ $size_diff -gt 204800 ]]; then echo "::set-output name=job_status::failure" - elif [[ $size_diff -gt 71680 ]]; then + elif [[ $size_diff -gt 102400 ]]; then echo "::set-output name=job_status::warning" else echo "::set-output name=job_status::success" @@ -63,9 +62,11 @@ jobs: with: script: | const sizeDiff = ${{ steps.apk-diff.outputs.size_diff }}; - const sizeDiffKB = Math.round(sizeDiff / 1024); - const codeOwners = ['@navi-android/leads', '@navi-android/owners']; // Replace with the desired code owners' usernames - const codeOwnerTags = codeOwners.join(' '); // Join the code owner usernames with a space + const apkSizeDifferenceInKilobytes = Math.round(sizeDiff / 1024); + + const codeOwners = ['@navi-android/leads', '@navi-android/codeowners']; + const codeOwnerTags = codeOwners.join(' '); + const additionalInfo = ` APK size can increase due to various factors. Some common reasons include: - Adding external libraries: Before including any external libraries, it's advisable to seek signoff from ${codeOwnerTags}. @@ -73,36 +74,34 @@ jobs: - Including Lottie JSON files: When adding Lottie animations, it's recommended to prioritize remote Lottie files over local ones. - Adding assets/resources: The addition of assets and resources can contribute to APK size growth. `; + let comment; - if (sizeDiffKB > 150) { - comment = `### :exclamation: APK Size Exceeded Limit - The APK size has increased by ${sizeDiffKB} KB compared to the previous version. Please provide the reasons for this increase cc : ${codeOwnerTags} - ${additionalInfo}`; + + if (apkSizeDifferenceInKilobytes > 200) { + comment = `### :exclamation: APK Size Exceeded Limit + The APK size has increased by ${apkSizeDifferenceInKilobytes}KB compared to the previous version. Please provide the justification for this increase. + ${additionalInfo}`; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment - }); - - } else if (sizeDiffKB > 70) { - comment = `### :warning: APK Size Warning - The APK size has increased by ${sizeDiffKB} KB compared to the previous version. Please provide the reasons for this increase cc : ${codeOwnerTags} - ${additionalInfo}`; - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment - }); + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); + } else if (apkSizeDifferenceInKilobytes > 100) { + comment = `### :warning: APK Size Warning + The APK size has increased by ${apkSizeDifferenceInKilobytes}KB compared to the previous version. Please provide the justification for this increase. + ${additionalInfo}`; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); } - name: Cleanup - run: | - echo "Cleaning up..." - rm -rf *.tmp - - name: Fail Job if Size Diff Exceeds 150 KB + run: rm -rf *.tmp + - name: Fail Job if Size Difference Exceeds 200 KB if: ${{ steps.size-diff-check.outputs.job_status == 'failure' }} - run: exit 1 \ No newline at end of file + run: exit 1 diff --git a/.github/workflows/generate_build.yml b/.github/workflows/generate_build.yml index a8ee254278..508410b9af 100644 --- a/.github/workflows/generate_build.yml +++ b/.github/workflows/generate_build.yml @@ -63,7 +63,7 @@ jobs: generate: runs-on: [ android ] steps: - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v4 - name: Override App Version Code if: github.event_name == 'workflow_dispatch' && inputs.version_code != '' @@ -108,11 +108,11 @@ jobs: app/build/outputs/apk_from_bundle/ app/build/outputs/bundle/ retention-days: 5 - - name: Upload to nexus and log size + - name: Upload to Nexus and log size if: inputs.type == 'release' && github.event_name == 'push' && startsWith(github.ref_name, 'release-') run: | current_version=$(awk '/VERSION_CODE/ {print $4}' app/build.gradle) current_apk_size=$(stat -c %s app/build/outputs/apk_from_bundle/qaRelease/app-qa-release-universal.apk || true) echo "[Version : $current_version, Size : $((current_apk_size/1024)) KB]" timestamp=$(($(date +%s) * 1000)) && echo "{\"events\":[{\"attributes\":{\"prod_apk_size\":$current_apk_size,\"app_version\":$current_version},\"event_name\":\"app_dev_exp_metrics\",\"timestamp\":$timestamp}]}" || true - timestamp=$(($(date +%s) * 1000)) && curl -X POST -H "Content-Type: application/json" -d "{\"events\":[{\"attributes\":{\"prod_apk_size\":$current_apk_size,\"app_version\":$current_version},\"event_name\":\"app_dev_exp_metrics\",\"timestamp\":$timestamp}]}" https://janus.prod.navi-tech.in/events/json || true \ No newline at end of file + timestamp=$(($(date +%s) * 1000)) && curl -X POST -H "Content-Type: application/json" -d "{\"events\":[{\"attributes\":{\"prod_apk_size\":$current_apk_size,\"app_version\":$current_version},\"event_name\":\"app_dev_exp_metrics\",\"timestamp\":$timestamp}]}" https://janus.prod.navi-tech.in/events/json || true diff --git a/.github/workflows/metrics_logger.yml b/.github/workflows/metrics_logger.yml index 5f2c9d839c..42e2d90fee 100644 --- a/.github/workflows/metrics_logger.yml +++ b/.github/workflows/metrics_logger.yml @@ -4,7 +4,6 @@ on: schedule: - cron: '30 1 * * *' - env: NON_PROD_RELEASE_STORE_PASSWORD: android NON_PROD_RELEASE_KEY_ALIAS: navi @@ -21,7 +20,7 @@ jobs: - cachedRelease runs-on: [ macOS ] steps: - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v4 - name: Log Build Metadata run: | @@ -76,5 +75,4 @@ jobs: timestamp=$(($(date +%s) * 1000)) && curl -X POST -H "Content-Type: application/json" -d "{\"events\":[{\"attributes\":{\"$build_time_key\":\"${{ steps.build_apk.outputs.BUILD_TIME }}\",\"$apk_size_key\":\"${{ steps.apk_size.outputs.APK_SIZE }}\"},\"event_name\":\"app_dev_exp_metrics\",\"timestamp\":$timestamp}]}" https://janus.prod.navi-tech.in/events/json - name: Run UI tests if: matrix.build_type == 'freshDebug' - run: | - ./gradlew :app:connectedUitestDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=com.navi.ap --stacktrace \ No newline at end of file + run: ./gradlew :app:connectedUitestDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=com.navi.ap --stacktrace diff --git a/.github/workflows/pr_lint.yml b/.github/workflows/pr_lint.yml deleted file mode 100644 index 5255033fd0..0000000000 --- a/.github/workflows/pr_lint.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Pull Request Lint CI - -on: - pull_request: - branches: [ master, release-*, development ] - types: [ edited, opened, reopened, synchronize ] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - pr-lint: - runs-on: [ default ] - steps: - - name: Pull Request Ticket Check Action - uses: navi-synced-actions/neofinancial-ticket-check-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ticketPrefix: 'TP-' - titleRegex: '^TP-(?\d{5}) \| ' - branchRegex: '^TP-(?\d{5})' - bodyRegex: 'TP-(?\d{5})' - bodyURLRegex: 'http(s?):\/\/(navihq.atlassian.net)(\/browse)\/(TP\-)(?\d{5})' - titleFormat: '%prefix%%id% | %title%' diff --git a/.github/workflows/pr_review.yml b/.github/workflows/pr_review.yml index 9cdda63399..44eb5eee0e 100644 --- a/.github/workflows/pr_review.yml +++ b/.github/workflows/pr_review.yml @@ -5,6 +5,10 @@ on: types: - labeled +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: label_triggered_job: runs-on: [ default ] @@ -18,7 +22,7 @@ jobs: PR_BODY="${{ github.event.pull_request.body }}" PR_AUTHOR="${{ github.event.pull_request.user.login }}" - MESSAGE=" Please review this PR" + MESSAGE=" Please review this PR." # Define an array of attachments ATTACHMENTS="[{ @@ -33,5 +37,5 @@ jobs: # Send the message with the attachment curl -X POST -H 'Content-type: application/json' --data "$JSON_PAYLOAD" "${{ secrets.SLACK_PR_STATUS_HOOK }}" else - echo "Label is not Ready For Review. Skipping Slack notification." + echo "Label is not Ready For Review. Skipping Slack Notification." fi diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 2d4c12f5e3..897c501ce5 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -24,7 +24,7 @@ jobs: READ_SEMGREP_RULES: ${{secrets.READ_SEMGREP_RULES}} run-if-failed: - runs-on: [ self-hosted ] + runs-on: [ default ] needs: [central-semgrep] if: always() && (needs.semgrep.result == 'failure') steps: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index ed21cf83a4..e300e273de 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,9 +12,9 @@ jobs: - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-pr-stale: 42 - stale-pr-label: 'STALE' - stale-pr-message: "This PR hasn't seen activity in the last 6 weeks! Should it be merged, closed, or worked on further? If you want to keep it open, post a comment or remove the `STALE` label – otherwise, this will be closed in 2 weeks." - days-before-pr-close: 14 - close-pr-label: 'CLOSED BY STALE' - close-pr-message: 'This PR was closed due to 8 weeks of inactivity. Feel free to reopen it if still relevant.' + days-before-pr-stale: 21 + stale-pr-label: 'STATUS / STALE' + stale-pr-message: "This PR hasn't seen activity in the last 3 weeks! Should it be merged, closed, or worked on further? If you want to keep it open, post a comment or remove the `STATUS / STALE` label – otherwise, this will be closed in 1 week." + days-before-pr-close: 7 + close-pr-label: 'STATUS / CLOSED BY STALE' + close-pr-message: 'This PR was closed due to 4 weeks of inactivity. Feel free to reopen it if still relevant.' diff --git a/.github/workflows/upload_file.yml b/.github/workflows/upload_file.yml index eea48efd19..65798b86c5 100644 --- a/.github/workflows/upload_file.yml +++ b/.github/workflows/upload_file.yml @@ -1,4 +1,4 @@ -name: Upload Latest Apk to S3 CI +name: Upload Latest APK to S3 CI on: workflow_call: @@ -12,42 +12,28 @@ on: jobs: build: - - runs-on: [ self-hosted ] - + runs-on: [ default ] steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v4 - - name: Clear Cache - run: | - sudo rm -rf ~/Python - + run: sudo rm -rf ~/Python - name: Download Artifact id: download uses: actions/download-artifact@v4 with: name: app-qa-debug - - name: Print Download Path run: echo ${{steps.download.outputs.download-path}} - - name: List Files - run: | - ls -R ${{steps.download.outputs.download-path}} - + run: ls -R ${{steps.download.outputs.download-path}} - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.9.7' - - name: Install dependencies run: pip install -r .github/actions/s3_file_transfer/dependencies.txt - - name: Upload File run: python ./.github/actions/s3_file_transfer/script.py upload ${{secrets.AWS_ACCESS_KEY_GITHUB_CACHE}} ${{secrets.AWS_SECRET_KEY_GITHUB_CACHE}} ${{steps.download.outputs.download-path}}/apk_from_bundle/qaDebug/app-qa-debug-universal.apk - - name: Cleanup - run: | - echo "Cleaning up..." - rm -rf *.tmp \ No newline at end of file + run: rm -rf *.tmp \ No newline at end of file diff --git a/.github/workflows/validate_checklists.yml b/.github/workflows/validate_checklists.yml deleted file mode 100644 index 27adead479..0000000000 --- a/.github/workflows/validate_checklists.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Checklist CI - -on: - pull_request: - branches: [ master, release-*, development ] - types: [ edited, opened, reopened, synchronize ] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - validate-checklists: - runs-on: [ default ] - steps: - - name: Validate Checklists - uses: navi-synced-actions/checkmate@master diff --git a/.github/workflows/validate_release_pr.yml b/.github/workflows/validate_release_pr.yml index 04e5dbe8bd..081ba0563f 100644 --- a/.github/workflows/validate_release_pr.yml +++ b/.github/workflows/validate_release_pr.yml @@ -1,4 +1,4 @@ -name: Release PR CI +name: Validate Release PR CI on: pull_request: