Git Product home page Git Product logo

shields.io-style-badge-gist-cache's Introduction

shields.io style badge gist cache

Make your own badges for your private repositories.

Most of badge services support open source repositories or limited

Many startup companies lack of funds, or maybe don't use coverage or code quality services like Coveralls But you still need to work with private repositories

setup instructions

  1. Create a gist.
  2. find gist post id in the gist url.
  3. Create gist OAuth scope and a token.
  4. set environment variable in your CI
export GIST_TOKEN="your gist api token"
export GIST_ID="your gist post id"

Use your LCOV Code Coverage file

badge.svg.codebiuild.sh

This script runs like this

  1. find Statement coverage metrics in LCOV Code Coverage file (coverage/lcov-report/index.html) in your project working directory.
  2. cache badge svg through shields.io and post to gist

first of all you need to setup codebuild with environment variables

$GIST_TOKEN # your gist api token
$GIST_ID # your gist post id
$GIST_FILENAME # gist file name you want to use

here is buildspec.yml sample

version: 0.2

phases:
  install:
    commands:
      - curl -O https://raw.githubusercontent.com/jadewon/shields.io-style-badge-gist-cache/master/badge.svg.codebiuild.sh
  pre_build:
    commands:
      - npx jest --ci --coverage --no-cache --forceExit --silent --bail
      - bash ./badge.svg.codebiuild.sh
  build:
    commands:
      - npm run deploy

Usage

gist only provide text/plain mime-type.

so you need to change mime-type.

githack.com is currently good to use for now.

in your README.md

[![coverage](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/GIST_FILENAME.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)

Sonarqube (tested 7.9.2 only)

badge.svg.sonarqube.sh

This might useful when your Sonarqube server is not public.

This script runs like this

  1. find sonarqube project key and host information in sonar-project.properties file
  2. get metrics informations through sonarqube web api
  3. cache badge svg through shields.io and post to gist

first of all you need to setup codebuild with environment variables

$GIST_TOKEN # your gist api token
$GIST_ID # your gist post id
$SONAR_TOKEN # sonarqube web api token

here is buildspec.yml sample

version: 0.2

phases:
  install:
    commands:
      - curl -O https://raw.githubusercontent.com/jadewon/shields.io-style-badge-gist-cache/master/badge.svg.sonarqube.sh
  pre_build:
    commands:
      - npx jest --ci --coverage --no-cache --forceExit --silent --bail
      - bash analyze-sonarqube.sh # you probably already have this file
      - bash ./badge.svg.sonarqube.sh
  build:
    commands:
      - npm run deploy

Usage

gist only provide text/plain mime-type.

so you need to change mime-type.

githack.com is currently good to use for now.

in your README.md

[![bugs](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.bugs.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![code_smells](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.code_smells.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![coverage](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.coverage.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![duplicated_lines_density](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.duplicated_lines_density.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![ncloc](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.ncloc.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![sqale_rating](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.sqale_rating.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![alert_status](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.alert_status.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![reliability_rating](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.reliability_rating.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![security_rating](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.security_rating.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![sqale_index](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.sqale_index.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)
[![vulnerabilities](https://gist.githack.com/YOUR_GITHUB_ID/YOUR_GIST_ID/raw/SONAR_PROJECT_KEY.vulnerabilities.svg)](https://github.com/YOUR-GITHUB-REPOSITORY)

shields.io-style-badge-gist-cache's People

Contributors

jadewon avatar

Watchers

 avatar

Forkers

elektracodes

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.