Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
d3ad818
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 14, 2025
aa286b0
Merge pull request #1 from subhashkhileri/sealight-unit-test
subhashkhileri Aug 16, 2025
35bd210
test
subhashkhileri Aug 16, 2025
e0ec077
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
1d19609
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
9d1c6e1
Merge pull request #2 from subhashkhileri/sealight-unit-test
subhashkhileri Aug 16, 2025
effdbf1
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
4b919a1
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
bd6e78c
Merge pull request #3 from subhashkhileri/sealight-unit-test
subhashkhileri Aug 16, 2025
0b069cb
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
8b2b4c9
Merge branch 'main' into sealight-unit-test
subhashkhileri Aug 16, 2025
f549f4e
Merge pull request #4 from subhashkhileri/sealight-unit-test
subhashkhileri Aug 16, 2025
a25c890
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
c4c22fc
chore: update pr workflow, dependencies for SealLight unit test integ…
subhashkhileri Aug 16, 2025
8df263f
Merge pull request #5 from subhashkhileri/sealight-unit-test-new
subhashkhileri Aug 16, 2025
e4b5fe8
sealights-jest-plugin and plugin scan update
subhashkhileri Aug 16, 2025
82949dc
sealights-jest-plugin and plugin scan update
subhashkhileri Aug 17, 2025
3703c21
sealights-jest-plugin and plugin scan update
subhashkhileri Aug 17, 2025
51f755c
Sealgiht: add dynamic plugins scan update
subhashkhileri Aug 17, 2025
d9c398b
sealights-jest-plugin and plugin scan update
subhashkhileri Aug 26, 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
118 changes: 116 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,106 @@ jobs:
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run build --continue --affected

- name: Install SealLight
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn add -D slnodejs

- name: Write SeaLights token into file
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
echo "${SL_TOKEN}" > sltoken.txt
echo "Token last 7 chars: ...${SL_TOKEN: -7}"
env:
SL_TOKEN: '${{secrets.SL_TOKEN}}'

- name: Configure SealLight
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
npx slnodejs config --tokenfile ./sltoken.txt --appname "rhdh" --branch "pr-${{ github.event.pull_request.number }}-${{ github.head_ref }}" --build "pr-${{ github.event.pull_request.number }}-${SHORT_SHA}-${{ github.run_id }}-${{ github.run_attempt }}"

- name: Extract backend bundle for SealLight scan
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: tar -xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist

- name: Update source map relative paths to absolute paths (plugins only)
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
CONTAINER_SOURCE="${{ github.workspace }}"
cd $CONTAINER_SOURCE && \
for map_file in $(find plugins -path "*/dist/*.map" -type f); do \
if grep -q '"sources"' "$map_file"; then \
plugin_base=${map_file%/dist/*}; \
sed -i -E "s|\"(\\.\\.?/)+([^\"]*)\"|\"$CONTAINER_SOURCE/$plugin_base/\\2\"|g" "$map_file"; \
fi; \
done

- name: Scan all packages with SealLight
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
env:
NODE_DEBUG: sl
run: |
# Define scan targets: workspace_path:module_id
scan_targets=(
"plugins/dynamic-plugins-info-backend:dynamic-plugins-info-backend"
"plugins/scalprum-backend:scalprum-backend"
"plugins/licensed-users-info-backend:licensed-users-info-backend"
"plugins/dynamic-plugins-info:dynamic-plugins-info"
"packages/app:app"
"packages/backend/dist/packages/backend/dist:backend"
"packages/app-next:app-next"
"packages/plugin-utils:plugin-utils"
)

# Common scan parameters
common_params="--tokenfile ./sltoken.txt --buildsessionidFile ./buildSessionId --excludedpaths webpack --scm none --projectroot ${{ github.workspace }}"

# Verify build session file exists
if [[ ! -f ./buildSessionId ]]; then
echo "Error: buildSessionId file not found. SealLight session may not be properly initialized."
exit 1
fi

# Verify build session file exists
if [[ ! -f ./buildSessionId ]]; then
echo "Error: buildSessionId file not found. SealLight session may not be properly initialized."
exit 1
fi

# Scan each target
for target in "${scan_targets[@]}"; do
workspace_path="${target%:*}"
module_id="${target#*:}"
full_path="${{ github.workspace }}/$workspace_path"

echo "Scanning $module_id at $workspace_path"
echo "Full path: $full_path"

# Verify the path exists
if [[ ! -d "$full_path" ]]; then
echo "Warning: Directory $full_path does not exist, skipping scan for $module_id"
continue
fi

# Run the scan with error handling
if ! npx slnodejs scan $common_params --workspacepath "$full_path" --uniqueModuleId "$module_id"; then
echo "Error: SealLight scan failed for $module_id at $full_path"
echo "Continuing with other scans..."
continue
fi

echo "Successfully scanned $module_id"
done

- name: End SealLight build session

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command ends the scan operation

if: ${{ steps.check-image.outputs.is_skipped != 'true' && always() }}
run: |
if [[ -f ./buildSessionId ]]; then
npx slnodejs buildend --tokenfile ./sltoken.txt --buildsessionidFile ./buildSessionId --ok
else
echo "Warning: buildSessionId file not found, cannot end SealLight session"
fi

test:
name: Test with Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -147,10 +247,24 @@ jobs:
echo "ERROR: Workspace is dirty! Must run 'yarn build:dockerfile' and commit changes!"; exit 1; \
fi

- name: Run tests
- name: Install SealLight
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run test --continue --affected
run: yarn add -D sealights-jest-plugin

- name: Write SeaLights token into file
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: |
echo "${SL_TOKEN}" > sltoken.txt
echo "Token last 7 chars: ...${SL_TOKEN: -7}"
env:
SL_TOKEN: '${{secrets.SL_TOKEN}}'

- name: Run tests
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: yarn run test-sealights --continue --affected
env:
NODE_DEBUG: sl
SL_LOG_LEVEL: debug
- name: Install dynamic plugin dependencies
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
run: cd ./dynamic-plugins && yarn install && cd ..
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ lerna-debug.log*
# Coverage directory generated when running tests with coverage
coverage

# Test results directory
jest-junit-results

# Dependencies
node_modules/

Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"copy-dynamic-plugins": "echo \"Command moved to dynamic-plugins/package.json\"",
"clean": "turbo run clean",
"test": "turbo run test",
"test-sealights": "npx sl-jest-runner 'turbo run test' --sl-testStage='Unit Tests' --sl-tokenFile=./sltoken.txt --sl-buildSessionIdFile=./buildSessionId --copyConfigTo=packages,plugins --recursiveCopyDepth=2",
"lint:check": "turbo run lint:check",
"lint:fix": "turbo run lint:fix",
"lint": "turbo run lint",
Expand All @@ -43,8 +44,10 @@
"@manypkg/cli": "0.24.0",
"glob": "11.0.3",
"husky": "8.0.3",
"jest-junit": "^16.0.0",
"lint-staged": "15.5.2",
"node-gyp": "10.3.1",
"sealights-jest-plugin": "^3.0.8",
"sherif": "1.6.1",
"turbo": "2.5.5"
},
Expand All @@ -56,7 +59,19 @@
"@backstage/[email protected]": "patch:@backstage/backend-dynamic-feature-service@npm%3A0.7.0#./.yarn/patches/@backstage-backend-dynamic-feature-service-npm-0.7.0-d75453687b.patch"
},
"jest": {
"testTimeout": 20000
"testTimeout": 20000,
"reporters": [
"default",
[
"jest-junit",
{
"outputDirectory": "./jest-junit-results",
"outputName": "junit.xml",
"suiteName": "Jest Unit Tests",
"includeShortConsoleOutput": true
}
]
]
},
"packageManager": "[email protected]"
}
Loading
Loading