Code Monkey home page Code Monkey logo

vip-go-harmonia's Introduction

Harmonia

Formely known as Preflight Checks. The goal of this project is to provide a set of automated tests (or checks) that can test and validate the application functionality and responsiveness with an environment as close to production as possible, before the actual deployment to an environment.

Building

$ npm run build 

Running the CLI

After building Harmonia, it should be possible to run the CLI directly using the following command:

$ node dist/cli.js

The command can be linked and installed on the environment using npm link:

$ npm link
$ harmonia --help

Contributing

For details about contributing to this project (e.g. publishing a release), please see CONTRIBUTING.md.

vip-go-harmonia's People

Contributors

chriszarate avatar dependabot[bot] avatar gudmdharalds avatar ingeniumed avatar sjinks avatar vaurdan avatar wpcomvip-bot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vip-go-harmonia's Issues

New check: Warn when `node_modules` is staged for commit

In order to prevent committing the node_modules to a deploy branch, create a new check that will validate:

  • If node_modules exists (and maybe if current branch == deploy branch)
    • Check if it's ignored in .gitignore
    • Check if it's not staged for commit
    • Check if it's not already commited

If so, it should throw a Warning, advising to either remove the node_modules from the repository (or staging), and/or ignore it in .gitignore, depending on the situation.

Test Report: Simplify/declutter the GitHub report

The current GitHub report has a lot of information that can overwhelm the developer trying to understand next steps. The full report should be hidden by default, and the important issues should be visible in a first glance.

Additionally, the Description should be changed to something like "Action Required", providing some more useful insight, and linking to the relevant documentation for further details.

VIP Harmonia Feedback Example

Harmonia Results

This is an example of a small paragraph that we can include in the pull request comment to give further information about Harmonia, the tests and the results. Expand each test suite to view detailed results (failures/blockers are expanded by default).

TESTS SUMMARY

✅    PASSED - 6 tests
⚠️    PARTIAL SUCCESS - 4 tests
❌    FAILURE - 0 tests


Test suite details


  1. Node.JS
    Test a node.JS site
⚠️    PARTIAL SUCCESS. Click to toggle details view -  :arrow_down:
Test Description Issues
Check NPM script in the project Checks your package.json for npm build and npm start 0
⚠️ Check usage of required and recommended packages Checks if the project is using the necessary packages in the production dependencies 1

Issues Found:

  • ⚠️    Warning - Missing required package @automattic/vip-go
    In Check usage of required and recommended packages
    Read more in the documentation


  1. Docker
    Builds and executes the docker environment
✅    PASSED. Click to toggle details view -  :arrow_down:
Test Description Issues
Builds the Docker image Tries to build the docker image and the application 0
Start and run the Docker image Tries to start the application in the built Docker image 0
Testing application availability and health-check endpoint Checking if your app accepts a PORT and responds to /cache-healthcheck 0

Issues Found:
None


  1. Health Check
    Tests a number of HTTP requests and looks at the response time
⚠️    PARTIAL SUCCESS. Click to toggle details view -  :arrow_down:
Test Description Issues
Testing availability and response time for static URLs Checks if your app responds to requests to a subset of static URLs 0
⚠️ Testing with home URLs Fetches URLS from the index and check their availability 2

Issues Found:



Create factory for SiteConfig and EnvironmentVariables

The SiteConfig and EnvironmentVariables objects are a requirement to bootstrap Harmonia.

const harmonia = new Harmonia();

const siteOptions = new SiteConfig( {
    siteID: opt.app.id,
    nodejsVersion: arg[ 'node-version' ],
    repository: opt.app.repo,
    baseURL: 'http://localhost:' + opt.port,
} );

const envVars = EnvironmentVariables( {
    PORT: opt.port,
} );

harmonia.bootstrap( siteOptions, envVars );

Since these objects are not exported in the main file, they cannot be instantiated when using Harmonia as a npm module. Therefore, the main Harmonia class, exported in harmonia.ts, needs to have a factory for these objects. Something like

const siteOptions = Harmonia.buildSiteConfig( { ...initialArgs } );
siteOptions.setPackageJSON( ... ); // Using the newly built object

const envVars = Harmonia.buildEnvVars( { ...initialEnvVars } ) ;
envVars.set( 'NEW_ENV_VAR', 'example' ); 

harmonia.bootstrap( siteOptions, envVars );

Test Summary: Count Aborted as Failed & Improve counter

If a Harmonia test is aborted, it should count as failed.

image

It failed, it should be counted as a failure. Any tests that come after should be listed and shown as aborted. (We might change that word to "cancelled" in the UI.)

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.