/green-circle

Circle CI fetch and analyse specs per file.

Primary LanguageJavaScript

Green circle

It downloads artifacts from your Circle CI and persists into a database. Allowing you to study performance per build.

Setup your key

  1. Create or get your key on Circle CI api.
  2. Set your environment variable on a .env file in the main directory of these project
export CI_TOKEN=myAwesomeToken
export CI_REPOSITORY="rdstation"
export CI_USERNAME="ResultadosDigitais"
  1. Setup your database
create database circleci;
\c circleci
create table performances (build integer, file varchar, time float, container integer);
create table builds (build_num integer, author_name varchar, branch varchar,
  build_time_millis bigint, queued_at timestamp, start_time timestamp, subject text);

alter table builds add unique (build_num);
  1. Choose recent builds to analyse

Supose you get a list of your recent successful builds:

builds = CircleCi::Project.recent_builds $username, $repo
build_nums = builds
  .body
  .select{|e|e["status"] =~ /fixed|success/ && e["branch"] !="master"}
  .map{|e|e["build_num"]}

So, fetch and persist data:

build_nums.each{|build_num| fetch build_num }
  1. Now explore!

Average build time

Performance.group(:build).average(:time)

Average build time by container

Performance.group(:build, :container).average(:time)

Standard deviation of time per file

stdev_per_file