Skip to content

Commit 409335c

Browse files
chore: update pr workflow, dependencies for SealLight unit test integration
1 parent c5d3067 commit 409335c

File tree

4 files changed

+102
-2
lines changed

4 files changed

+102
-2
lines changed

.github/workflows/pr.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,48 @@ jobs:
6868
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
6969
run: yarn run build --continue --affected
7070

71+
- name: Install SealLight
72+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
73+
run: yarn add -D slnodejs
74+
75+
- name: Configure SealLight
76+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
77+
run: npx slnodejs config --token $SL_TOKEN --appname "rhdh" --branch "pr-${{ github.event.pull_request.number }}-${{ github.head_ref }}" --build "pr-${{ github.event.pull_request.number }}-${{ github.sha }}"
78+
79+
- name: Extract backend bundle for SealLight scan
80+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
81+
run: tar -xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist
82+
83+
- name: Scan all packages with SealLight
84+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
85+
run: |
86+
# Define scan targets: workspace_path:module_id
87+
scan_targets=(
88+
"plugins/dynamic-plugins-info-backend:dynamic-plugins-info-backend"
89+
"plugins/scalprum-backend:scalprum-backend"
90+
"plugins/licensed-users-info-backend:licensed-users-info-backend"
91+
"plugins/dynamic-plugins-info:dynamic-plugins-info"
92+
"packages/app:app"
93+
"packages/backend/dist/bundle/packages/backend/dist:backend"
94+
"packages/app-next:app-next"
95+
"packages/plugin-utils:plugin-utils"
96+
)
97+
98+
# Common scan parameters
99+
common_params="--token $SL_TOKEN --buildsessionidFile ./buildsessionid --scm none --projectroot ${{ github.workspace }}"
100+
101+
# Scan each target
102+
for target in "${scan_targets[@]}"; do
103+
workspace_path="${target%:*}"
104+
module_id="${target#*:}"
105+
echo "Scanning $module_id at $workspace_path"
106+
npx slnodejs scan $common_params --workspacepath "${{ github.workspace }}/$workspace_path" --uniqueModuleId "$module_id"
107+
done
108+
109+
- name: End SealLight build session
110+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
111+
run: npx slnodejs buildend --token $SL_TOKEN --buildsessionidFile ./buildsessionid --ok
112+
71113
test:
72114
name: Test with Node.js ${{ matrix.node-version }}
73115
runs-on: ubuntu-latest
@@ -125,10 +167,39 @@ jobs:
125167
echo "ERROR: Workspace is dirty! Must run 'yarn build:dockerfile' and commit changes!"; exit 1; \
126168
fi
127169
170+
- name: Install SealLight
171+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
172+
run: yarn add -D slnodejs
173+
174+
- name: Configure SealLight
175+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
176+
run: npx slnodejs config --token $SL_TOKEN --appname "rhdh" --branch "pr-${{ github.event.pull_request.number }}-${{ github.head_ref }}" --build "pr-${{ github.event.pull_request.number }}-${{ github.sha }}"
177+
178+
- name: Start SealLight test stage
179+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
180+
run: npx slnodejs start --token $SL_TOKEN --labid $RHDHLABID --teststage "Unit Tests"
181+
128182
- name: Run tests
129183
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
130184
run: yarn run test --continue --affected
131185

186+
- name: Upload JUnit XML report to SealLight
187+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
188+
run: npx slnodejs uploadReports --token $SL_TOKEN --labid $RHDHLABID --reportFile "./jest-junit-results/junit.xml"
189+
190+
- name: Upload coverage reports to SealLight
191+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
192+
run: |
193+
# Upload coverage reports from all packages
194+
find . -name "coverage-final.json" -path "*/coverage/*" | while read coverage_file; do
195+
echo "Uploading coverage report: $coverage_file"
196+
npx slnodejs nycReport --token $SL_TOKEN --labid $RHDHLABID --report "$coverage_file"
197+
done
198+
199+
- name: End SealLight test stage
200+
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
201+
run: npx slnodejs end --token $SL_TOKEN --labid $RHDHLABID
202+
132203
- name: Install dynamic plugin dependencies
133204
if: ${{ steps.check-image.outputs.is_skipped != 'true' }}
134205
run: cd ./dynamic-plugins && yarn install && cd ..

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ lerna-debug.log*
1212
# Coverage directory generated when running tests with coverage
1313
coverage
1414

15+
# Test results directory
16+
jest-junit-results
17+
1518
# Dependencies
1619
node_modules/
1720

package.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@manypkg/cli": "0.24.0",
4444
"glob": "11.0.3",
4545
"husky": "8.0.3",
46+
"jest-junit": "^16.0.0",
4647
"lint-staged": "15.5.2",
4748
"node-gyp": "10.3.1",
4849
"sherif": "1.6.1",
@@ -56,7 +57,19 @@
5657
"@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"
5758
},
5859
"jest": {
59-
"testTimeout": 20000
60+
"testTimeout": 20000,
61+
"reporters": [
62+
"default",
63+
[
64+
"jest-junit",
65+
{
66+
"outputDirectory": "./jest-junit-results",
67+
"outputName": "junit.xml",
68+
"suiteName": "Jest Unit Tests",
69+
"includeShortConsoleOutput": true
70+
}
71+
]
72+
]
6073
},
6174
"packageManager": "[email protected]"
6275
}

yarn.lock

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25208,6 +25208,18 @@ __metadata:
2520825208
languageName: node
2520925209
linkType: hard
2521025210

25211+
"jest-junit@npm:^16.0.0":
25212+
version: 16.0.0
25213+
resolution: "jest-junit@npm:16.0.0"
25214+
dependencies:
25215+
mkdirp: ^1.0.4
25216+
strip-ansi: ^6.0.1
25217+
uuid: ^8.3.2
25218+
xml: ^1.0.1
25219+
checksum: 412aa4bfeec4254a9b34f417fda79107c7cbd295e56ffeb299ac9c977545910fbabe57c91c6cd1f12b700d4a1f60f79872b0075003f02da87d463e30fc2d9d78
25220+
languageName: node
25221+
linkType: hard
25222+
2521125223
"jest-leak-detector@npm:^29.7.0":
2521225224
version: 29.7.0
2521325225
resolution: "jest-leak-detector@npm:29.7.0"
@@ -32499,6 +32511,7 @@ __metadata:
3249932511
"@manypkg/cli": 0.24.0
3250032512
glob: 11.0.3
3250132513
husky: 8.0.3
32514+
jest-junit: ^16.0.0
3250232515
lint-staged: 15.5.2
3250332516
node-gyp: 10.3.1
3250432517
sherif: 1.6.1
@@ -36785,7 +36798,7 @@ __metadata:
3678536798
languageName: node
3678636799
linkType: hard
3678736800

36788-
"xml@npm:=1.0.1":
36801+
"xml@npm:=1.0.1, xml@npm:^1.0.1":
3678936802
version: 1.0.1
3679036803
resolution: "xml@npm:1.0.1"
3679136804
checksum: 11b5545ef3f8fec3fa29ce251f50ad7b6c97c103ed4d851306ec23366f5fa4699dd6a942262df52313a0cd1840ab26256da253c023bad3309d8ce46fe6020ca0

0 commit comments

Comments
 (0)