Skip to content

Commit 5747648

Browse files
feat: enhance integration workflow with matrix strategy and improved artifact handling
1 parent ef9bd32 commit 5747648

File tree

1 file changed

+56
-14
lines changed

1 file changed

+56
-14
lines changed

.github/workflows/integration.yml

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
jobs:
1010
integration:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
fixture: [ repo-10, repo-basic ]
16+
format: [ json, xml ]
17+
hf-mode: [ dummy, online ]
1218
steps:
1319
- name: Checkout code
1420
uses: actions/checkout@v4
@@ -23,44 +29,80 @@ jobs:
2329
**/go.sum
2430
**/go.work.sum
2531
32+
- name: Cache dist directory
33+
uses: actions/cache@v4
34+
with:
35+
path: dist
36+
key: ${{ runner.os }}-dist-${{ matrix.fixture }}-${{ matrix.format }}-${{ matrix.hf-mode }}-${{ github.sha }}
37+
restore-keys: |
38+
${{ runner.os }}-dist-${{ matrix.fixture }}-${{ matrix.format }}-${{ matrix.hf-mode }}-
39+
2640
- name: Download dependencies
2741
run: go mod download
2842

29-
- name: Run generator against repo-10
43+
- name: Run generator
44+
env:
45+
FIXTURE: ${{ matrix.fixture }}
46+
OUTPUT_FORMAT: ${{ matrix.format }}
47+
HF_MODE: ${{ matrix.hf-mode }}
3048
run: |
31-
rm -rf dist
49+
set -euo pipefail
50+
TARGET_DIR="dist/integration/${FIXTURE}/${OUTPUT_FORMAT}/${HF_MODE}"
51+
rm -rf "${TARGET_DIR}"
52+
mkdir -p "${TARGET_DIR}"
53+
FORMAT_FLAG="--format ${OUTPUT_FORMAT}"
3254
go run . generate \
33-
--input ./testdata/repo-10 \
34-
--output dist/integration/aibom.json \
35-
--log-level debug
55+
--input "./testdata/${FIXTURE}" \
56+
--output "${TARGET_DIR}/aibom.${OUTPUT_FORMAT}" \
57+
${FORMAT_FLAG} \
58+
--hf-mode "${HF_MODE}" \
59+
--log-level quiet
3660
37-
- name: Verify generated AIBOM files
61+
- name: Validate generated AIBOM files
62+
env:
63+
FIXTURE: ${{ matrix.fixture }}
64+
OUTPUT_FORMAT: ${{ matrix.format }}
65+
HF_MODE: ${{ matrix.hf-mode }}
3866
run: |
3967
set -euo pipefail
40-
if [ ! -d dist/integration ]; then
41-
echo "dist/integration directory not found"
68+
TARGET_DIR="dist/integration/${FIXTURE}/${OUTPUT_FORMAT}/${HF_MODE}"
69+
REPORT_DIR="reports/${FIXTURE}/${OUTPUT_FORMAT}/${HF_MODE}"
70+
if [ ! -d "${TARGET_DIR}" ]; then
71+
echo "${TARGET_DIR} missing"
4272
exit 1
4373
fi
44-
mapfile -t bom_files < <(find dist/integration -maxdepth 1 -type f -name '*_aibom.json' -print)
74+
mapfile -t bom_files < <(find "${TARGET_DIR}" -maxdepth 1 -type f -name '*_aibom.*')
4575
if [ "${#bom_files[@]}" -eq 0 ]; then
46-
echo "No AIBOM files generated"
76+
echo "No AIBOM files generated under ${TARGET_DIR}"
4777
exit 1
4878
fi
79+
rm -rf "${REPORT_DIR}"
80+
mkdir -p "${REPORT_DIR}"
4981
for file in "${bom_files[@]}"; do
5082
if [ ! -s "$file" ]; then
5183
echo "Generated file $file is empty"
5284
exit 1
5385
fi
86+
base="$(basename "$file" | sed 's/\.[^.]*$//')"
87+
LOG="${REPORT_DIR}/${base}.log"
5488
go run . validate \
5589
--input "$file" \
56-
--log-level debug \
90+
--format auto \
91+
--log-level quiet \
5792
--strict \
58-
--min-score 0.5
93+
--min-score 0.5 2>&1 | tee "$LOG"
5994
done
6095
6196
- name: Upload AIBOM artifacts
6297
uses: actions/upload-artifact@v4
6398
with:
64-
name: aibom-integration
65-
path: dist/integration/*.json
99+
name: aibom-${{ matrix.fixture }}-${{ matrix.format }}-${{ matrix.hf-mode }}
100+
path: dist/integration/${{ matrix.fixture }}/${{ matrix.format }}/${{ matrix.hf-mode }}
101+
if-no-files-found: error
102+
103+
- name: Upload validator reports
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: validator-${{ matrix.fixture }}-${{ matrix.format }}-${{ matrix.hf-mode }}
107+
path: reports/${{ matrix.fixture }}/${{ matrix.format }}/${{ matrix.hf-mode }}
66108
if-no-files-found: error

0 commit comments

Comments
 (0)