Skip to content

SE-UP/auto-test-artifact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-test-artifact

This command line tool uses PyGithub and GitHub API to check the presence of pre-commit hooks and continuous integration tool. Furthermore, it analyzes detected pre-commit and CI configuration files (.yml and .yaml) to check for standard testing libraries in Python, R and C++. To the repositories provided as input in csv file.

While its functionality could in principle be applied to separate Git repositories datasets, it currently relies on the output of the joss-repo-miner

  • Project structure
auto-test-artifact/
├── data/
│   └── joss_published_ci.csv
├── src/
│   ├── check_ci_auto_test.py
│   └── check_pre_commit_auto_test.py
├── tests/
│   └── unit/
│       └── domain_test.py
├── .gitignore
├── LICENSE
├── poetry.lock
├── pyproject.toml
├── README.md
└── requirements.txt

To run the scripts

  • [Step:1] Creating a virtual environment.

1.1: Create a .venv using following command.

python3 -m venv venv

1.2: Activate it (macOS/Linux).

source venv/bin/activate 

[At the end] Deactivate it when done.

deactivate
  • [Step:2] Installing dependencies

2.1: We used pipreqs to create requirements.txt file given this repository contains only the code You can install requirements.txt using the below

pip install -r requirements.txt

Note: (Additionally we used poetry to generate explicitly pinned dependencies for reproducibility)

[Optional] To install dependencies using poetry use following command

poetry install

(As poetry.lock pins dependencies for explicit versions which is good for reproducibility but having loose variant of version is better to make the tool reusable with minimum efforts)

  • [Step:3] Create .env file and aquire a github token.

3.1: Create a new token (classic). GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) → Generate new token (classic)
(No scopes needed for public data; optionally add public_repo.)

3.2: Save to .env (no quotes, no spaces)

GITHUB_TOKEN=YOUR_TOKEN_HERE
GITHUB_USERNAME=YourGitHubUser

3.3: Load and verify in your shell.

set -a
source .env
set +a

# sanity-check it loaded
echo ${#GITHUB_TOKEN}               # should be > 0
echo "${GITHUB_TOKEN:0:6}******"

# test both header styles
curl -sH "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/rate_limit | head
curl -sH "Authorization: token $GITHUB_TOKEN"  https://api.github.com/rate_limit | head
  • [Step:4] Running scripts.

To run the scripts use following commands:

'check_ci_auto_test.py' will collect presence of continious integration tool and check if standard test library is present in .yml or .yaml.

python3 src/check_ci_auto_test.py --input data/joss_one.csv -output output.csv data/joss_two.csv`

'check_pre_commit_auto_test.py' will check presence of pre-commit hook and then check if standard (python, R, C++) test library is present in .yml file.

python3 src/check_pre_commit_auto_test.py --input data/joss_three.csv --output data/joss_published_ci.csv

About

A CLI tool to detect, scrape, and analyze pre-commit hooks and CI configurations and check testing framework.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages