Last updated

How to use CI with FTW

This guide describes how the Continuous Integration (CI) setup works in Flex Template for Web (FTW) and how to enable it.

FTW provides a configuration to use CircleCI as a continuous integration server to run tests and other scripts. This ensures quality and can be forced to avoid merging changes that break tests or fail audits.

The .circleci/config.yml file is used to configure CircleCI.

1. Enable CI

Follow the Setting up Your Build on CircleCI instructions in the CircleCI documentation.

2. Understand how the setup works

Currently the CI runs the following scripts:

Code formatting

yarn run format-ci

This command fails if there are changes in the formatting that are not committed. Run yarn run format to format the code and get rid of the error.

Build

yarn run build

This command ensures that the build passes.

Tests

yarn run test-ci

This command runs the tests.

Security audit

yarn run audit

This command runs the security audit using yarn audit --json and checks returned JSON against vulnerability exceptions defined in .auditrc file at the project root. The audit checks for installed packages with known vulnerabilities and warns about those.

The scripts outputs information about the dependency path that added the package. If that information is not enough, yarn why package-name can be used to get more detailed information about why the package is installed.