Skip to content

contrib-tracker/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitpod ready-to-code

Contribution Tracker

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

Features

  • Imports Drupal.org contributions via API
  • Supports social login and authentication via google account.

Development

Tools & Prerequisites

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)

Local environment setup

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

Post Installation

Generate a one time login link and reset the password through it.

ddev drush uli

Clear the cache using drush

ddev drush cr

Theme Build

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/.

Build and Deployment

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:

  1. Create a branch specific to the feature.

    git checkout -b <branch-name>
  2. Make the required changes and commit

    git commit -m "commit-message"
  3. 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.

Testing

See our testing docs for more details.

PHPUnit tests

# 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

Cypress tests

This needs additional setup. See our testing docs for more details.

# Run tests
$ ddev cypress-run

# Interactive mode
$ ddev cypress-open

About Contribution Retriever

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]

  1. 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.
  2. Retrieve all the comments by the user (ContributionManager::storeCommentsByDrupalOrgUser). If the comments span multiple pages, they are read only if required (ContributionRetriever::getDrupalOrgCommentsByAuthor).
  3. For each comment (ContributionManager::storeCommentsByDrupalOrgUser),
    1. If the comment is already present in the system, leave.
    2. Get the comment's parent issue. Store the issue if it's not already present.
    3. Determine the information about the comment such as the project and number of patches and files, if any.
    4. Store all this information as a "Code contribution" content type.