Skip to content

Commit

Permalink
👷 Added CI CD tool
Browse files Browse the repository at this point in the history
  • Loading branch information
madhuredra committed Dec 22, 2023
1 parent 3495466 commit 602e729
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/frontendBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: SonarCloud Frontend
on:
push:
branches:
- main
paths:
- "frontend/**"
- ".github/workflows/frontendBuild.yml"
pull_request:
types: [opened, synchronize, reopened]

jobs:
sonarscan:
if: ( startsWith(github.head_ref, 'FE_') && github.event.pull_request.merged == false ) || ( github.event_name == 'push' )
name: FE Sonar Analysis
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ${{ github.workspace }}/frontend/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- name: Install the dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm install

- name: Test and coverage
run: npm run coverage

- name: SonarCloud Scan
with:
projectBaseDir: frontend
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 comments on commit 602e729

Please sign in to comment.