8000 GitHub - cinderblock/github-action-standalone-stats: GitHub Action that publishes coverage, tests results, and other stats to gh-pages for self-contained pretty charts and badges
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

GitHub Action that publishes coverage, tests results, and other stats to gh-pages for self-contained pretty charts and badges

License

Notifications You must be signed in to change notification settings

cinderblock/github-action-standalone-stats

Repository files navigation

Normally, we're restricted to simple badges like this:

cinderblock/github-action-standalone-stats status (GitHub Action Badge)

But with Standalone Stats...

Click for Full Build Report Metrics

Standalone Stats

Github Action Standalone Stats

Standalone Stats is a tool that helps you generate pretty build reports for your GitHub Actions.

It supports a bunch of reporters, like:

How It Works

Inspired by tools like coveralls.io, this tool takes raw coverage report files (lcov format) and generates pretty graphs to show coverage over time. However, instead of relying on a 3rd party service to generated and host these static reports, we generate them ourselves and use github-pages to host the various generated static html files.

It is critical, for generating reports, to have the raw historical data for each execution. We use an extra branch on the repo (or, optionally, a separate repo) to store this historical data and use it to generate new reports on push.

We also use another extra branch to store the generated reports, which GitHub Pages will host.

Git has the code.
Git has the database.
Git has the publication.

Usage

⚠️⚠️ WORK IN PROGRESS ⚠️⚠️

Not yet ready for use

In your GitHub Actions, add a config like this:

jobs:
  self-test-and-generate-stats:
    runs-on: ubuntu-latest # Anything should work
    steps:
      - name: Checkout your code
        uses: actions/checkout@v1

      - name: Setup your code
        run: npm install

      - name: Run your tests that generate reports
        id: tests
        run: npm test

      - name: Generate Standalone Stats
        # Run even if tests failed
        if: success() || steps.tests.result == 'failure'
        id: generateStats
        uses: cinderblock/github-action-standalone-stats@v1
        # This step will copy coverage reports (and others) to the specified historical branch
        # and use them all to generate some updated pretty charts
        with:
          stats-branch: build-stats
          stats-repo: '' # Current
          # Output directory for the generated reports
          pages-dir: public/action-stats

      # Publish to gh-pages
      - name: Publish to gh-pages
        # Run even if other steps failed, as long as generateStats succeeded
        if: success() || steps.generateStats.result == 'success'
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: public

Add this to your README

[![Development Stats](https://<user>.github.io/<repo>/action-stats/<ref>/dashboard.svg)](https://<user>.github.io/<repo>/action-stats)

Development

Install the dependencies

npm install

Build the typescript (automatic with npm install)

npm run build

Run the tests ✔️

npm test

 PASS  ./main.js
  ✓ throws invalid number (3ms)
  ✓ wait 500 ms (504ms)
  ✓ test runs (95ms)

...

About

GitHub Action that publishes coverage, tests results, and other stats to gh-pages for self-contained pretty charts and badges

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0