Skip to content

Commit

Permalink
Merge pull request #2 from hootanht/add-ci-cd
Browse files Browse the repository at this point in the history
Add CI/CD for GitHub Actions
  • Loading branch information
Ali-Sdg90 authored Sep 22, 2024
2 parents 84387ac + 053df23 commit 355c790
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
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"
}
}

0 comments on commit 355c790

Please sign in to comment.