@toptal/davinci-ci

7.4.1 • Public • Published

@toptal/davinci-ci

Holds Jenkins jobs definitions and Docker files supporting frontend applications.

Demo

Watch this video for a demo of how to set up a davinci-ci Jenkins jobs for a project or check the How to start a new application guide.

Installation

Use it by installing yarn add @toptal/davinci-ci in your project.

Usage

Commands

  • davinci-ci danger - checks if the PR title and and commit messages comply with Toptal's standards

To check commit message quality locally just add --local argument

davinci-ci danger --local

Using husky, you can check the commit message before pushing files changes.

"husky": {
    "hooks": {
      "pre-push": "yarn davinci-ci danger --local"
    }
  },

Configuration

You can specify which scenarios you want to be performed both for PR and master branch updates by creating a davinci.yaml file in the root of your project with the following structure.

(by default each config option is set to false)

pr:
  contract_testing: false

master:
  publish_as_package: false
  deploy_staging: false
  deploy_storybook_staging: false
  deploy: false
  require_assignee: false # danger check will require each PR to have assignee
  require_assignee_whitelist: ['dependabot-preview[bot]', 'dependabot[bot]']

# Customize Slack channel where the notifications will get posted
slack_channel: 'custom-slack-channel'
is_progressive_web_app: true

Commands you can use in GitHub PRs

@toptal-bot run tests - to re-run pr-tests job

@toptal-bot run package:alpha-release - to run publish-alpha-package job, which is publishing alpha release of the package to npm (temploy for npm package)

How to setup cypress in CI

In order to enable cypress tests on CI jobs (both pr-tests and master-main) enable it on your project davinci.yaml file, like in the example below:

pr:
  cypress: true
master:
  cypress: true

If you have it set as false or if this config is not present in your project davinci.yaml file, cypress step will be skipped.

Pre-configured davinci docker image

Davinci CI has a pre-configured docker image recipe, which can be used to build optimized docker images for your frontend applications. The image is present on path src/configs/docker/Dockerfile.gha-deploy and have a few build arguments that have to be provided:

Build argument Description Required
DIST_FOLDER Static build location Yes
ENV_RUNTIME_ENTRYPOINT Entrypoint script, davinci has an example file present at src/configs/docker/env-runtime.entrypoint.sh Yes
VERSION Current release version Yes
NGINX_CONFIG Ngninx config, davinci has an example file present at src/configs/docker/nginx-vhost.conf Yes
HTML_CDN_CACHE_TAG Cache-Tag header for HTML documents, used for specific cache purging No

The default entrypoint src/configs/docker/env-runtime.entrypoint.sh reads environment file (.env.$DAVINCI_ENV has to be located in the root of the dist folder) and populates the environment variables with values from the file if the overriden environment variable is not set. Variables that are provided to docker run command (for example, docker run -e DAVINCI_envvar1=1) have higher priority that variables from the envrionment file.

IDE Tooling

This package can be used directly in your IDE through these extensions

Readme

Keywords

Package Sidebar

Install

npm i @toptal/davinci-ci

Weekly Downloads

7,055

Version

7.4.1

License

SEE LICENSE IN LICENSE.MD

Unpacked Size

99.1 kB

Total Files

25

Last publish

Collaborators

  • talbot