Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI/CD for GitHub Actions #2

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI/CD Pipeline

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build

test:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Run tests
run: npm test

deploy:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm install

- name: Deploy to GitHub Pages
run: npm run deploy
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,35 @@
mastery. Explore, play, and witness your progress in the pursuit of
precision. Happy coding! ❤️
</p>

<h2>CI/CD Process</h2>
<p>
This project uses GitHub Actions for Continuous Integration (CI) and Continuous Deployment (CD). The CI/CD pipeline is defined in the <code>.github/workflows/ci-cd.yml</code> file.
</p>
<h3>Steps in the CI/CD Pipeline</h3>
<ul>
<li>
<strong>Build:</strong> This step checks out the repository, sets up Node.js, installs dependencies, and builds the project using the <code>npm run build</code> command.
</li>
<li>
<strong>Test:</strong> This step runs after the build step. It checks out the repository, sets up Node.js, installs dependencies, and runs tests using the <code>npm test</code> command.
</li>
<li>
<strong>Deploy:</strong> This step runs after the test step. It checks out the repository, sets up Node.js, installs dependencies, and deploys the project to GitHub Pages using the <code>npm run deploy</code> command.
</li>
</ul>
<h3>Running CI/CD Processes Locally</h3>
<p>
You can run the CI/CD processes locally using the following commands:
</p>
<ul>
<li>
<strong>Build:</strong> <code>npm run build</code>
</li>
<li>
<strong>Test:</strong> <code>npm test</code>
</li>
<li>
<strong>Deploy:</strong> <code>npm run deploy</code>
</li>
</ul>
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"dependencies": {
"chart.js": "^4.4.0"
},
"scripts": {
"build": "tsc",
"test": "jest",
"deploy": "gh-pages -d build"
}
}
Loading