Google Summer of Code 2018 with Oppia
Introduction
Google Summer of Code is global program to promote open-source development. It is being organized by Google every summer since more than a decade. It runs for 12 weeks from mid May to mid August. Students work with an open source organization on a programming project. It’s a great way to spend the summer break!
I was fortunate enough to be a part of GSoC 2018 under the Oppia Foundation.
Oppia is an online learning tool that enables anyone to easily create and share interactive activities (called ‘explorations’). These activities simulate a one-on-one conversation with a tutor, making it possible for students to learn by doing and get feedback.
Before we move ahead, let me briefly introduce myself. I am Apurv Bajaj, an undergraduate engineering student, pursuing a degree in Computer Science and Economics at BITS Pilani, India. I love to learn and play around with new stuff and believe in “Code for a better world”.
Oppia tends to create a huge difference in the field of education by making it accessible to all and therefore, it completely aligns with my passion!
Project
My project at the Oppia Foundation was “Improving the development workflow”, under the category of infrastructure projects. It was mentored by Kevin Lee and the GSoC organization admins during this period were Anmol Shukla and Sean Lip.
The project was sub-divided into three parts, which later formed the three milestones of the project. They were:
- Implement automatic lint checks that catch all common errors before a PR is pushed to GitHub. These checks should run automatically for all contributors before submit (and if this isn’t the case, this should be fixed, or a GitHub linter bot created so that reviewers can assume that PRs are linted prior to review).
- Create GitHub bots to automate common tasks, and provide documentation on how to write new GitHub bots for other automatable tasks that arise, going forward. Such tasks may include:
a. checking CLAs (currently maintained in a Google Form) and directing new contributors to the “Getting Started” instructions if the CLA is not signed.
b. emailing PR authors when their PR has a merge conflict (e.g. when the develop branch is updated) and providing guidance on how to address it.
c. warning PR authors if PRs look abandoned, and then auto-closing those PRs after a few more days. - Organize and tidy up the e2e tests, and define policies for what to test. Extend the existing e2e framework to support mobile viewports. Provide further documentation on the extension and restructring of the tests for reference.
The Milestones
Milestone 1
In this milestone, a large number of checks were automated. These checks would automatically run before a developer pushes its changes to the pull request branch, that is, all the checks were a part of the pre-submit checks.
Relevant pull requests:
- Setup checks for CSS: https://github.com/oppia/oppia/pull/4643
- Add checks for directive scope: https://github.com/oppia/oppia/pull/4848
- Enable Pycodestyle rules: https://github.com/oppia/oppia/pull/4937
- Add email to the list of Travis recipients: https://github.com/oppia/oppia/pull/4938
- Update Pylint: https://github.com/oppia/oppia/pull/4939
- Enable in-built angular rules: https://github.com/oppia/oppia/pull/4945
- Enable in-built js rules: https://github.com/oppia/oppia/pull/4948
- Change Pylint version: https://github.com/oppia/oppia/pull/4957
- Develop custom Pylint checks: https://github.com/oppia/oppia/pull/4967
- Enable checks for directive scope: https://github.com/oppia/oppia/pull/4980
- Setup custom HTML indent function: https://github.com/oppia/oppia/pull/4987
- Fix Travis build: https://github.com/oppia/oppia/pull/5003
- Separate About selectors from oppia.css: https://github.com/oppia/oppia/pull/5011
- Separate CSS selectors from oppia.css: https://github.com/oppia/oppia/pull/5012
- Separate CSS selectors from oppia.css: https://github.com/oppia/oppia/pull/5018
- Separate CSS selectors from oppia.css: https://github.com/oppia/oppia/pull/5022
- Add check for print statement: https://github.com/oppia/oppia/pull/5042
- Update Chromedriver from 2.39 to 2.40: https://github.com/oppia/oppia/pull/5059
- Add restrict check for directives: https://github.com/oppia/oppia/pull/5068
- Custom import check for modules: https://github.com/oppia/oppia/pull/5078
- Add node path: https://github.com/oppia/oppia/pull/5117
Additional pull requests:
- Fix package installation on Travis: https://github.com/oppia/oppia/pull/5146
- Modify html indent function: https://github.com/oppia/oppia/pull/5171
- Add tests for activity domain: https://github.com/oppia/oppia/pull/5194
- Remove app.js from excluded files: https://github.com/oppia/oppia/pull/5248
- Add check for browser.waitForAngular calls: https://github.com/oppia/oppia/pull/5249
- Ternary operator scope creation: https://github.com/oppia/oppia/pull/5262
- Fix docstrings for acl_decorators: https://github.com/oppia/oppia/pull/5311
Milestone 2
The Oppiabot, a GitHub app based on the Probot framework was created as a part of this milestone.
It acts as a helper for the Oppia code repository to maintain the development workflow. It is hosted on Heroku.
The bot currently performs the following functions:
- Checks whether a contributor creating a pull request has signed the CLA. It adds a label Needs CLA accordingly.
- Checks merge conflict in a pull request and notifies the author of the pull request if there is a merge conflict. It also adds a relevant label to the pull request.
- Checks whether any pull request has gone stale, adds a relevant label and then automatically closes stale pull requests.
The source code for the Oppiabot can be found at https://github.com/oppia/oppiabot. This repository has a detailed README file and a wiki which houses all relevant information from development and deployment to testing.
The Oppiabot uses a customized NPM package for the stale check, which was designed as a part of this milestone. The source code for this can be found at https://github.com/oppia/oppiabot-stale.
Relevant pull requests:
- Initial setup: https://github.com/oppia/oppiabot/pull/1
- Change order of authorize function call and minor fix: https://github.com/oppia/oppiabot/pull/2
- Modify CLA check: https://github.com/oppia/oppiabot/pull/3
- Setup check for merge conflicts: https://github.com/oppia/oppiabot/pull/4
- Change default value of per_page option: https://github.com/oppia/oppiabot/pull/5
- Refactor index file into different modules: https://github.com/oppia/oppiabot/pull/6
- Add tests for bot: https://github.com/oppia/oppiabot/pull/8
- Revert conditionals: https://github.com/oppia/oppiabot/pull/9
- Add functionality to white-list accounts: https://github.com/oppia/oppiabot/pull/10
- Modify README: https://github.com/oppia/oppiabot/pull/11
- Add custom stale package: https://github.com/oppia/oppiabot/pull/12
- Modify merge conflict message: https://github.com/oppia/oppiabot/pull/13
- Schedule merge conflict check to run once an hour: https://github.com/oppia/oppiabot/pull/14
- Add stale config for oppiabot: https://github.com/oppia/oppia/pull/4940
- Reduce daysUntilStale to 7 in stale config: https://github.com/oppia/oppia/pull/5187
- Modify stale config: https://github.com/oppia/oppia/pull/5214
Milestone 3
As a part of this milestone, the end-to-end tests were extended for mobile devices. Since the test suite was earlier structered for desktop only, it had to be completely re-structered in order to be compatible with both the desktop and the mobile. The mobile tests run on Browserstack which has been integrated with Oppia’s Travis CI.
The existing documentation on the end-to-end tests was also re-organized so that the structure of the tests is clear to any developer at first glance. The documentation also lays stress on the methodology to be adopted for further extension and integration of the tests. It can be found on the End-to-end tests wiki page of the oppia repository.
Also, additional link checks were added as part of this milestone. These were included in the pre-submit checks as well.
Relevant pull requests:
- Lint checks:
- Modify keywords arguments checker: https://github.com/oppia/oppia/pull/5305
- Add check to match line breaks between stringfied dependencies and controller function parameters: https://github.com/oppia/oppia/pull/5225
- Add check for html validation: https://github.com/oppia/oppia/pull/5246
- Enable indent rule for CSS: https://github.com/oppia/oppia/pull/5242
- Add check for copyright notice: https://github.com/oppia/oppia/pull/5197
- End-to-end tests:
- Setup browserstack, add necessary configuration files and tests for mobile: https://github.com/oppia/oppia/pull/5340
- Add forceLocal argument to browserstack local instance: https://github.com/oppia/oppia/pull/5435
Additional pull requests:
- Attempt to fix Chrome on Travis: https://github.com/oppia/oppia/pull/5382
- Add comment to .travis.yml: https://github.com/oppia/oppia/pull/5383
Conclusion
Google Summer of Code 2018 has been a great learning experience for me. In a span of 3 months, I picked up a number of new technologies and got familiar with the fascinating world of open source.
I would like to thank my organization, the Oppia Foundation for such a wonderful GSoC time. I would also like to thank my mentor, Kevin who was always very responsive and ready to help me out whenever I was stuck; the GSoC organization admins, Anmol and Sean for being always there to un-stuck any of the GSoC students; all other mentors and fellow GSoC students and developers for their co-operation and help.
Finally, I would like to thank Google for creating such a wonderful opportunity for the students and the open-source community alike.
That said, this project is quite important from the perspective of the developers, the maintainers and the reviewers at Oppia and brings a lot of ease in their duties.
As an inspiration from this GSoC project, another wonderful project has also been created for Oppia, the “Developer experience” project at https://github.com/oppia/oppia/projects/23. I will be leading this project in the course of time!