Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit f2953ac

Browse files
NRL-1417 add test steps for both local and remote repos
1 parent 98aaebd commit f2953ac

File tree

1 file changed

+70
-15
lines changed

1 file changed

+70
-15
lines changed

.github/workflows/test-actions.yml

Lines changed: 70 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -137,58 +137,113 @@ jobs:
137137
steps:
138138
- name: Checkout repository
139139
uses: actions/checkout@v6
140-
- name: Test SBOM Scan with this repo
141-
id: sbom-scan
140+
- name: Test SBOM Scan with this local repo
141+
id: sbom-scan-local
142142
uses: ./sbom-scan
143143
with:
144-
repo-path: "."
144+
repo-path: "./"
145145
publish-to-dependency-graph: "false"
146-
artifact-name: "sbom-from-repo"
146+
artifact-name: "sbom-local-repo"
147147
- name: Verify SBOM output with assertions
148148
run: |
149-
echo "SBOM path: ${{ steps.sbom-scan.outputs.sbom-path }}"
149+
echo "SBOM path: ${{ steps.sbom-scan-local.outputs.sbom-path }}"
150150
151-
if [[ -z "${{ steps.sbom-scan.outputs.sbom-path }}" ]]; then
151+
if [[ -z "${{ steps.sbom-scan-local.outputs.sbom-path }}" ]]; then
152152
echo "SBOM path output is empty"
153153
exit 1
154154
fi
155155
156-
if [[ ! -f "${{ steps.sbom-scan.outputs.sbom-path }}" ]]; then
157-
echo "SBOM file not found: ${{ steps.sbom-scan.outputs.sbom-path }}"
156+
if [[ ! -f "${{ steps.sbom-scan-local.outputs.sbom-path }}" ]]; then
157+
echo "SBOM file not found: ${{ steps.sbom-scan-local.outputs.sbom-path }}"
158158
exit 1
159159
fi
160160
161-
if [[ ! -s "${{ steps.sbom-scan.outputs.sbom-path }}" ]]; then
161+
if [[ ! -s "${{ steps.sbom-scan-local.outputs.sbom-path }}" ]]; then
162162
echo "SBOM file is empty"
163163
exit 1
164164
fi
165165
166-
if ! jq empty "${{ steps.sbom-scan.outputs.sbom-path }}" 2>/dev/null; then
166+
if ! jq empty "${{ steps.sbom-scan-local.outputs.sbom-path }}" 2>/dev/null; then
167167
echo "SBOM is not valid JSON"
168168
exit 1
169169
fi
170170
171-
if ! jq -e '.spdxVersion' "${{ steps.sbom-scan.outputs.sbom-path }}" >/dev/null; then
171+
if ! jq -e '.spdxVersion' "${{ steps.sbom-scan-local.outputs.sbom-path }}" >/dev/null; then
172172
echo "SBOM missing spdxVersion field"
173173
exit 1
174174
fi
175175
176-
if ! jq -e '.name' "${{ steps.sbom-scan.outputs.sbom-path }}" >/dev/null; then
176+
if ! jq -e '.name' "${{ steps.sbom-scan-local.outputs.sbom-path }}" >/dev/null; then
177177
echo "SBOM missing name field"
178178
exit 1
179179
fi
180180
181-
if ! jq -e '.creationInfo' "${{ steps.sbom-scan.outputs.sbom-path }}" >/dev/null; then
181+
if ! jq -e '.creationInfo' "${{ steps.sbom-scan-local.outputs.sbom-path }}" >/dev/null; then
182182
echo "SBOM missing creationInfo field"
183183
exit 1
184184
fi
185185
186-
if ! jq -e '.packages' "${{ steps.sbom-scan.outputs.sbom-path }}" >/dev/null; then
186+
if ! jq -e '.packages' "${{ steps.sbom-scan-local.outputs.sbom-path }}" >/dev/null; then
187187
echo "SBOM missing packages array"
188188
exit 1
189189
fi
190190
191-
file_size=$(wc -c < "${{ steps.sbom-scan.outputs.sbom-path }}")
191+
file_size=$(wc -c < "${{ steps.sbom-scan-local.outputs.sbom-path }}")
192+
echo "SBOM file size: ${file_size} bytes"
193+
194+
echo "All SBOM scan assertions passed"
195+
- name: Test SBOM Scan with public remote repo
196+
id: sbom-scan-remote
197+
uses: ./sbom-scan
198+
with:
199+
repo-path: "https://github.com/PokeAPI/pokeapi"
200+
publish-to-dependency-graph: "false"
201+
artifact-name: "sbom-remote-repo"
202+
- name: Verify SBOM output with assertions
203+
run: |
204+
echo "SBOM path: ${{ steps.sbom-scan-remote.outputs.sbom-path }}"
205+
206+
if [[ -z "${{ steps.sbom-scan-remote.outputs.sbom-path }}" ]]; then
207+
echo "SBOM path output is empty"
208+
exit 1
209+
fi
210+
211+
if [[ ! -f "${{ steps.sbom-scan-remote.outputs.sbom-path }}" ]]; then
212+
echo "SBOM file not found: ${{ steps.sbom-scan-remote.outputs.sbom-path }}"
213+
exit 1
214+
fi
215+
216+
if [[ ! -s "${{ steps.sbom-scan-remote.outputs.sbom-path }}" ]]; then
217+
echo "SBOM file is empty"
218+
exit 1
219+
fi
220+
221+
if ! jq empty "${{ steps.sbom-scan-remote.outputs.sbom-path }}" 2>/dev/null; then
222+
echo "SBOM is not valid JSON"
223+
exit 1
224+
fi
225+
226+
if ! jq -e '.spdxVersion' "${{ steps.sbom-scan-remote.outputs.sbom-path }}" >/dev/null; then
227+
echo "SBOM missing spdxVersion field"
228+
exit 1
229+
fi
230+
231+
if ! jq -e '.name' "${{ steps.sbom-scan-remote.outputs.sbom-path }}" >/dev/null; then
232+
echo "SBOM missing name field"
233+
exit 1
234+
fi
235+
236+
if ! jq -e '.creationInfo' "${{ steps.sbom-scan-remote.outputs.sbom-path }}" >/dev/null; then
237+
echo "SBOM missing creationInfo field"
238+
exit 1
239+
fi
240+
241+
if ! jq -e '.packages' "${{ steps.sbom-scan-remote.outputs.sbom-path }}" >/dev/null; then
242+
echo "SBOM missing packages array"
243+
exit 1
244+
fi
245+
246+
file_size=$(wc -c < "${{ steps.sbom-scan-remote.outputs.sbom-path }}")
192247
echo "SBOM file size: ${file_size} bytes"
193248
194249
echo "All SBOM scan assertions passed"

0 commit comments

Comments
 (0)