Code Monkey home page Code Monkey logo

badges's Introduction

Badges

Advanced badges for your projects using Travis or Sauce Labs.

Read more about about the service and how we built it at "Living On The Edge: Lazy Static Sites With Modern CDNs And Lambda"!

Contents

Badges

Let's start off by looking at some various badges in action!

File size for any file on GitHub or npm

Browser support matrix from Sauce Labs

Beautiful and customizable!

  • ?labels=none

    inferno status

  • ?logos=none

    inferno status

  • ?logos=none&labels=longName

    inferno status

Using something other than Sauce Labs? Just construct a URL that manually codes the results from your browser tests:

  • browsers?firefox=20,26&iexplore=!8,-9,10

    Browser Status

Web Service

The live service is deployed at https://badges.formidable.com/

You may also run your own instance using this package. See the Deployment section of the DEVELOPMENT.md document.

Endpoints

/browsers

Render browser matrix badge based on support specified in the query parameters, for cases where your testing is done with a service other than Sauce Labs (otherwise use the /sauce endpoint), or you don’t have CI and just want to show your intended support.

Query parameters

  • android, firefox, googlechrome, iexplore, ipad, iphone, microsoftedge, opera, safari

    A comma-separated list of version numbers that were tested for the given browser, e.g. firefox=20,26.

    Prefix a version number to indicate status:

    • + or no prefix: Passed.
    • -: Failed.
    • !: Error.
  • logos, labels, versionDivider, style

    Same as the /sauce/:user endpoint below.

/sauce/:user

Render browser support matrix badge for the Sauce Labs account at :user.

Query parameters

  • build

    Build number, it should match the build string of one or more jobs. By default, try to find the most recent build. The build can be from any CI service, not just Travis.

    Sauce Labs’ API doesn’t allow filtering by build, so finding the jobs for a build can be a bit of a hassle:

    • If the requested build is not in the first 500 results returned by the API, then you should specify from and to to limit the query window to the time span of the build.
    • If no from is given, then stop fetching more jobs from the API when a different build number is encountered.

    Jobs with a null value for build are never included.

  • name

    Name filter, it should match a whitespace separated substring in the name of one or more jobs. Only jobs matching the filter will be included in the result.

  • tag

    Tag filter, it should match a string in the tags array of one or more jobs. Only jobs matching the filter will be included in the result.

  • from

    Start time (Unix epoch) of the window in which to find jobs. Passed along to the Sauce Labs API.

  • to

    End time (Unix epoch) of the window in which to find jobs. Passed along to the Sauce Labs API.

  • skip

    Number of initial jobs to skip. Passed along to the Sauce Labs API.

  • source

    Data source from which to render results, defaults to svg.

    • api: Fetch results from the Sauce Labs API. This allows you to specify any of the above query parameters for filtering jobs.
    • svg: Fetch Sauce Labs’ own browser matrix SVG widget and transform it into our slimmer, beautified version. If you aren’t using any of the options above, and just want the same results as their own widget would render, use this. If you try specifying any of the options above, the server will automatically change source to api. This is probably much faster than talking to the API, but it’s a bit more fragile since their SVG output could change.
  • logos

    How to render browser logos, defaults to inside.

    • inside or true: Show logos in the label part of the badge.
    • none or false: Don’t show logos.
  • labels

    How to render browser labels, defaults to shortName.

    • shortName or true: Short names, e.g. "Chrome", "FF", "IE".
    • name: Medium names, e.g. "Chrome", "Firefox", "Internet Explorer".
    • longName: Long names, e.g. "Google Chrome", "Mozilla Firefox", "Microsoft Internet Explorer".
    • sauceName: Browser identifiers used by Sauce Labs, e.g. "googlechrome", "firefox", "iexplore".
    • none or false: Don’t show labels.
  • versionDivider

    How to render the divider between browser version numbers, defaults to none.

    • none or false: Don’t show a divider.
    • line or true: Show a subtle beveled line between version numbers.
  • style

    Badge style, defaults to flat. Styles match shields.io.

    • flat: Round and smooth.
    • flat-square: Square and flat.

/size/:source/:path

Render a file size badge for any file on GitHub or npm.

  • :source can be github or npm.
  • :path can be any valid raw.githubusercontent.com or unpkg.com path (when :source is github or npm, respectively).

Query parameters

  • gzip

    Whether to show the gzip-compressed size, defaults to false.

    • true: Show compressed size.
    • false: Show uncompressed size.
  • label

    Custom badge label, by default it will be "size" or "size (gzip)".

  • color

    Color name or value to pass along to shields.io, defaults to brightgreen. Note that the default may change to blue in the future, as is somewhat conventional for purely informational, non-qualitative badges like this one.

  • style

    Style to pass along to shields.io.

/travis/:user/:repo

Render build status badge for the Travis project at :user/:repo, counting only build jobs that match the given env filter.

The default endpoint used to communicate with the Travis API is determined by the server’s TRAVIS_ENDPOINT environment variable. You can force the public api.travis-ci.com or api.travis-ci.org endpoints by beginning the URL with /travis.com or /travis.org, respectively.

Query parameters

  • branch

    Git branch, defaults to master.

  • env

    Environment filter, it should match a VAR=value line in the env section of your build matrix. All jobs in the build matching the filter will be aggregated into one final status, similar to how Travis determines an overall build status. If no filter is given, all jobs in the build are included (even if they are Allowed Failures).

  • label

    Text label to render on the left side of the badge, defaults to the repo name.

  • style

    Style to pass along to shields.io.

/travis/:user/:repo/sauce/:sauceUser

Render browser support matrix badge for the Travis project at :user/:repo, getting Sauce Labs results from :sauceUser (defaults to :user).

You can also use the /sauce/:user endpoint, but this way ensures that we only consider Sauce Labs jobs that match up with the latest Travis build number for the given branch, and also makes the correct jobs easier to find since Travis provides the time span of the build.

The default endpoint used to communicate with the Travis API is determined by the server’s TRAVIS_ENDPOINT environment variable. You can force the public api.travis-ci.com or api.travis-ci.org endpoints by beginning the URL with /travis.com or /travis.org, respectively.

Query parameters

  • branch

    Git branch of the Travis build, defaults to master.

  • name, tag, logos, labels, versionDivider, style

    Same as the /sauce/:user endpoint above.

Maintenance Status

Active: Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.

badges's People

Contributors

archetypalsxe avatar badges-ci avatar dependabot[bot] avatar exogen avatar jpdriver avatar kevinmstephens avatar npmcdn-to-unpkg-bot avatar ryan-roemer avatar tptee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

forkkit

badges's Issues

Deprecate Project and Sunset Platform

The "badges" project will be archived and all runtime assets will be sunset. Based on our availability and traffic, the site receives very minimal usage and we expect little impact,

GitHub Actions: Remove CodePipline

Removed the legacy CodePipeline that was used previously with CodeBuild. Was in place to allow for manual approvals and to run CodeBuild. This is now being done through GitHub Actions on pushes to master

Logs: Switch to JSON-formatted logs.

We have text logs which are not machine parseable / easily analyzable.

Task:

  • Switch everything over to JSON
  • Consider using a real logger like bunyan
  • Review what data we are logging for additional tickets.

Setup Terragrunt and IAM/app module

  • IAM module updates manually, allows Serverless and Terraform "app" module to run in CI
  • App module runs in CI, will provide support resources for Serverless (e.g. Fastly)

Add CD with CodeBuild

  • deploy to production by tagging the branch
  • merge after verification (github flow)

Lander: Nice landing page.

Can be either based on README markdown or a bespoke one, but we should have a very nice landing page for https://badges.formidable.com instead of the current redirect to this repository.

/cc @formidableamy

Investigate Inferno/Sauce Issue

The example link that we post during deployment: travis/infernojs/inferno/sauce/Havunen?name=InfernoJS is currently showing as browsers unknown. It seems that there may be an application issue with consuming Sauce

Infra: Allow localdev to not need any AWS.

Currently we rely on an actively running cloud infrastructure to get secrets.

  • Create a localdev alternative, maybe with environment variables.
  • Optional: consider disabling AWS cloud secrets usage.

Update LICENSE

Add Formidable (C) underneath Brian Beck one (and preserve Brian's line).

Infra: Clean up leftover per-pr resources

We have lots of left over resources like:

  • s3:tf-badges-nonprod-pr25-remote-state
  • lambda:sls-badges-nonprod-pr36-app

We should:

  • Scour and identify everything that's lingering around
  • Identify why those resources aren't getting cleaned up
  • Create a tool / document how to manually clean up easily.
  • Fix / automate cleaning going forward.

Infra/Bug: 2+ commits building at same time can fail for TF lock.

Issue

When building #39 two commits were pushed together than the CodeBuild pipeline for the second failed with:

[terragrunt] 2019/12/06 19:48:51 Running command: terraform apply -auto-approve 
 
Error: Error locking state: Error acquiring the state lock: ConditionalCheckFailedException: The conditional request failed 
    status code: 400, request id: RDALDDI7D8L8GP6N1O223N5I9BVV4KQNSO5AEMVJF66Q9ASUAAJG 
Lock Info: 
  ID:        749c2850-b113-76b5-3920-3753bf120ed1 
  Path:      tf-badges-nonprod-pr39cd-remote-state/terraform-cd.tfstate 
  Operation: OperationTypeApply 
  Who:       root@7c6a0ebec808 
  Version:   0.12.10 
  Created:   2019-12-06 19:48:49.086482789 +0000 UTC 
  Info:       
 
 
Terraform acquires a state lock to protect the state from being written 
by multiple users at the same time. Please resolve the issue above and try 
again. For most commands, you can disable locking with the "-lock=false" 
flag, but this is not recommended. 

presumably because the previous build hadn't finished.

Task

  • Review and research approaches to mitigate this (delay and backoff for state lock or something in TF / terragrunt, ... ?)
  • Implement and test fix with multiple near-in-time commits.

Setup Serverless

  • use regional endpoint to avoid double CDN (we want Fastly instead of CloudFront)
  • use custom domain to have a stable hostname to point to in Fastly

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.