Skip to content

Commit

Permalink
docs: update support platforms and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Jan 4, 2025
1 parent c8ee8b3 commit ece242f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ jobs:
- name: Generate GitStats Report
run: |
gnuplot --version
python3 -m venv venv
source venv/bin/activate
# for testing
Expand Down Expand Up @@ -140,7 +139,6 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: gitstats-report
destination_dir: main

- name: Add PR Comment with Preview Link
if: ${{ github.event_name == 'pull_request' && matrix.python-version == '3.9' }}
Expand Down
99 changes: 75 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![PyPI - Version](https://img.shields.io/pypi/v/gitstats?color=blue)](https://pypi.org/project/gitstats/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/gitstats)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/gitstats?color=blue)](https://pypistats.org/packages/gitstats)
[![GitStats Report](https://img.shields.io/badge/GitStats_Report-Available-green?style=flat)](https://shenxianpeng.github.io/gitstats/previews/main/index.html)
[![GitStats Report](https://img.shields.io/badge/GitStats_Report-Available-green?style=flat)](https://shenxianpeng.github.io/gitstats/index.html)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=shenxianpeng_gitstats&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=shenxianpeng_gitstats)

**gitstats** is a tool that generates statistics for git repositories, providing HTML output with tables and graphs to help developers view project development history.
Expand Down Expand Up @@ -33,6 +33,7 @@ Here is a list of some features of _gitstats_:
* **Lines**: line of code by date.
* **Tags**: tags by date and author.
* Customizable: config values through `gitstats.conf`.
* Cross-platform: works on Linux, Windows, and macOS.

## Requirements

Expand Down Expand Up @@ -62,9 +63,41 @@ You can also get gitstats docker image.
docker run ghcr.io/shenxianpeng/gitstats:latest --help
```

## Usage

```bash
Usage: gitstats [options] <gitpath..> <outputpath>

Options:
-c key=value Override configuration value

Default config values:
{'max_domains': 10, 'max_ext_length': 10, 'style': 'gitstats.css', 'max_authors': 20, 'authors_top': 5, 'commit_begin': '', 'commit_end': 'HEAD', 'linear_linestats': 1, 'project_name': '', 'processes': 8, 'start_date': ''}

Please see the manual page for more details.

```

## Examples

```bash
gitstats your-awesome-project ~/public_html
```

The output will be generated in the given directory.

If you want to use gitstats with CI to generate reports and deploy them, please see

* [Use gitstats in GitHub Actions](#use-gitstats-in-github-actions)
* [Use gitstats in Jenkins](#use-gitstats-in-jenkins)


### Use gitstats in GitHub Actions

You can use gitstats in GitHub Actions to generate reports and deploy them to GitHub Pages.
<details>
<summary>Example GitHub Actions</summary>

Use gitstats in GitHub Actions to generate reports and deploy them to GitHub Pages.

```yaml
name: GitStats Preview
Expand Down Expand Up @@ -100,29 +133,47 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: gitstats-report
```
## Usage
```bash
Usage: gitstats [options] <gitpath..> <outputpath>

Options:
-c key=value Override configuration value

Default config values:
{'max_domains': 10, 'max_ext_length': 10, 'style': 'gitstats.css', 'max_authors': 20, 'authors_top': 5, 'commit_begin': '', 'commit_end': 'HEAD', 'linear_linestats': 1, 'project_name': '', 'processes': 8, 'start_date': ''}

Please see the manual page for more details.

```

## Examples

```bash
gitstats your-awesome-project ~/public_html
</details>
### Use gitstats in Jenkins
<details>
<summary>Example Jenkinsfile</summary>
Use gitstats in Jenkins to generate reports and publish them to Jenkins server.
```groovy
pipeline {
agent any
options {
cron('0 0 * * 0') // Run at every sunday at 00:00
}
stages {
stage('Generate GitStats Report') {
steps {
checkout scm
sh '''
python3 -m venv venv
source venv/bin/activate
pip install gitstats
gitstats . gitstats-report
'''
}
}
stage('Publish GitStats Report') {
steps {
publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: true, reportDir: 'gitstats-report', reportFiles: 'index.html', reportName: 'GitStats Report'])
}
}
}
post {
always {
cleanWs()
}
}
}
```

The output will be generated in the given directory.
</details>

## FAQ

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Build Tools",
Operating System :: Microsoft :: Windows,
Operating System :: POSIX :: Linux
Operating System :: MacOS,
]

[project.scripts]
Expand Down

0 comments on commit ece242f

Please sign in to comment.