CircleCI config.yml configuration setup for React and Node application
CircleCI is a popular service for continuous integration, allowing you to run test suites, perform builds, and even deploy to servers in an automated fashion.
Prerequisites:
- Your project should be stored on GitHub repo.
- Make an account on CircleCI.
- A remote server like on AWS, Heroku, etc.. that you can connect via SSH. On this server, you must install git, Node.js, and pm2 (a recommended tool to manage Node.js processes)
- You should have basic knowledge of SSH
The practical scenario for CircleCI:
- A group of developers working on a NodeJS and React project
- All code changes from developers are pushed to a GitHub repository
- With each commit pushed to the repository, CircleCI will be triggered. It will check out the latest code, install dependencies and run tests
- After all, tests are passed, CircleCI deploy code to a remote server via SSH
CircleCI configuration setup
- Create a folder in your repo named .circleci
- Inside that create a config.yml file
- Find below the configuration file(config.yml) for react js
4. Find below the configuration file(config.yml) for Node
5) CircleCI cloud
a) In a terminal, generate the key with ssh-keygen -m PEM -t rsa -C "your_email@example.com"
. See the (SSH) Secure Shell documentation web site for additional details.
b) In the CircleCI application, go to your project’s settings by clicking the the Project Settings button (top-right on the Pipelines page of the project).
c) On the Project Settings page, click on SSH Keys (vertical menu on the left).
d) Scroll down to the Additional SSH Keys section.
e) Click the Add SSH Key button.
f) In the Hostname field, enter the key’s associated host (for example, “git.heroku.com”). If you don’t specify a hostname, the key will be used for all hosts.
g) In the Private Key field, paste the SSH key you are adding.
h) Click the Add SSH Key button.