Skip to content

IS-77.00 Updated Alters #11400

IS-77.00 Updated Alters

IS-77.00 Updated Alters #11400

Workflow file for this run

name: APP (React)
on:
push:
branches: [master, dev, test]
pull_request:
branches: [master, dev, test]
jobs:
# JOB to run change detection
check-changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
frontend:
- 'source/frontend/**'
build-frontend:
needs: check-changes
if: ${{ needs.check-changes.outputs.frontend == 'true' }}
runs-on: ubuntu-latest
env:
CI: true
working-directory: ./source/frontend
GIT_BRANCH: "${{github.ref}}"
steps:
- uses: actions/checkout@v3
- name: Extract Branch Name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
id: extract_branch
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.11.1"
- run: npm ci
working-directory: ${{env.working-directory}}
- run: npm run lint
working-directory: ${{env.working-directory}}
- run: npm run build --if-present
working-directory: ${{env.working-directory}}
- run: npm run coverage -- --maxWorkers=2
working-directory: ${{env.working-directory}}
env:
REACT_APP_TENANT: MOTI
- name: Codecov
uses: codecov/codecov-action@v3.1.1
with:
# User defined upload name. Visible in Codecov UI
name: PIMS
# Repository upload token - get it from codecov.io. Required only for private repositories
token: ${{ secrets.CodeCov }}
# Path to coverage file to upload
file: ${{env.working-directory}}/coverage/coverage-final.json
# Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
flags: unittests
# Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)
env_vars: javascript
# Specify whether or not CI build should fail if Codecov runs into an error during upload
fail_ci_if_error: false
- name: SonarQube Scan
id: scan
uses: sonarsource/sonarqube-scan-action@master
if: false
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
PROJECT_KEY: ${{secrets.PROJECT_KEY_APP}}
PROJECT_NAME: PIMS-APP
with:
projectBaseDir: ${{env.working-directory}}
args: >
-Dsonar.projectKey=${{env.PROJECT_KEY}}
-Dsonar.projectName=${{env.PROJECT_NAME}}
-Dsonar.qualitygate.wait=true
# Send notifications only if MS_TEAMS_NOTIFY_URL secret has been set
- name: Failure notification to Teams Channel
env:
MS_TEAMS_NOTIFY_URL: ${{ secrets.MS_TEAMS_NOTIFY_URL }}
if: env.MS_TEAMS_NOTIFY_URL != '' && failure() && steps.scan.outcome == 'failure'
uses: dragos-cojocari/ms-teams-notification@v1.0.2
with:
github-token: ${{ github.token }}
ms-teams-webhook-uri: ${{ env.MS_TEAMS_NOTIFY_URL }}
notification-summary: PIMS APP Sonar Scan FAILED in ${{env.GIT_BRANCH}} environment
notification-color: ff0000
timezone: America/Los_Angeles
- name: Find Comment
if: failure() && steps.scan.outcome == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/find-comment@v1
id: fc
with:
token: ${{secrets.GITHUB_TOKEN}}
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: QUALITY GATE STATUS FOR APP-REACT
- name: Check Quality Gate and Create Comment
uses: peter-evans/create-or-update-comment@v1
if: failure() && steps.scan.outcome == 'failure' && github.event_name == 'pull_request' && steps.fc.outputs.comment-id == '' && github.event.pull_request.head.repo.full_name == github.repository
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
PROJECT_KEY: ${{secrets.PROJECT_KEY_APP}}
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
QUALITY GATE STATUS FOR APP-REACT: FAILED.
[View and resolve details on][1]
[1]: ${{env.SONAR_HOST_URL}}/dashboard?id=${{env.PROJECT_KEY}}
reactions: confused
- name: Check Quality Gate and Update Comment
if: failure() && steps.scan.outcome == 'failure' && github.event_name == 'pull_request' && steps.fc.outputs.comment-id != '' && github.event.pull_request.head.repo.full_name == github.repository
uses: peter-evans/create-or-update-comment@v1
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
PROJECT_KEY: ${{secrets.PROJECT_KEY_APP}}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
QUALITY GATE STATUS FOR APP-REACT: FAILED.
[View and resolve details on][1]
[1]: ${{env.SONAR_HOST_URL}}/dashboard?id=${{env.PROJECT_KEY}}
edit-mode: replace
reactions: eyes