Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

jdrouet/git-metrics

Repository files navigation

Git Metrics

FOSSA Status

Right now, if you want to track the evolution of some metrics for your project over time, you need an external tool to store those metrics. But these metrics could be stored withing the git repository. Git provides a mechanism of notes that git-metrics simplifies.

How to install

From sources

cargo install --git https://github.com/jdrouet/git-metrics

How to use it

Locally

# fetch the remote metrics
$ git metrics pull
# add a new metric
$ git metrics add binary-size \
 --tag "platform.os: linux" \
 --tag "platform.arch: amd64" \
 1024.0
# push the metrics to remote
$ git metrics push
# log all the metrics for the past commits
$ git metrics log --filter-empty
# display the metrics on current commit
$ git metrics show
binary-size{platform.os="linux", platform.arch="amd64"} 1024.0
# display the metrics difference between commits
$ git metrics diff HEAD~2..HEAD
- binary-size{platform.os="linux", platform.arch="amd64"} 512.0
+ binary-size{platform.os="linux", platform.arch="amd64"} 1024.0 (+200.00 %)
# check the metrics against the defined rules
$ git metrics check --show-success-rules --show-skipped-rules HEAD~2..HEAD
[SUCCESS] binary-size{platform.os="linux", platform.arch="amd64"} 3.44 MiB => 3.53 MiB Δ +96.01 kiB (+2.72 %)
 increase should be less than 10.00 % ... check
 should be lower than 10.00 MiB ... check
[SUCCESS] binary-size{platform.os="linux", platform.arch="aarch64"} 3.14 MiB => 3.14 MiB
 increase should be less than 10.00 % ... check
 should be lower than 10.00 MiB ... check

With a github action

With git-metrics, using the GitHub actions, you can even add a check to every pull request that opens on your project.

check report

name: monitoring metrics
on:
 pull_request:
 branches:
 - main
 push:
 branches:
 - main
# this is required to be able to post the result of the check command
# in a comment of the pull request
permissions:
 pull-requests: write
jobs:
 building:
 runs-on: ubuntu-latest
 steps:
 - uses: actions/checkout@v3
 with:
 # this is needed for reporting metrics
 fetch-depth: 0
 # set the git identity to be able to save and push the metrics
 - uses: jdrouet/action-git-identity@main
 - uses: jdrouet/action-git-metrics@install
 - uses: jdrouet/action-git-metrics@execute
 with:
 pull: 'true'
 # set that to true when not a pull request
 push: ${{ github.event_name != 'pull_request' }}
 script: |
 add binary-size --tag "platform: linux" 1024
 # add a comment message to your pull request reporting the evolution
 - uses: jdrouet/action-git-metrics@check
 if: ${{ github.event_name == 'pull_request' }}

Related projects

Project goals

  • git-metrics show displays the metrics to the current commit
  • git-metrics add adds a metric to the current commit
  • git-metrics remove removes a metric from the current commit
  • git-metrics fetch fetches the metrics
  • git-metrics push pushes the metrics
  • git-metrics log displays the metrics for the last commits
  • git-metrics diff computes the diff of the metrics between 2 commits
  • git-metrics check compares the metrics against the defined budget
  • git-metrics page generates a web page with charts for every metrics
  • git-metrics import to add metrics based on some apps output
    • from lcov file

License

FOSSA Status

About

A git extension to be able to track metrics about your project, within the git repository

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /