GithubHelp home page GithubHelp logo

greefine / llvm-cov-host Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 165 KB

Self Hosted code coverage

Home Page: https://llvm-cov-host.greefine.fr/

Rust 62.34% Dockerfile 2.53% Shell 1.77% HCL 13.10% Jinja 4.74% CSS 15.51%
codecoverage llvm-cov rust

llvm-cov-host's Introduction

llvm cov host

This project is under Development ⚠️

Self hosted coverage host.

Using cargo-llvm-cov, and llvm-cov-pretty, we gather and host the generated HTML. It also makes a comparison against previously sent report and sent it back to use it in the CI.

Table of Content

Usage

Start the server

From source

cp .env.example .env
cargo run --release

with docker

NOTE ⚠️: You probably need to pass your ssh-key to the container.
But I am not covering this in this example

docker build -t llvm-cov-host .
docker run -p 8080:8080 --env-file .env llvm-cov-host

Send a coverage report

The script curl-new-report.sh details the steps used to send a report from scratch.

# Run the tests, and output the result to a json formatted file new-report.json
cargo llvm-cov --json > new-report.json

# Modify the new-report to the format the API expect, more on this bellow in ()
sed -i '1s#^#{ "name": "test", "git": "'$(git remote get-url origin)'", "branch": "main", "json_report": #' new-report.json
echo '}' >> new-report.json

# Send a PUT request to the API with the file as a parameter and the x-api-key authentication.
curl -X PUT \
      -H "Content-type: application/json" \
      -H "x-api-key: secret" \
      -d "@new-report.json" \
      localhost:8080/report

Request payload for PUT /report

struct Request {
    // The name used to differentiate the call for different branches/project
    // Will probably be removed latter
    name: String,
    // The git url, we actually need to clone the repo, so the HTML report can have/display the sources of your project.
    git: String,
    // The branch of the repository you ran the coverage on
    branch: String,
    // The coverage json export of llvm-cov
    json_report: serde_json::Value,
}

View reports

Reports are accessible on the /view/{name}/index.html route.
From the example above to see the report we uploaded go to : http://localhost:8080/view/test/index.html

NOTE ⚠️: The access to reports is not secured by any authentication, thus making the source code accessible publicly

Usage in Github Workflow

The workflow coverage is an example on how to send reports to the server

Persistance

All Json reports received, and HTML export will be stored in the output directory
It also contain repository that where cloned, there is no cleanup or check on the size of this directory for now.

Features

  • Generating the HTML report
  • Cloning the repository to have the sources in the report
  • Serving HTML reports
  • Github Action example
  • Works with cargo namespaces
  • Compare with previous reports
  • Keep coverage % history
  • Dashboard see progression and stats
  • Optimization for large reports
  • Dashboard group project & graphs
  • Authentication
  • Permissions

Contribute

Any contributions are welcomed !

llvm-cov-host's People

Contributors

greefine avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.