diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 62ead3c..970f108 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -74,7 +74,6 @@ jobs: - name: Generate GitStats Report run: | gnuplot --version - python3 -m venv venv source venv/bin/activate # for testing @@ -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' }} diff --git a/README.md b/README.md index 097b7a1..5354785 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -62,9 +63,41 @@ You can also get gitstats docker image. docker run ghcr.io/shenxianpeng/gitstats:latest --help ``` +## Usage + +```bash +Usage: gitstats [options] + +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. +
+Example GitHub Actions + +Use gitstats in GitHub Actions to generate reports and deploy them to GitHub Pages. ```yaml name: GitStats Preview @@ -100,29 +133,47 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: gitstats-report ``` - -## Usage - -```bash -Usage: gitstats [options] - -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 +
+ +### Use gitstats in Jenkins + +
+Example Jenkinsfile + +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. +
## FAQ diff --git a/pyproject.toml b/pyproject.toml index 4975ec9..4c48636 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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]