Skip to content

Commit 5e6cacd

Browse files
committed
ci: add GitHub Actions workflow for tests
- Run tests on Python 3.9, 3.10, 3.11, 3.12 - Run ruff linter - Run coverage report - Test stdlib-only mode (without requests) - Add badges to README
1 parent 37e4f9c commit 5e6cacd

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/tests.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main, 001-modular-refactor]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.9', '3.10', '3.11', '3.12']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements-dev.txt
28+
pip install -r requirements.txt
29+
30+
- name: Run linter
31+
run: |
32+
ruff check src/github_analyzer/
33+
34+
- name: Run tests
35+
run: |
36+
pytest tests/ -v --tb=short
37+
38+
- name: Run tests with coverage
39+
run: |
40+
pytest tests/ --cov=src/github_analyzer --cov-report=xml --cov-report=term-missing
41+
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v4
44+
if: matrix.python-version == '3.11'
45+
with:
46+
files: ./coverage.xml
47+
fail_ci_if_error: false
48+
49+
test-stdlib-only:
50+
name: Test without requests (stdlib only)
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Python 3.11
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: '3.11'
60+
61+
- name: Install test dependencies only
62+
run: |
63+
python -m pip install --upgrade pip
64+
pip install pytest pytest-cov
65+
66+
- name: Run tests without requests
67+
run: |
68+
pytest tests/ -v --tb=short

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# GitHub Analyzer
22

3+
[![Tests](https://github.com/Oltrematica/github_analyzer/actions/workflows/tests.yml/badge.svg)](https://github.com/Oltrematica/github_analyzer/actions/workflows/tests.yml)
4+
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
37
A powerful Python command-line tool for analyzing GitHub repositories and extracting comprehensive metrics about commits, pull requests, issues, and contributor activity. Generate detailed CSV reports for productivity analysis and code quality assessment.
48

59
![GitHub Analyzer Banner](screens/screen1.png)

0 commit comments

Comments
 (0)