From 4e1191ab5397580ca4abb819df09b3bfe982cd40 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:21:57 +0530 Subject: [PATCH 01/10] Update stats.yml --- .github/workflows/stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 55478cfc7..3bf452694 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -90,7 +90,7 @@ jobs: console.log(`Recent Commits count - ${recentCommitsCount}`); - if(recentCommitsCount > 0) { + if(recentCommitsCount > 0 || !${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }}) { console.log("New commits found after the last apk & aab stat analysis"); core.setOutput("new_commits", "true"); } else { From 7301bf73849543a800a0c2bb14dbf564a0b5d768 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:33:39 +0530 Subject: [PATCH 02/10] Update stats.yml --- .github/workflows/stats.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 3bf452694..747b433f6 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -81,7 +81,8 @@ jobs: repo: context.repo.repo, pull_number: ${{ matrix.prInfo.number }}, }); - + + const latestCommentDate = ${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }} const recentCommits = commits.filter(commit => { const commitDate = new Date(commit.commit.committer.date); return commitDate > new Date("${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }}"); @@ -90,7 +91,7 @@ jobs: console.log(`Recent Commits count - ${recentCommitsCount}`); - if(recentCommitsCount > 0 || !${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }}) { + if(recentCommitsCount > 0 || !latestCommentDate) { console.log("New commits found after the last apk & aab stat analysis"); core.setOutput("new_commits", "true"); } else { From 7cea072deada5d863887ab85b5bd37d13a4199e3 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:36:30 +0530 Subject: [PATCH 03/10] Update stats.yml --- .github/workflows/stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 747b433f6..6babdada5 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -82,7 +82,7 @@ jobs: pull_number: ${{ matrix.prInfo.number }}, }); - const latestCommentDate = ${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }} + const latestCommentDate = "${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }}"; const recentCommits = commits.filter(commit => { const commitDate = new Date(commit.commit.committer.date); return commitDate > new Date("${{ steps.find_latest_apk_aab_comment.outputs.latest_aab_comment_created_at }}"); From 8cdf3411b1bf742d40568574656551b516775150 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:24:21 +0530 Subject: [PATCH 04/10] Update stats.yml --- .github/workflows/stats.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index 6babdada5..c9f9c1bde 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -276,15 +276,21 @@ jobs: - name: Compare apk aab analysis with the previous report if: ${{ steps.check_commits_after_latest_apk_aab_comment.outputs.new_commits == 'true' }} run: | - sed -i -e '$a\' ./develop/brief_build_summary.log - sed -i -e '$a\' latest_aab_comment_body.log + if [ -f latest_aab_comment_body.log ]; then + sed -i -e '$a\' ./develop/brief_build_summary.log + sed -i -e '$a\' latest_aab_comment_body.log - if diff -B ./develop/brief_build_summary.log latest_aab_comment_body.log > /dev/null; then - echo "No significant changes detected; skipping apk aab analysis comment." - echo "skip_apk_aab_comment=true" >> $GITHUB_ENV + if diff -B ./develop/brief_build_summary.log latest_aab_comment_body.log > /dev/null; then + echo "No significant changes detected; skipping apk aab analysis comment." + echo "skip_apk_aab_comment=true" >> $GITHUB_ENV + else + echo "Changes detected; proceeding with the apk aab analysis comment." + diff ./develop/brief_build_summary.log latest_aab_comment_body.log || true + echo "skip_apk_aab_comment=false" >> $GITHUB_ENV + fi else - echo "Changes detected; proceeding with the apk aab analysis comment." - diff ./develop/brief_build_summary.log latest_aab_comment_body.log || true + # File does not exist, skip analysis + echo "No 'latest_aab_comment_body.log' found; skipping apk aab analysis comment." echo "skip_apk_aab_comment=false" >> $GITHUB_ENV fi From 519ecc22eb5a9f47ad24d79bd9638bf5e12ffe52 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:59:03 +0530 Subject: [PATCH 05/10] Update stats.yml --- .github/workflows/stats.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index c9f9c1bde..f0455103b 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml @@ -289,13 +289,13 @@ jobs: echo "skip_apk_aab_comment=false" >> $GITHUB_ENV fi else - # File does not exist, skip analysis - echo "No 'latest_aab_comment_body.log' found; skipping apk aab analysis comment." + # File does not exist, post apk aab analysis comment + echo "No 'latest_aab_comment_body.log' found; introducing apk aab analysis comment." echo "skip_apk_aab_comment=false" >> $GITHUB_ENV fi - name: Add build stats summary comment - if: ${{ steps.check_commits_after_latest_apk_aab_comment.outputs.new_commits == 'true' && !env.skip_apk_aab_comment }} + if: ${{ steps.check_commits_after_latest_apk_aab_comment.outputs.new_commits == 'true' && env.skip_apk_aab_comment == 'false' }} env: PR_NUMBER: ${{ matrix.prInfo.number }} uses: peter-evans/create-or-update-comment@v1 From ff421532d748779e1176eac46ea7ae34f0f0dec9 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:25:34 +0530 Subject: [PATCH 06/10] Update comment_coverage_report.yml --- .github/workflows/comment_coverage_report.yml | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/comment_coverage_report.yml b/.github/workflows/comment_coverage_report.yml index 117943e87..235b158fb 100644 --- a/.github/workflows/comment_coverage_report.yml +++ b/.github/workflows/comment_coverage_report.yml @@ -39,6 +39,29 @@ jobs: if: ${{ !cancelled() }} runs-on: ubuntu-latest steps: + - name: Find the latest Code Coverage comment + uses: actions/github-script@v6 + id: find_latest_code_coverage_comment + with: + script: | + const fs = require('fs'); + const comments = await github.paginate(github.rest.issues.listComments, { + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: ${{ matrix.prInfo.number }}, + }); + + for (let i = comments.length - 1; i >= 0; i--) { + if (comments[i].body.includes("Coverage Report")) { + const latestCodeCoverageComment = comments[i]; + const commentBody = latestCodeCoverageComment.body; + console.log(`Latest Code Coverage Comment Body: ${commentBody}`); + fs.writeFileSync('latest_code_coverage_comment_body.md', commentBody, 'utf8'); + + return + } + } + - name: Find the last Coverage Report uses: peter-evans/find-comment@v3 id: last-coverage-report @@ -87,9 +110,9 @@ jobs: - name: Compare coverage report with the comment body (workkkkk!!) run: | sed -i -e '$a\' CoverageReport.md - sed -i -e '$a\' comment.md + sed -i -e '$a\' latest_code_coverage_comment_body.md - if diff -B CoverageReport.md comment.md > /dev/null; then + if diff -B CoverageReport.md latest_code_coverage_comment_body.md > /dev/null; then echo "No significant changes detected; skipping coverage comment." echo "skip_coverage_comment=true" >> $GITHUB_ENV else From 70faea630184a3516bb7dac735f10f8d0cb39b85 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:41:30 +0530 Subject: [PATCH 07/10] Update comment_coverage_report.yml --- .github/workflows/comment_coverage_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/comment_coverage_report.yml b/.github/workflows/comment_coverage_report.yml index 235b158fb..73cca9258 100644 --- a/.github/workflows/comment_coverage_report.yml +++ b/.github/workflows/comment_coverage_report.yml @@ -48,7 +48,7 @@ jobs: const comments = await github.paginate(github.rest.issues.listComments, { owner: context.repo.owner, repo: context.repo.repo, - issue_number: ${{ matrix.prInfo.number }}, + issue_number: ${{ github.event.pull_request.number }}, }); for (let i = comments.length - 1; i >= 0; i--) { From f3120656956b48a5d45151a1ff5763d13eb107a8 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:46:14 +0530 Subject: [PATCH 08/10] Update comment_coverage_report.yml --- .github/workflows/comment_coverage_report.yml | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.github/workflows/comment_coverage_report.yml b/.github/workflows/comment_coverage_report.yml index 73cca9258..8dfa3ebe9 100644 --- a/.github/workflows/comment_coverage_report.yml +++ b/.github/workflows/comment_coverage_report.yml @@ -39,12 +39,10 @@ jobs: if: ${{ !cancelled() }} runs-on: ubuntu-latest steps: - - name: Find the latest Code Coverage comment + - name: Find the latest Code Coverage Report Comment uses: actions/github-script@v6 - id: find_latest_code_coverage_comment with: script: | - const fs = require('fs'); const comments = await github.paginate(github.rest.issues.listComments, { owner: context.repo.owner, repo: context.repo.repo, @@ -53,24 +51,11 @@ jobs: for (let i = comments.length - 1; i >= 0; i--) { if (comments[i].body.includes("Coverage Report")) { - const latestCodeCoverageComment = comments[i]; - const commentBody = latestCodeCoverageComment.body; - console.log(`Latest Code Coverage Comment Body: ${commentBody}`); - fs.writeFileSync('latest_code_coverage_comment_body.md', commentBody, 'utf8'); - + const latestCodeCoverageComment = comments[i].body; + require('fs').writeFileSync('latest_code_coverage_comment.md', latestCodeCoverageComment, 'utf8'); return } } - - - name: Find the last Coverage Report - uses: peter-evans/find-comment@v3 - id: last-coverage-report - with: - issue-number: ${{ github.event.pull_request.number }} - body-includes: Coverage Report - direction: last - - run: | - echo "${{ steps.last-coverage-report.outputs.comment-body }}" >> comment.md - name: Find CI workflow run for PR id: find-workflow-run @@ -107,17 +92,17 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ steps.find-workflow-run.outputs.run-id }} - - name: Compare coverage report with the comment body (workkkkk!!) + - name: Compare Current Coverage Report with the Latest Coverage Report run: | sed -i -e '$a\' CoverageReport.md - sed -i -e '$a\' latest_code_coverage_comment_body.md + sed -i -e '$a\' latest_code_coverage_comment.md - if diff -B CoverageReport.md latest_code_coverage_comment_body.md > /dev/null; then + if diff -B CoverageReport.md latest_code_coverage_comment.md > /dev/null; then echo "No significant changes detected; skipping coverage comment." echo "skip_coverage_comment=true" >> $GITHUB_ENV else echo "Changes detected; proceeding with the coverage comment." - diff CoverageReport.md comment.md || true + diff CoverageReport.md latest_code_coverage_comment.md || true echo "skip_coverage_comment=false" >> $GITHUB_ENV fi From 1287751dc177d2c0c26b309a6d27a0c31baab45f Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:30:26 +0530 Subject: [PATCH 09/10] Update comment_coverage_report.yml --- .github/workflows/comment_coverage_report.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/comment_coverage_report.yml b/.github/workflows/comment_coverage_report.yml index 8dfa3ebe9..ac2beb5e2 100644 --- a/.github/workflows/comment_coverage_report.yml +++ b/.github/workflows/comment_coverage_report.yml @@ -94,15 +94,20 @@ jobs: - name: Compare Current Coverage Report with the Latest Coverage Report run: | - sed -i -e '$a\' CoverageReport.md - sed -i -e '$a\' latest_code_coverage_comment.md + if [ -f latest_code_coverage_comment.md ]; then + sed -i -e '$a\' CoverageReport.md + sed -i -e '$a\' latest_code_coverage_comment.md - if diff -B CoverageReport.md latest_code_coverage_comment.md > /dev/null; then - echo "No significant changes detected; skipping coverage comment." - echo "skip_coverage_comment=true" >> $GITHUB_ENV + if diff -B CoverageReport.md latest_code_coverage_comment.md > /dev/null; then + echo "No significant changes detected; skipping coverage comment." + echo "skip_coverage_comment=true" >> $GITHUB_ENV + else + echo "Changes detected; proceeding with the coverage comment." + diff CoverageReport.md latest_code_coverage_comment.md || true + echo "skip_coverage_comment=false" >> $GITHUB_ENV + fi else - echo "Changes detected; proceeding with the coverage comment." - diff CoverageReport.md latest_code_coverage_comment.md || true + echo "No previous coverage comment found; posting coverage comment." echo "skip_coverage_comment=false" >> $GITHUB_ENV fi From 04e5c9c5d7cf33e1c83aa8fd8d296a0335500b09 Mon Sep 17 00:00:00 2001 From: RD Rama Devi <122200035+Rd4dev@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:33:21 +0530 Subject: [PATCH 10/10] Update Bazel-Setup-Instructions-for-Linux.md --- wiki/Bazel-Setup-Instructions-for-Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki/Bazel-Setup-Instructions-for-Linux.md b/wiki/Bazel-Setup-Instructions-for-Linux.md index 620835890..c6b781e3a 100644 --- a/wiki/Bazel-Setup-Instructions-for-Linux.md +++ b/wiki/Bazel-Setup-Instructions-for-Linux.md @@ -7,7 +7,7 @@ ### 1. Install Bazel -Install Bazel from [here](https://docs.bazel.build/versions/master/install.html). Make sure that you follow the instructions for installing a specific version (Oppia Android requires 6.5.0 and won't build on other versions). +Install Bazel from [here](https://docs.bazel.build/versions/master/install.html). Make sure that you follow the instructions for installing a specific version (Oppia Android requires - 6.5.0 and won't build on other versions). - Note: if you find any errors related to `cURL`, please set up cURL on your machine. For Linux, you can use `sudo apt install curl`. ### 2. Set up the ANDROID_HOME environment variable