test: SSR E2E Test Scenarios (#17666) #5468
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '18' | |
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@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v2 | |
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@v3 | |
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@v2 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/cache@v2 | |
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 | |
# TODO: For testing ssr-tests epic only. Remove before merging to ssr error handling epic. | |
ssr_tests: | |
name: SSR tests (for testing ssr-tests epic only) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Package installation | |
run: npm ci | |
- name: Build SSR Server | |
run: npm run build:libs && npm run build && npm run build:ssr:local-http | |
- name: Run SSR tests | |
run: npm run test:ssr:ci --verbose | |
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' |