oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
311 stars 514 forks source link

Fix #5407: Fix Bazel CI runs on develop #5408

Closed BenHenning closed 4 months ago

BenHenning commented 4 months ago

Explanation

Fixes #5407

This introduces a proper fallback for the base branch used for computing affected tests when off-develop: origin/develop (which was the same base used prior to #4929 being merged).

This can't easily be verified without being merged, but I have high confidence it'll work since we've used the JavaScript || fallback syntax in GitHub workflow if conditionals in the past (and the environment should be the same for env variables).

Note that this is being fixed forward rather than reverted because the only verification is merging the PR, so it's actually faster and simpler to fix forward than to revert the original PR and re-submit a fix (which has the same likelihood of fixing CI as this fix forward).

Essential Checklist

For UI-specific PRs only

N/A -- This only affects CI infrastructure.

BenHenning commented 4 months ago

@adhiamboperes PTAL with priority as this will block all merged PRs from passing (it doesn't block PR merging or PR CI workflows since that part is still configured correctly).

BenHenning commented 4 months ago

Enabling auto-merge since this seems like a straightforward fix and it'd be good to get this merged ASAP.

adhiamboperes commented 4 months ago

Rerunning bazel tests since CI is stuck.

oppiabot[bot] commented 4 months ago

Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks!

BenHenning commented 4 months ago

Looks like the CI workflow change actually isn't valid:

[Invalid workflow file: .github/workflows/unit_tests.yml#L80](https://github.com/oppia/oppia-android/actions/runs/9199774806/workflow)
The workflow is not valid. .github/workflows/unit_tests.yml (Line: 80, Col: 29): Unexpected symbol: '"origin/develop"'. Located at position 39 within expression: github.event.pull_request.base.sha || "origin/develop"
BenHenning commented 4 months ago

Looks like it's passing now, and I've verified that the env looks correct:

  env:
    CACHE_DIRECTORY: ~/.bazel_cache
    compute_all_targets: false
    base_commit_hash: 24b17211a9d66447a3c9a6350aee5331eef1c1a3

Will verify again for develop once this is merged & will update the issue.