Skip to content

Add OPF Onsite Message #11529

Add OPF Onsite Message

Add OPF Onsite Message #11529

on:
pull_request:
types: [opened, synchronize]
branches:
- develop
- develop-*
- release-*
- epic/**
workflow_dispatch:
# empty as it is used only to manually trigger the workflow
env:
NODE_VERSION: '20'
NX_BASE: origin/${{ github.event.pull_request.base.ref }}
NX_HEAD: origin/${{ github.event.pull_request.head.ref }}
concurrency:
group: ci-continuous-integration-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: Continuous Integration
jobs:
unit_tests:
name: CI - Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
projects/storefrontapp-e2e-cypress/node_modules
~/.cache/Cypress
key: nodemodules-${{ github.event.pull_request.base.sha }}
restore-keys: nodemodules-${{ github.event.pull_request.base.sha }}
- name: Package installation
run: npm ci
- name: Run unit tests
run: |
ci-scripts/unit-tests.sh
sonarqube_scan:
name: CI - SonarQube Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
with:
args: >
-Dsonar.qualitygate.wait=true
-Dsonar.projectKey=composable-storefront
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonar.tools.sap
if: github.event_name == 'pull_request'
linting:
name: CI - Validations and static code checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
projects/storefrontapp-e2e-cypress/node_modules
~/.cache/Cypress
key: nodemodules-${{ github.event.pull_request.base.sha }}
restore-keys: nodemodules-${{ github.event.pull_request.base.sha }}
- name: Package installation
run: npm ci
- name: Run linting validation
run: |
ci-scripts/validate-lint.sh
ci_result:
needs: [unit_tests, sonarqube_scan, linting]
name: CI - Result
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Aggregate Required Job Results
run: |
exit 1
if: |
needs.unit_tests.result == 'failure' || needs.unit_tests.result == 'cancelled' ||
needs.sonarqube_scan.result == 'failure' || needs.sonarqube_scan.result == 'cancelled' ||
needs.linting.result == 'failure' || needs.linting.result == 'cancelled'