Skip to content

feat: braze ecommerce events onboarding #4176

feat: braze ecommerce events onboarding

feat: braze ecommerce events onboarding #4176

name: Unit Tests and Lint
on:
push:
branches: ['main', 'develop']
pull_request:
branches: ['main', 'develop', 'hotfix/*']
types: ['opened', 'reopened', 'synchronize']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
NODE_OPTIONS: '--no-warnings'
BASE_REF: ${{ github.event.pull_request.base.sha || 'HEAD' }}
jobs:
test:
name: Unit Tests and Lint
runs-on: [self-hosted, Linux, X64]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Setup workspace
env:
HUSKY: 0
run: |
npm run setup:deps
- name: Check for affected projects
id: check_affected
run: |
AFFECTED_PROJECTS=$(npx nx show projects --affected --base=$BASE_REF | tr '\n' ',')
echo "Affected projects: $AFFECTED_PROJECTS"
echo "affected_projects=$AFFECTED_PROJECTS" >> $GITHUB_OUTPUT
- name: Execute unit tests
if: ${{ steps.check_affected.outputs.affected_projects != '' }}
run: |
npm run test:ci
- name: Upload coverage reports to Codecov
if: ${{ steps.check_affected.outputs.affected_projects != '' }}
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./packages/analytics-js/reports/coverage/clover.xml,./packages/analytics-js-common/reports/coverage/clover.xml,./packages/analytics-js-integrations/reports/coverage/clover.xml,./packages/analytics-js-plugins/reports/coverage/clover.xml,./packages/analytics-js-service-worker/reports/coverage/clover.xml,./packages/analytics-v1.1/reports/coverage/clover.xml,./packages/analytics-js-cookies/reports/coverage/clover.xml,./packages/analytics-js-legacy-utilities/reports/coverage/clover.xml
- name: Execute linting check
if: ${{ steps.check_affected.outputs.affected_projects != '' }}
run: |
npm run check:lint:ci
- name: Fix filesystem paths in generated reports
if: ${{ steps.check_affected.outputs.affected_projects != '' }}
run: |
./scripts/fix-reports-path-in-github-runner.sh
- name: SonarQube Scan
if: ${{ steps.check_affected.outputs.affected_projects != '' }}
uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}