0.2.5 • Published 7 years ago

circleci-weigh-in v0.2.5

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

circleci-weigh-in

NOTE: Only works with GitHub repositories.

A CircleCI integration for tracking file size changes across deploys.

What it Does

  • Saves file containing file sizes of assets (by reading from webpack stats output) to the $CIRCLE_ARTIFACTS/circleci-weigh-in/bundle-sizes.json directory in order to save it as an artifact for later reference.

    Example output:

{
  "app.css": {
    "size": 52336,
    "path": "webcreator_public/css/app.54bbcf6f50ed582c98f5cf3841d5c837.css"
  },
  "app.js": {
    "size": 408489,
    "path": "webcreator_public/js/app.18db3f4eb6b95f3ac8ea.js"
  },
  "manifest.js": {
    "size": 1463,
    "path": "webcreator_public/js/manifest.5cb70be29d3945c8ee59.js"
  },
  "vendor.js": {
    "size": 2284786,
    "path": "webcreator_public/js/vendor.af1abaa45f10408b578e.js"
  }
}
  • Generates diff of base branch file sizes with current branch.

  • Saves file containing that diff information to $CIRCLE_ARTIFACTS/circleci-weigh-in/bundle-sizes-diff.json.

    Example output

{
  "app.css": {
    "current": 52336,
    "original": 52336,
    "difference": 0,
    "percentChange": 0
  },
  "app.js": {
    "current": 408489,
    "original": 408489,
    "difference": 0,
    "percentChange": 0
  },
  "manifest.js": {
    "current": 1463,
    "original": 1463,
    "difference": 0,
    "percentChange": 0
  },
  "vendor.js": {
    "current": 2284786,
    "original": 2284786,
    "difference": 0,
    "percentChange": 0
  }
}
  • Posts that diff as a status to PR associated with the build.

CLI Options

Required Environment Variables

CircleCI Built-ins

  • CIRCLE_ARTIFACTS2.0
  • CIRCLE_PROJECT_USERNAME
  • CIRCLE_PROJECT_REPONAME
  • CIRCLE_SHA1
  • CI_PULL_REQUEST
  • CIRCLE_BUILD_URL

Manual

  • GITHUB_API_TOKEN
    • Must have read access to repository (public_repo scope for public repos, and repo scope for private repos)
    • Must have repo:status scope
  • CIRCLE_API_TOKEN
    • Must have view-builds scope

CircleCI 2.0 Notes

The CIRCLE_ARTIFACTS environment variable was removed in CircleCI 2.0. To workaround this, you need to define it yourself and then move the files stored there in a store_artifacts step. Example config file:

version: 2
jobs:
  build:
    # ...
    environment:
      - CIRCLE_ARTIFACTS: ./example/dist/artifacts
    steps:
      # ...
      - store_artifacts:
          # Wish I could use $CIRCLE_ARTIFACTS here :( (http://bit.ly/2vlqGiR)
          path: ./example/dist/artifacts
          destination: ./
0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago