Skip to content

Commit

Permalink
frontned and security
Browse files Browse the repository at this point in the history
  • Loading branch information
SAINIAbhishek committed Sep 13, 2024
1 parent 3855fc7 commit ab77918
Showing 1 changed file with 38 additions and 30 deletions.
68 changes: 38 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
lock-file: "frontend/package-lock.json"
cache-path: "frontend/node_modules"
cache-key-prefix: "frontend"
working-directory: "frontend"
working-directory: "./frontend"

# Step: Cache and Install Server Dependencies
npm-server:
Expand All @@ -28,41 +28,49 @@ jobs:
lock-file: "server/package-lock.json"
cache-path: "server/node_modules"
cache-key-prefix: "server"
working-directory: "server"
working-directory: "./server"

# Step: Lint the code
lint:
needs: [npm-frontend, npm-server] # Wait for dependencies to be installed before linting
# Step: Lint the Frontnend code
lint-frontend:
needs: [npm-frontend] # Wait for dependencies to be installed before linting
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

# Restore Server Node.js Modules cache
- name: Restore Server Node.js Modules Cache
uses: actions/cache@v3
with:
path: server/node_modules
key: ${{ runner.os }}-server-${{ hashFiles('server/package-lock.json') }}

# Restore Frontend Node.js Modules cache
- name: Restore Frontend Node.js Modules Cache
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json') }}

# Lint the server code
- name: Lint Server Code
run: npm run eslint
working-directory: ./server

# Lint the frontend code
- name: Lint Frontend Code
run: npm run lint
working-directory: ./frontend

# Step: Formatting job
# Step: Lint the Server code
lint-server:
needs: [npm-server] # Wait for dependencies to be installed before linting
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

# Restore Server Node.js Modules cache
- name: Restore Server Node.js Modules Cache
uses: actions/cache@v3
with:
path: server/node_modules
key: ${{ runner.os }}-server-${{ hashFiles('server/package-lock.json') }}

# Lint the server code
- name: Lint Server Code
run: npm run eslint
working-directory: ./server

# Step: Formatting Frontend job
format-frontend:
needs: [npm-frontend] # Dependencies must be installed before formatting
runs-on: ubuntu-latest
Expand All @@ -82,16 +90,16 @@ jobs:
run: npm run prettier
working-directory: ./frontend

# # Step: Security audit Frontend
# security-frontend:
# needs: [npm-frontend]
# uses: SAINIAbhishek/shared-workflows/.github/workflows/security-audit.yml@main
# with:
# node-version: "20.17.0"
# lock-file: "frontend/package-lock.json"
# cache-path: "frontend/node_modules"
# cache-key-prefix: "frontend"
# working-directory: "frontend"
# Step: Security audit Frontend
security-frontend:
needs: [npm-frontend]
uses: SAINIAbhishek/shared-workflows/.github/workflows/security-audit.yml@main
with:
node-version: "20.17.0"
lock-file: "frontend/package-lock.json"
cache-path: "frontend/node_modules"
cache-key-prefix: "frontend"
working-directory: "./frontend"

# # Step: Security audit Server
# security-server:
Expand All @@ -106,7 +114,7 @@ jobs:

# Step: Run unit tests
test-frontend:
needs: [lint, format-frontend]
needs: [lint-frontend, format-frontend]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand Down Expand Up @@ -158,7 +166,7 @@ jobs:

# Step: Build the Server project
build-server:
needs: [lint]
needs: [lint-server]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand Down

0 comments on commit ab77918

Please sign in to comment.