From 602e7290077a28f7e2d340b4be5eb8ae763ae6c5 Mon Sep 17 00:00:00 2001 From: madhuredra Date: Fri, 22 Dec 2023 11:02:01 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Added=20CI=20CD=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/frontendBuild.yml | 53 +++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/frontendBuild.yml diff --git a/.github/workflows/frontendBuild.yml b/.github/workflows/frontendBuild.yml new file mode 100644 index 00000000..3b9bdd18 --- /dev/null +++ b/.github/workflows/frontendBuild.yml @@ -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/sonarcloud-github-action@v1.6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file