129 lines
4.1 KiB
YAML
129 lines
4.1 KiB
YAML
name: Interop E2E Tests
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'src/Scanner/**'
|
|
- 'src/Excititor/**'
|
|
- 'tests/interop/**'
|
|
schedule:
|
|
- cron: '0 6 * * *' # Nightly at 6 AM UTC
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOTNET_VERSION: '10.0.100'
|
|
|
|
jobs:
|
|
interop-tests:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
format: [cyclonedx, spdx]
|
|
arch: [amd64]
|
|
include:
|
|
- format: cyclonedx
|
|
format_flag: cyclonedx-json
|
|
- format: spdx
|
|
format_flag: spdx-json
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Syft
|
|
run: |
|
|
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
|
|
syft --version
|
|
|
|
- name: Install Grype
|
|
run: |
|
|
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
|
|
grype --version
|
|
|
|
- name: Install cosign
|
|
run: |
|
|
curl -sSfL https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64 -o /usr/local/bin/cosign
|
|
chmod +x /usr/local/bin/cosign
|
|
cosign version
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore src/StellaOps.sln
|
|
|
|
- name: Build Stella CLI
|
|
run: dotnet build src/Cli/StellaOps.Cli/StellaOps.Cli.csproj -c Release
|
|
|
|
- name: Build interop tests
|
|
run: dotnet build tests/interop/StellaOps.Interop.Tests/StellaOps.Interop.Tests.csproj
|
|
|
|
- name: Run interop tests
|
|
run: |
|
|
dotnet test tests/interop/StellaOps.Interop.Tests \
|
|
--filter "Format=${{ matrix.format }}" \
|
|
--logger "trx;LogFileName=interop-${{ matrix.format }}.trx" \
|
|
--logger "console;verbosity=detailed" \
|
|
--results-directory ./results \
|
|
-- RunConfiguration.TestSessionTimeout=900000
|
|
|
|
- name: Generate parity report
|
|
if: always()
|
|
run: |
|
|
# TODO: Generate parity report from test results
|
|
echo '{"format": "${{ matrix.format }}", "parityPercent": 0}' > ./results/parity-report-${{ matrix.format }}.json
|
|
|
|
- name: Upload test results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: interop-test-results-${{ matrix.format }}
|
|
path: ./results/
|
|
|
|
- name: Check parity threshold
|
|
if: always()
|
|
run: |
|
|
PARITY=$(jq '.parityPercent' ./results/parity-report-${{ matrix.format }}.json 2>/dev/null || echo "0")
|
|
echo "Parity for ${{ matrix.format }}: ${PARITY}%"
|
|
|
|
if (( $(echo "$PARITY < 95" | bc -l 2>/dev/null || echo "1") )); then
|
|
echo "::warning::Findings parity ${PARITY}% is below 95% threshold for ${{ matrix.format }}"
|
|
# Don't fail the build yet - this is initial implementation
|
|
# exit 1
|
|
fi
|
|
|
|
summary:
|
|
runs-on: ubuntu-22.04
|
|
needs: interop-tests
|
|
if: always()
|
|
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: ./all-results
|
|
|
|
- name: Generate summary
|
|
run: |
|
|
echo "## Interop Test Summary" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Format | Status |" >> $GITHUB_STEP_SUMMARY
|
|
echo "|--------|--------|" >> $GITHUB_STEP_SUMMARY
|
|
|
|
for format in cyclonedx spdx; do
|
|
if [ -f "./all-results/interop-test-results-${format}/parity-report-${format}.json" ]; then
|
|
PARITY=$(jq -r '.parityPercent // 0' "./all-results/interop-test-results-${format}/parity-report-${format}.json")
|
|
if (( $(echo "$PARITY >= 95" | bc -l 2>/dev/null || echo "0") )); then
|
|
STATUS="✅ Pass (${PARITY}%)"
|
|
else
|
|
STATUS="⚠️ Below threshold (${PARITY}%)"
|
|
fi
|
|
else
|
|
STATUS="❌ No results"
|
|
fi
|
|
echo "| ${format} | ${STATUS} |" >> $GITHUB_STEP_SUMMARY
|
|
done
|