Skip to content
file-text

GitHub Action

solidity-metrics-action

v1 Latest version

solidity-metrics-action

file-text

solidity-metrics-action

Generates Solidity Code Metrics Reports for Solidity Source Units in your Repository

Installation

Copy and paste the following snippet into your .yml file.

              

- name: solidity-metrics-action

uses: tintinweb/solidity-metrics-action@v1

Learn more about this action in tintinweb/solidity-metrics-action

Choose a version

get in touch with Consensys Diligence
[ 🌐 πŸ“© πŸ”₯ ]

Solidity Metrics GitHub Action

Generate a Solidity Code Metrics HTML-Report for your Project.

Powered by solidity-code-metrics.

image

Sample Report (html)

Usage

Include it in your GitHub Actions file after a checkout.

- name: πŸ“Š Crunch Numbers
  uses: tintinweb/solidity-metrics-action@v1
  id: metrics
  with:
      target: '{,**/}*.sol'

Generates a HTML metrics report in the workspace root. The path can be accessed via ${{ steps.metrics.outputs.report }} (by default: __metrics.html).

Example Job

  1. Checkout the codebase
  2. Generate the Metrics report (Note: id: <metrics> allows us to access the generated report with ${{ steps.<metrics>.outputs.report }}).
  3. Upload ${{ steps.<metrics>.outputs.report }} as an artifact to the job

The target argument takes a single glob to select input files. By default it will try to load any *.sol file in the root or sub-paths (i.e. {,**/}*.sol).

name: Metrics

on:
  pull_request:
    branches: [ master ]

jobs:
  metrics:
    name: πŸ“Š Code Metrics
    runs-on: ubuntu-latest
    steps:
      - name: Setup
        uses: actions/checkout@v3
      - name: πŸ“Š Crunch Numbers
        uses: tintinweb/solidity-metrics-action@v1
        id: metrics
        with:
          target: '{,**/}*.sol'
      - uses: actions/upload-artifact@v3
        with:
          name: metrics.html
          path: ${{ steps.metrics.outputs.report }}

image