Skip to content

feature-ALR-1246

feature-ALR-1246 #1662

name: PR Code Validation
on:
workflow_dispatch:
pull_request:
branches:
- dev
paths:
- 'src/main/default/**'
- 'src-access-mgmt/main/default/**'
- 'src-ui/main/default/**'
- 'ehis-source/app-contactonboardinglifecycle/main/default/**'
- 'ehis-source/app-datasecurity/main/default/**'
- 'ehis-source/app-onboardinglifecycle/main/default/**'
- 'ehis-source/app-programworkareaassignment/main/default/**'
- 'ehis-source/app-segmentationterritories/main/default/**'
- 'ehis-source/core/main/default/**'
- 'ehis-source/ehis-access-mgmt/main/default/**'
- 'ehis-source/ehis-ui/main/default/**'
- '.github/workflows/PR_Code_Validation.yml'
- '!sfdx-project.json'
jobs:
Code-Validation-Run:
runs-on: ubuntu-latest
strategy:
# By default, if any job in a matrix fails, all other jobs are immediately cancelled. This makes the jobs run to completion instead.
fail-fast: false
timeout-minutes: 60
steps:
# === Setup. We need to get the code, set up nodejs, and create the results directory. ===
- uses: actions/checkout@v4
- run: mkdir smoke-test-results
# === Make three attempts to install sfdx ===
- name: 'Install Salesforce CLI'
run: |
wget https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/stable/sfdx-linux-x64.tar.xz
mkdir ~/sfdx
tar xJf sfdx-linux-x64.tar.xz -C ~/sfdx --strip-components 1
echo "$HOME/sfdx/bin" >> $GITHUB_PATH
~/sfdx/bin/sfdx version
# === Attempt to install the scanner plugin ===
- name: Install Scanner Plugin
id: scanner_install
run: sfdx plugins:install @salesforce/[email protected]
# === Log the installed plugins for easier debugging ===
- name: Log plugins
run: sfdx plugins
# === Attempt to execute static source apexunit validations ===
- name: Run static apexunit source validations
id: static_tests_apexunit
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --pmdconfig "ruleset/apexunit.xml" --format "table" --engine "pmd" --normalize-severity 1 --severity-threshold 1
# === Attempt to execute static source validations ===
- name: Run static braces source validations
id: static_tests_braces
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/braces.xml"
# === Attempt to execute static source validations ===
- name: Run static complexity source validations
id: static_tests_complexity
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/complexity.xml"
# === Attempt to execute static source validations ===
- name: Run static empty source validations
id: static_tests_empty
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/empty.xml"
# === Attempt to execute static source validations ===
- name: Run static complexity source validations
id: static_tests_metrics
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/metrics.xml"
# === Attempt to execute static source validations ===
- name: Run static security source validations
id: static_tests_security
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/security.xml"
# === Attempt to execute static source validations ===
- name: Run static style source validations
id: static_tests_style
run: sfdx scanner:run --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}" --format "table" --pmdconfig "ruleset/style.xml"
# === Attempt to execute lint source validations ===
- name: Run lint empty source validations
id: lint_tests
run: sfdx scanner:run --engine eslint-lwc --target "${{ vars.RELEASE_PIPELINE_SOURCEPATH }}"
# Authenticate CI01 sandbox
- name: 'Authenticate CI01 Sandbox'
run: |
echo "${{ secrets.CI_SFDXAUTHURL }}" > ./authfile
sf org login sfdx-url -f authfile -a CI01
- name: Validate Code
id: run_code_validation
run: sfdx force:source:deploy --sourcepath ${{ vars.RELEASE_PIPELINE_SOURCEPATH }} --wait 60 --verbose --checkonly --testlevel RunLocalTests --targetusername CI01