Skip to content
Closed
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
134 changes: 134 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

name: CI/CD Pipeline

on:
push:
branches:
- main

pull_request:
branches:
- main

workflow_dispatch:

permissions:
contents: read

env:
NODE_VERSION: '26'

jobs:

# Stage 1: Build
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Build application
run: npm run build

- name: Upload build artifact
uses: actions/upload-artifact@v6
with:
name: build-artifact
path: dist/
if-no-files-found: error


# Stage 2: Lint
lint:
name: Lint
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout source code
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run lint checks
run: npm run check


# Stage 3: Test
test:
name: Test
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout source code
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test

- name: Upload test coverage
uses: actions/upload-artifact@v6
with:
name: test-coverage
path: coverage/


# Stage 4: Deploy (Simulation)
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [build, lint, test]

if: github.ref == 'refs/heads/main' && github.event_name == 'push'

steps:
- name: Checkout source code
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ env.NODE_VERSION }}

- name: Download build artifact
uses: actions/download-artifact@v7
with:
name: build-artifact
path: dist/

- name: Verify build files
run: ls -la dist/

- name: Run deployment script
run: npm run deploy

- name: Deployment simulation completed
run: echo "Deployment simulation completed successfully!"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ dist/
lerna-debug.log
node_modules/
npm-debug.log*
!.github/workflows