Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ runs:
fi
shell: bash

# Extract the versions from build_vars.bzl, removing spaces and quotes.
- name: Parse build variables
run: |
SDK_VERSION=$(grep 'BUILD_SDK_VERSION' ${{ github.action_path }}/../../../build_vars.bzl | cut -d '=' -f 2 | tr -d ' "')
BUILD_TOOLS_VERSION=$(grep 'BUILD_TOOLS_VERSION' ${{ github.action_path }}/../../../build_vars.bzl | cut -d '=' -f 2 | tr -d ' "')
echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV
echo "BUILD_TOOLS_VERSION=$BUILD_TOOLS_VERSION" >> $GITHUB_ENV
shell: bash

- name: Set up new Android SDK directory
run: |
mkdir -p $HOME/android-sdk
Expand Down Expand Up @@ -55,14 +64,14 @@ runs:
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platform-tools"
shell: bash

- name: Install SDK 35
- name: Install SDK
run: |
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-35"
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "platforms;android-${{ env.SDK_VERSION }}"
shell: bash

- name: Install build tools 34.0.0
- name: Install build tools
run: |
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "build-tools;34.0.0"
$ANDROID_HOME/cmdline-tools/tools/bin/sdkmanager --install "build-tools;${{ env.BUILD_TOOLS_VERSION }}"
shell: bash

- name: Configure Bazel to use specific sandbox tmpfs
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ on:
branches:
# Push events on develop branch
- develop
merge_group:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand All @@ -24,7 +27,7 @@ jobs:
env:
CACHE_DIRECTORY: ~/.bazel_cache
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -42,7 +45,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v4
- uses: actions/cache@v5
id: cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/check_for_fixed_issues_in_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
steps:
- name: Scan PR for issues being addressed
id: step-1
uses: actions/github-script@v7
if: ${{ github.event.pull_request.head.ref != 'translatewiki-prs' }}
uses: actions/github-script@v8
with:
script: |
const incorrectFormatRegex = /^Fix(?: part of)? #(\d+)$/gm;
Expand All @@ -36,8 +37,8 @@ jobs:

- name: Find issue assignment(s)
id: step-2
if: ${{ steps.step-1.outputs.failure_message == '' }}
uses: actions/github-script@v7
if: ${{ github.event.pull_request.head.ref != 'translatewiki-prs' && steps.step-1.outputs.failure_message == '' }}
uses: actions/github-script@v8
env:
ISSUE_NUMBERS_LIST_JSON: ${{ steps.step-1.outputs.issue_numbers_list_json }}
with:
Expand All @@ -62,7 +63,7 @@ jobs:
- name: Move PR to draft and add comment
id: step-3
if: ${{ steps.step-1.outputs.failure_message != '' || steps.step-2.outputs.failure_message != '' }}
uses: actions/github-script@v7
uses: actions/github-script@v8
env:
FAILURE_MESSAGE_1: ${{ steps.step-1.outputs.failure_message }}
FAILURE_MESSAGE_2: ${{ steps.step-2.outputs.failure_message }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/check_for_forced_push_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Detect and close (on change)
if: ${{ github.event.action == 'synchronize' }}
uses: actions/github-script@v7
if: ${{ github.event.pull_request.head.ref != 'translatewiki-prs' && github.event.action == 'synchronize' }}
uses: actions/github-script@v8
with:
script: |
const { before, after, pull_request: pr } = context.payload;
Expand All @@ -24,14 +24,14 @@ jobs:
const status = (await github.rest.repos.compareCommits({ owner, repo, base: before, head: after })).data.status;
if (status === 'diverged' || status === 'behind') {
core.setFailed(`Force push detected (history has been altered). Commit history status: ${status}.`);
const closeMessage = 'Closing PR: Force pushing is not allowed in this repository. This PR has been automatically closed. Please create a new PR with a clean commit history and manually copy over any unresolved reviewer comment threads from this PR.';
const closeMessage = 'Closing PR: Force pushing is not allowed in this repository. This PR has been automatically closed. Please create a new PR with a clean commit history and manually copy over any unresolved reviewer comment threads from this PR. For more information, please make sure to review this part of the wiki which provides guidance on merging PRs: https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#step-3-address-review-comments-until-all-reviewers-give-lgtm.';
await github.rest.issues.createComment({ owner, repo, issue_number: pr.number, body: closeMessage });
await github.rest.pulls.update({ owner, repo, pull_number: pr.number, state: 'closed' });
} else core.info(`Standard push detected. Commit history status: ${status}. No action taken.`);

- name: Detect and close reopened force-pushed PRs
if: ${{ github.event.action == 'reopened' }}
uses: actions/github-script@v7
if: ${{ github.event.pull_request.head.ref != 'translatewiki-prs' && github.event.action == 'reopened' }}
uses: actions/github-script@v8
with:
script: |
const pr = context.payload.pull_request;
Expand Down
53 changes: 37 additions & 16 deletions .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ on:
branches:
# Push events on develop branch
- develop
merge_group:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Expand All @@ -21,7 +24,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Wait for unit tests to checks
uses: ArcticLampyrid/action-wait-for-workflow@v1.2.0
uses: ArcticLampyrid/action-wait-for-workflow@v1.3.0
with:
workflow: unit_tests.yml
sha: auto
Expand All @@ -36,7 +39,7 @@ jobs:
env:
CACHE_DIRECTORY: ~/.bazel_cache
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -45,7 +48,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v4
- uses: actions/cache@v5
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -86,15 +89,33 @@ jobs:
echo "build --disk_cache=$EXPANDED_BAZEL_CACHE_PATH" >> $HOME/.bazelrc
shell: bash

- name: Check PR for [RunAllTests]
id: check_pr
if: ${{ github.event_name == 'pull_request' }}
run: |
if [[ "${{ github.event.pull_request.title }}" == *"[RunAllTests]"* ]]; then echo "run_all=true" >> $GITHUB_OUTPUT; fi

# Search all PR commit messages included in the merge group for any that require running all tests upon merging.
- name: Check merge group for [RunAllTests]
id: check_mg
if: ${{ github.event_name == 'merge_group' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
MESSAGES=$(gh api repos/${{ github.repository }}/compare/${{ github.event.merge_group.base_sha }}...${{ github.sha }} --jq '.commits[].commit.message')
if echo "$MESSAGES" | grep -Fq "[RunAllTests]"; then echo "run_all=true" >> $GITHUB_OUTPUT; fi
Comment thread
BenHenning marked this conversation as resolved.

- name: Compute file matrix
id: compute-file-matrix
env:
compute_all_files: ${{ contains(github.event.pull_request.title, '[RunAllTests]') }}
compute_all_files: ${{ steps.check_pr.outputs.run_all == 'true' || steps.check_mg.outputs.run_all == 'true' }}
# See: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request. Defer to origin/develop outside a PR (such as develop's main CI runs).
base_commit_hash: ${{ github.event.pull_request.base.sha || 'origin/develop' }}
base_commit_hash: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || 'origin/develop' }}
# https://unix.stackexchange.com/a/338124 for reference on creating a JSON-friendly
# comma-separated list of test targets for the matrix.
# comma-separated list of test targets for the matrix. Note that the extra fetch is to
# enusre that the base commit is fully fetched locally so that it can be diffed against.
run: |
git fetch origin $base_commit_hash --depth=1
bazel run //scripts:compute_changed_files -- $(pwd) $(pwd)/changed_files.log $base_commit_hash compute_all_files=$compute_all_files
FILE_BUCKET_LIST=$(cat ./changed_files.log | sed 's/^\|$/"/g' | paste -sd, -)
echo "Changed files (note that this might be all files if configured to run all or on the develop branch): $FILE_BUCKET_LIST"
Expand All @@ -118,14 +139,14 @@ jobs:
env:
CACHE_DIRECTORY: ~/.bazel_cache
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6

- name: Set up Bazel
uses: abhinavsingh/setup-bazel@v3
with:
version: 6.5.0

- uses: actions/cache@v4
- uses: actions/cache@v5
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -174,7 +195,7 @@ jobs:
# with Bazel since Bazel can share the most recent cache from an unrelated build and still
# benefit from incremental build performance (assuming that actions/cache aggressively removes
# older caches due to the 5GB cache limit size & Bazel's large cache size).
- uses: actions/cache@v4
- uses: actions/cache@v5
id: test_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand Down Expand Up @@ -244,14 +265,14 @@ jobs:
bazel run //scripts:run_coverage -- $(pwd) $CHANGED_FILES --format=PROTO --processTimeout=15

- name: Upload Coverage Report Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: coverage-report-${{ env.SHARD_NAME }} # Saving with unique names to avoid conflict
path: coverage_reports

- name: Upload bazel target file
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: code-coverage-bazel-targets-${{ env.SHARD_NAME }}
path: bazel_targets.txt
Expand All @@ -266,10 +287,10 @@ jobs:
env:
CACHE_DIRECTORY: ~/.bazel_cache
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6

- name: Download Coverage Report Artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
path: coverage-report-artifact
pattern: coverage-report-*
Expand All @@ -286,7 +307,7 @@ jobs:
with:
version: 6.5.0

- uses: actions/cache@v4
- uses: actions/cache@v5
id: scripts_cache
with:
path: ${{ env.CACHE_DIRECTORY }}
Expand All @@ -303,7 +324,7 @@ jobs:
bazel run //scripts:coverage_reporter -- $(pwd) pb_files.txt

- name: Upload Generated Markdown Report
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status
with:
name: final-coverage-report
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/comment_coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- name: Wait for code coverage to complete
id: wait-for-coverage
uses: ArcticLampyrid/action-wait-for-workflow@v1.2.0
uses: ArcticLampyrid/action-wait-for-workflow@v1.3.0
with:
workflow: code_coverage.yml
sha: auto
Expand All @@ -48,15 +48,15 @@ jobs:
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
steps:
- name: Find the latest Code Coverage Report Comment
uses: actions/github-script@v6
- name: Find the latest Code Coverage Report Comment
uses: actions/github-script@v8
with:
script: |
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
});
});

for (let i = comments.length - 1; i >= 0; i--) {
if (comments[i].body.includes("## Coverage Report")) {
Expand All @@ -65,10 +65,10 @@ jobs:
return
}
}

- name: Find CI workflow run for PR
id: find-workflow-run
uses: actions/github-script@v7
uses: actions/github-script@v8
continue-on-error: true
with:
script: |
Expand All @@ -94,19 +94,19 @@ jobs:
core.setOutput('run-id', run.id);

- name: Download Generated Markdown Report
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
if: ${{ !cancelled() }} # IMPORTANT: Upload reports regardless of success or failure status
with:
name: final-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ steps.find-workflow-run.outputs.run-id }}

- name: Compare Current Coverage Report with the Latest Coverage Report
run: |
run: |
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 changes detected; skipping coverage comment."
echo "skip_coverage_comment=true" >> $GITHUB_ENV
Expand All @@ -122,7 +122,7 @@ jobs:

- name: Upload Coverage Report as PR Comment
if: ${{ env.skip_coverage_comment == 'false' }}
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
body-path: 'CoverageReport.md'
10 changes: 5 additions & 5 deletions .github/workflows/developer_onboarding_notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set Environment Variables
env:
Expand All @@ -27,7 +27,7 @@ jobs:

- name: Count Merged Pull Requests
id: count_merged_pull_requests
uses: actions/github-script@v6
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -41,13 +41,13 @@ jobs:
core.exportVariable('PR_COUNT', prCount);

- name: Comment on the Merged Pull Request
uses: actions/github-script@v6
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prCount = parseInt(process.env.PR_COUNT);
const author = process.env.AUTHOR;
const mention = 'adhiamboperes';
const mention = 'adhiamboperes';
const prNumber = context.payload.pull_request.number;

let message;
Expand All @@ -62,7 +62,7 @@ jobs:
`This means you may be eligible to join the Oppia dev team as a collaborator! 🎉 If you're interested, please fill out [this form](https://forms.gle/NxPjimCMqsSTNUgu5) and become an even more integral part of the community. 🌱\n\n` +
`Looking forward to seeing even more contributions from you. The developer onboarding lead: @${mention} is here if you need any help! Keep up the great work! 🚀`;
}

if (prCount === 1 || prCount === 2) {
await github.rest.issues.createComment({
owner: process.env.OWNER,
Expand Down
Loading
Loading