Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
4bedb92
Enhance code quality pipeline with coverage reporting and job executi…
senthanal Aug 7, 2025
43e640f
Add coverage report merging and SonarCloud integration to CI pipeline
senthanal Aug 7, 2025
88390a5
Refine coverage reporting in CI by updating reporters to lcov and html
senthanal Aug 7, 2025
c07d5d2
Update coverage report merging command to use npx for improved execution
senthanal Aug 7, 2025
8d74b27
Update coverage report artifact naming for better differentiation in CI
senthanal Aug 7, 2025
fd2419e
Update coverage report download and merging process in CI pipeline
senthanal Aug 8, 2025
a33192d
Update GitHub Actions checkout action to version 4
senthanal Aug 8, 2025
01b758f
Update Node.js setup action to version 4 and enhance caching in CI pi…
senthanal Aug 8, 2025
a13cfce
Add checkout step and install dependencies in CI pipeline
senthanal Aug 8, 2025
85446ed
Remove Node.js setup and caching steps from CI pipeline
senthanal Aug 8, 2025
02b90c4
Install lcov-result-merger in CI pipeline for coverage report merging
senthanal Aug 8, 2025
589d69b
Add step to display structure of downloaded coverage files in CI pipe…
senthanal Aug 8, 2025
093920b
Refactor coverage report paths in CI pipeline for clarity and organiz…
senthanal Aug 8, 2025
e8dd3f6
Install lcov-result-merger in CI pipeline for coverage report merging
senthanal Aug 8, 2025
20e5615
Install lcov-result-merger in CI pipeline for coverage report merging
senthanal Aug 8, 2025
d8cc53a
Add jest-junit and update lcov-result-merger installation in CI pipeline
senthanal Aug 8, 2025
eaa6ad4
Fix installation command for lcov-result-merger and jest-junit in CI …
senthanal Aug 8, 2025
22cd8d3
Separate installation of lcov-result-merger and jest-junit in CI pipe…
senthanal Aug 8, 2025
733fc65
Update coverage command to use new reporter format in CI pipeline
senthanal Aug 8, 2025
457f224
Refactor coverage command to include jest-junit reporter in CI pipeline
senthanal Aug 8, 2025
c3a29e4
Remove redundant installation steps for lcov-result-merger and jest-j…
senthanal Aug 8, 2025
80de71d
Remove jest-junit reporter from coverage command in CI pipeline
senthanal Aug 8, 2025
1c617cc
Update coverage command to include all reporters for test target
senthanal Aug 10, 2025
6045973
Update coverage report merging to include job index in output filename
senthanal Aug 10, 2025
99cb9ff
Add step to display structure of merged coverage files
senthanal Aug 10, 2025
fdaec11
Ensure directory creation before merging coverage reports
senthanal Aug 10, 2025
aefae4e
Ensure coverage directory exists before merging matrix coverage reports
senthanal Aug 10, 2025
56dfdc1
Enhance SonarQube integration by adding environment variable loading …
senthanal Aug 11, 2025
9d6d6c5
Remove conditional checks for trace logging and baseline update in So…
senthanal Aug 11, 2025
bebbd06
Remove SonarQube integration steps from frontend code quality workflow
senthanal Aug 11, 2025
067adce
Refactor coverage report merging and upload steps in code quality wor…
senthanal Aug 13, 2025
fd07a2d
Update coverage artifact path in code quality workflow
senthanal Aug 13, 2025
8419464
Add step to upload JUnit reports in code quality workflow
senthanal Aug 27, 2025
c4bdadb
remove jest junit
senthanal Aug 27, 2025
50f7fa0
Remove jest-junit dependency and related configurations
senthanal Sep 10, 2025
bbc4568
Add SonarCloud integration to code quality workflow
senthanal Sep 10, 2025
0cb6302
Add optional SonarCloud token requirement for workflow call
senthanal Sep 10, 2025
10d3fcb
Add check for SONAR_CLOUD_TOKEN existence in code quality workflow
senthanal Sep 11, 2025
4684249
Add SonarCloud organization and project key support to code quality w…
senthanal Sep 11, 2025
95ce42c
Add sonar.host.url configuration to sonar-project.properties
senthanal Sep 11, 2025
68b38ab
Add inputs for SonarCloud organization and project key to code qualit…
senthanal Sep 11, 2025
72661ca
Add input validation for SonarCloud token and organization/project key
senthanal Sep 11, 2025
597fdf8
Remove test execution report path from sonar-project.properties
senthanal Sep 11, 2025
b37e5e8
Add continue-on-error option for unit tests in code quality workflow
senthanal Sep 11, 2025
bc4d312
Add continue-on-error option for unit tests in code quality workflow
senthanal Sep 11, 2025
b9a77ef
Refactor code quality workflow by removing unnecessary steps and opti…
senthanal Sep 11, 2025
81ee9db
Add default values for SonarCloud organization and project keys in co…
senthanal Sep 12, 2025
16667d6
Set default SonarCloud project key dynamically in code quality workflow
senthanal Sep 12, 2025
f5cb037
Add code coverage command to test target in run-many.ts
senthanal Sep 16, 2025
18e91f3
Fix formatting of coverageReporters in getCoverageCommand function
senthanal Sep 17, 2025
7f76732
Fix formatting of coverageReporters in getCoverageCommand function
senthanal Sep 17, 2025
b67f57e
Fix formatting of coverageReporters in getCoverageCommand function
senthanal Sep 17, 2025
d6c0273
Fix formatting of coverageReporters in getCoverageCommand function
senthanal Sep 17, 2025
dcac214
check for lcov files availability before merging coverage reports
senthanal Oct 22, 2025
6fae5f8
check for lcov files availability before normalizing coverage reports
senthanal Oct 22, 2025
090db5f
Update run-many.ts
senthanal Oct 31, 2025
f45a1fa
Fix quotes in coverage report command
senthanal Oct 31, 2025
f9e3d90
Fix coverage command to use only 'lcov' reporter
senthanal Oct 31, 2025
94e6acc
Fail the pipeline, if unit tests are failed.
senthanal Nov 2, 2025
c70572f
fix coverage cli parameter
senthanal Nov 2, 2025
6438704
add check for lcov with fix for the path
senthanal Nov 2, 2025
a946264
debug coverage path
senthanal Nov 2, 2025
9f6b846
fix coverage path
senthanal Nov 2, 2025
ca0e623
fix coverage path
senthanal Nov 2, 2025
c742e35
debug merge lcov
senthanal Nov 2, 2025
046e606
debug merge lcov
senthanal Nov 2, 2025
43243db
cleanup
senthanal Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 141 additions & 3 deletions .github/workflows/fe-code-quality.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
name: Frontend Code Quality Workflow

on: workflow_call
on:
workflow_call:
secrets:
SONAR_CLOUD_TOKEN:
required: false
inputs:
SONAR_CLOUD_ORG:
required: false
description: "SonarCloud organization key, e.g., 'my-org'"
type: string
default: "collaborationfactory"
SONAR_CLOUD_PROJECT_KEY:
required: false
description: "SonarCloud project key, e.g., 'my-project'"
type: string
default: ""
SONAR_PROPERTIES:
required: false
description: "Additional sonar-project.properties content"
type: string
default: ""

jobs:
code-quality:
Expand All @@ -9,6 +29,7 @@ jobs:
matrix:
target: [ 'test' ]
jobIndex: [ 1, 2, 3,4 ]
fail-fast: false # Ensure all jobs run even if one fails
env:
jobCount: 4
steps:
Expand All @@ -17,7 +38,7 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 22.15.0
- name: Cache Node Modules
Expand All @@ -37,10 +58,127 @@ jobs:
run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} || true

- name: Unit Tests
uses: collaborationFactory/github-actions/.github/actions/run-many@master
id: test
uses: collaborationFactory/github-actions/.github/actions/run-many@poc/code-coverage-in-code-quality-pr-pipeline
continue-on-error: true
with:
target: ${{ matrix.target }}
jobIndex: ${{ matrix.jobIndex }}
jobCount: ${{ env.jobCount }}
base: ${{ github.event.pull_request.base.ref }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Upload Coverage Reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.jobIndex }}
path: coverage/
retention-days: 7

- name: Fail pipeline if test step failed
run: |
if [ "${{ steps.test.outcome }}" = "failure" ]; then
echo "Unit tests step failed, failing the pipeline."
exit 1
fi

sonar:
name: SonarCloud
needs: code-quality
runs-on: ubuntu-latest
steps:
- name: Check if SONAR_CLOUD_TOKEN exists
id: check-secret
run: |
if [ -n "${{ secrets.SONAR_CLOUD_TOKEN }}" ]; then
echo "has_token=true" >> $GITHUB_OUTPUT
else
echo "has_token=false" >> $GITHUB_OUTPUT
echo "SONAR_CLOUD_TOKEN secret must be set to run SonarCloud analysis."
fi

- name: Set SonarCloud Project Key
id: set-project-key
run: |
if [ -z "${{ inputs.SONAR_CLOUD_PROJECT_KEY }}" ]; then
echo "project_key=collaborationFactory_${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
else
echo "project_key=${{ inputs.SONAR_CLOUD_PROJECT_KEY }}" >> $GITHUB_OUTPUT
fi

- name: Check if sonar inputs are provided
id: check-inputs
if: steps.check-secret.outputs.has_token == 'true'
run: |
if [ -z "${{ inputs.SONAR_CLOUD_ORG }}" ] || [ -z "${{ steps.set-project-key.outputs.project_key }}" ]; then
echo "run_sonar=false" >> $GITHUB_OUTPUT
echo "SONAR_CLOUD_ORG and SONAR_CLOUD_PROJECT_KEY inputs must be provided when SONAR_CLOUD_TOKEN is set."
else
echo "run_sonar=true" >> $GITHUB_OUTPUT
fi

- name: Skip SonarCloud steps if no token
if: steps.check-inputs.outputs.run_sonar == 'false' || steps.check-secret.outputs.has_token == 'false'
run: |
echo "Skipping SonarCloud analysis."
exit 0

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Write sonar-project.properties
run: |
echo "sonar.host.url=https://sonarcloud.io" > sonar-project.properties
echo "sonar.organization=${{ inputs.SONAR_CLOUD_ORG }}" >> sonar-project.properties
echo "sonar.projectKey=${{ steps.set-project-key.outputs.project_key }}" >> sonar-project.properties
echo "sonar.test.inclusions=**/*.spec.ts,**/*.test.ts,**/*.spec.tsx,**/*.test.tsx" >> sonar-project.properties
echo "sonar.javascript.lcov.reportPaths=./coverage/lcov.info" >> sonar-project.properties
if [ -n "${{ inputs.SONAR_PROPERTIES }}" ]; then
echo "${{ inputs.SONAR_PROPERTIES }}" >> sonar-project.properties
fi
cat sonar-project.properties

- name: download coverage report
uses: actions/download-artifact@v5
with:
path: ./coverage
pattern: coverage-*
merge-multiple: true

- name: Check for LCOV files
id: check-lcov
run: |
if find ./coverage -name "lcov*.info" -type f | grep -q .; then
echo "lcov_exists=true" >> $GITHUB_OUTPUT
echo "LCOV files found, will proceed with merge"
else
echo "lcov_exists=false" >> $GITHUB_OUTPUT
echo "No LCOV files found, skipping merge"
fi

- name: Merge matrix coverage reports
if: steps.check-lcov.outputs.lcov_exists == 'true'
run: |
echo "=== Finding all LCOV files ==="
find ./coverage -name "lcov*.info" -type f
echo ""
echo "=== Merging coverage files ==="
npx lcov-result-merger "coverage/**/lcov*.info" coverage/lcov.info
echo ""
echo "=== Merge completed ==="
ls -lh ./coverage/lcov.info

- name: Normalize LCOV paths for Linux
if: steps.check-lcov.outputs.lcov_exists == 'true'
run: |
if [ -f "./coverage/lcov.info" ]; then
sed -i 's|\\|/|g' ./coverage/lcov.info
echo "Normalized LCOV paths to Unix format"
fi

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
Loading