Skip to content

Commit ef2e87b

Browse files
nicu1989carlescufi
authored andcommitted
ci: Extend west ncs-sbom smoke test
Verify scancode version and run sbom with scancode. Signed-off-by: Nicolae Dicu <[email protected]>
1 parent 0ddc50b commit ef2e87b

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

.github/workflows/west-commands.yml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,77 @@ jobs:
5757
with:
5858
git-fetch-depth: 0
5959
path: nrf
60-
- name: Install requirements
60+
- name: Install requirements(bash)
6161
shell: bash
6262
run: |
63+
pip3 install -r nrf/scripts/requirements-fixed.txt
6364
pip3 install -r nrf/scripts/requirements-west-ncs-sbom.txt
6465
pip3 install -r nrf/scripts/requirements-extra.txt
66+
- name: Install requirements (Windows)
67+
if: ${{ matrix.os == 'windows-latest' }}
68+
shell: pwsh
69+
run: |
70+
python -m pip install --upgrade pip
71+
python -m pip install -r nrf/scripts/requirements-fixed.txt
72+
python -m pip install -r nrf/scripts/requirements-west-ncs-sbom.txt
73+
python -m pip install -r nrf/scripts/requirements-extra.txt
6574
- name: Smoke test ncs-loot & ncs-compare
6675
shell: bash
6776
run: |
6877
west ncs-loot -h
6978
west ncs-compare -h
70-
- name: Smoke test ncs-sbom
79+
- name: Smoke test ncs-sbom (Ubuntu)
7180
# macOS is not supported by scancode-toolkit(used in ncs-sbom)
72-
if: ${{ matrix.os == 'ubuntu-24.04' || matrix.os == 'windows-latest' }}
81+
if: ${{ matrix.os == 'ubuntu-24.04' }}
7382
shell: bash
7483
run: |
7584
west ncs-sbom -h
85+
86+
# show what scancode-toolkit is default
87+
if [[ "$RUNNER_OS" == "Linux" ]]; then
88+
scancode --version
89+
fi
90+
91+
# create a dummy file
92+
echo "/* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */" > test_file.c
93+
94+
# run ncs-sbom with scancode-toolkit
95+
west ncs-sbom \
96+
--input-files test_file.c \
97+
--license-detectors scancode-toolkit \
98+
--output-html scancode_report.html
99+
- name: Smoke test ncs-sbom (Windows)
100+
if: ${{ matrix.os == 'windows-latest' }}
101+
shell: pwsh
102+
run: |
103+
# --- show environment trees (Windows style) ---
104+
$envs = @(
105+
"pythonLocation",
106+
"PKG_CONFIG_PATH",
107+
"Python_ROOT_DIR",
108+
"Python2_ROOT_DIR",
109+
"Python3_ROOT_DIR"
110+
)
111+
112+
foreach ($e in $envs) {
113+
$path = (Get-Item "Env:$e").Value
114+
Write-Host "`n=== $e ==="
115+
Write-Host $path
116+
if (Test-Path $path) {
117+
Write-Host "`n--- Directory tree for $e ---"
118+
tree $path /F | Out-String | Write-Host
119+
} else {
120+
Write-Host "Path not found: $path"
121+
}
122+
}
123+
124+
west ncs-sbom -h
125+
126+
# create a dummy file
127+
Set-Content -Path test_file.c -Value '/* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */'
128+
129+
# run ncs-sbom with scancode-toolkit
130+
west ncs-sbom `
131+
--input-files test_file.c `
132+
--license-detectors scancode-toolkit `
133+
--output-html scancode_report.html

0 commit comments

Comments
 (0)