Code Monkey home page Code Monkey logo

heroku-buildpack-ci-efficient-test-setup's Introduction

The problem

If you have the following setup:

  • a monolithic application on Heroku meaning that you have to run frontend and backend tests together on single CI build
  • running backend tests on parallel on multiple Heroku dynos.

Then this setup is not efficient for the dynos which run only backend tests because Heroku test setup still builds and compiles JS dependencies using Node JS buildpack.

Unfortunately, Heroku's app.json file setup does not allow us to conditionally specify which buildpacks to run. In such case we would just have disabled Node JS buildpack for such dynos.

The solution

Detect that the current dyno is not going to run JS tests with help of CI_NODE_INDEX env var. In this case we make the package.json file in the project directory empty so that Node JS buildpack quickly finishes its job (without installing a lot of JS dependencies).

The usage

Add line { "url": "https://github.com/riskmethods/heroku-buildpack-ci-efficient-test-setup" } to app.json before the nodejs buildpack. Example:

 "environments": {
    "test": {
      "buildpacks": [
        { "url":  "https://github.com/riskmethods/heroku-buildpack-ci-efficient-test-setup" },
        { "url": "heroku/nodejs"},
        { "url": "heroku/ruby" }
      ]
    }
  }

Also, pass JS_TESTS_NODE_INDEX env var to your CI build (using app.json or via pipeline settings). This variable defines on which node the JS tests are run.

heroku-buildpack-ci-efficient-test-setup's People

Contributors

kujma10 avatar

Watchers

 avatar  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.