Contribution tracker is a Drupal application built in Drupal 8 for managing community contributions done by the team members. It allows to log various contributions mentioned below.
- Code contributions
- Event contributions
- Non-code contributions
- Imports Drupal.org contributions via API
- Supports social login and authentication via google account.
The following tools are required for setting up the site. Ensure you are using the latest version or at least the minimum version if mentioned below. Also, ensure that you have added your SSH key to your GitHub account settings.
Note: Ensure you have sufficient RAM (ideally 16 GB, minimum 8 GB)
Once you have all the tools installed, proceed to run the following to clone the repository.
git clone [email protected]:contrib-tracker/backend.git
Change to the directory of repository and run DDEV to start.
cd backend
ddev start
Once DDEV has been setup successfully, it will display the links in the terminal. Next run the following to fetch all dependencies.
ddev composer install
You can pull the database from platform.sh directly. Make sure that the PLATFORMSH_CLI_TOKEN is set.
ddev pull platform
Make sure code changes are updated.
ddev drush deploy -y
Generate a one time login link and reset the password through it.
ddev drush uli
Clear the cache using drush
ddev drush cr
cd web/themes/custom/contribtracker && ddev npm install && ddev npm run build && ddev drush cr
You can access the site at: https://contribtracker.ddev.site/.
Before committing your changes, make sure you are working on the latest codebase by fetching or pulling to make sure you have all the work.
git checkout main
git pull origin main
To initiate a build:
-
Create a branch specific to the feature.
git checkout -b <branch-name>
-
Make the required changes and commit
git commit -m "commit-message"
-
Push the changes
git push origin <branch-name>
For a better understanding of the entire process and standards, please refer to Axelerant's Git workflow.
N.B. If provided with user account, you can use the management console of platform.sh to handle your branch-merge requests. Please refer to the official documentation for further information.
See our testing docs for more details.
# Unit tests
$ ddev phpunit --testsuite unit
# ExistingSite tests need more flags
$ ddev phpunit --bootstrap=./vendor/weitzman/drupal-test-traits/src/bootstrap-fast.php --configuration ./phpunit.xml --testsuite existing-site
This needs additional setup. See our testing docs for more details.
# Run tests
$ ddev cypress-run
# Interactive mode
$ ddev cypress-open
Contrib Tracker supports automatically retrieving and saving contributions from drupal.org and Github. This is a broad outline of the logic involved in the overall retrieval of contributions from drupal.org.
Each user on contrib tracker may set their Drupal.org username in a field in their user profile. A cron job reads all such active users and queues them every 20 mins. This means that comments from drupal.org are retrieved for all users every 20 mins.
This is the flow of a queued process for each user. [Outdated]
- Try to read more information about the user from drupal.org (especially the user ID). If it fails, throw an exception and leave. See ProcessUser::processItem.
- Retrieve all the comments by the user (ContributionManager::storeCommentsByDrupalOrgUser). If the comments span multiple pages, they are read only if required (ContributionRetriever::getDrupalOrgCommentsByAuthor).
- For each comment (ContributionManager::storeCommentsByDrupalOrgUser),
- If the comment is already present in the system, leave.
- Get the comment's parent issue. Store the issue if it's not already present.
- Determine the information about the comment such as the project and number of patches and files, if any.
- Store all this information as a "Code contribution" content type.