GithubHelp home page GithubHelp logo

testing-on-github's Introduction

Python application

Testing on GitHub

MongoDB

Saving data exactly as obtained from GitHub for later use. We can use MongoDB to just immediately save the JSON document from the query as-is. Start server:

mongod --noauth --dbpath $PWD/mongo/data/db

GUI to view database: mongodb-compass

Connecting to database

Run the following in your terminal before starting a jupyter notebook

export CONNECTION_STRING="<connectionString>"

Running the Query

Main script is in ./ghtesting/ghtesting.py. All the data requested from github is hardcoded in a graphql query file: ghtesting/queries/github/repos.graphql The repos obtained are determined by the search parameters that are provided to this query in the form of graphql variables.

Building GraphQL queries for GitHub

Using the explorer to build and test queries is helpful: https://docs.github.com/en/graphql/overview/explorer

Getting data from the local database

The GHRepo class defines some functions to extract features from the json but not all features are coded right now. The script ./ghtesting/dumpdb.py is an example of iterating through all the repos in the database.

Determining CI services used by project

It would take too long to interact and authenticate with all the different CI services, so instead we just look at the badges on the README. Most services allow you to copy the badge markdown/html to paste into your README, so we think most people who take the time to setup CI will probably take this small step to add the badge.

The ./ghtesting/scrape_ci_badges.py uses the Python requests and BeautifulSoup packages to scrape the README section of the GitHub page for each project. It specifically grabs all the img tags, regardless of whether or not the element is actually one of the badges. After obtaining all the images, the URLs were incrementally analyzed to filter out the badges and the regexes for the URLs were added to GHRepo.

Notebooks

Using Jupyter Notebook to analyze the data.

pip install jupyter
pip install matplotlib
pip install pandas
pip install matplotlib-venn #for one plot

`

Testing

Set environment variable with Github API tokens (generated in your profile) and then run pytest.

# Only need 1 token
export GITHUB_TOKENS="token1 token2"
pytest

testing-on-github's People

Contributors

haroon96 avatar brkhrdt avatar

Watchers

 avatar

Forkers

shaoormunir

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.