fix(ci): Use child pipeline trigger for test matrix
- Child pipeline gets generated test-matrix.yml from artifact - Each of 42 languages runs as parallel job - Child pipeline builds its own C CLI
This commit is contained in:
parent
47c63394cf
commit
f46d8cd556
3 changed files with 62 additions and 21 deletions
|
|
@ -72,11 +72,21 @@ build:
|
||||||
- /^v\d+\.\d+\.\d+$/
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# STAGE 4: Test Matrix (dynamically included)
|
# STAGE 4: Test Matrix (child pipeline trigger)
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
include:
|
trigger-test-matrix:
|
||||||
- local: test-matrix.yml
|
stage: test
|
||||||
optional: true
|
needs:
|
||||||
|
- generate-matrix
|
||||||
|
- build
|
||||||
|
trigger:
|
||||||
|
include:
|
||||||
|
- artifact: test-matrix.yml
|
||||||
|
job: generate-matrix
|
||||||
|
strategy: depend
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# STAGE 5: Science Jobs (Pool Burning)
|
# STAGE 5: Science Jobs (Pool Burning)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Generate dynamic test matrix based on detected changes
|
# Generate dynamic test matrix based on detected changes
|
||||||
# Reads changes.json, outputs test-matrix.yml with parallel jobs
|
# Reads changes.json, outputs test-matrix.yml as a child pipeline config
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
@ -21,25 +21,48 @@ echo "Available SDKs from API: $ALL_SDKS"
|
||||||
if [ "$TEST_ALL" = "true" ]; then
|
if [ "$TEST_ALL" = "true" ]; then
|
||||||
LANGS="$ALL_SDKS"
|
LANGS="$ALL_SDKS"
|
||||||
elif [ -z "$CHANGED_LANGS" ]; then
|
elif [ -z "$CHANGED_LANGS" ]; then
|
||||||
# No changes - don't generate any test jobs
|
# No changes - create minimal valid child pipeline that does nothing
|
||||||
echo "# No SDK changes detected - no tests to run" > test-matrix.yml
|
cat > test-matrix.yml << 'EOF'
|
||||||
|
# No SDK changes detected - skip tests
|
||||||
|
stages:
|
||||||
|
- skip
|
||||||
|
|
||||||
|
skip-tests:
|
||||||
|
stage: skip
|
||||||
|
tags:
|
||||||
|
- build
|
||||||
|
script:
|
||||||
|
- echo "No SDK changes detected - skipping inception tests"
|
||||||
|
EOF
|
||||||
|
echo "No SDK changes - created skip pipeline"
|
||||||
cat test-matrix.yml
|
cat test-matrix.yml
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
LANGS="$CHANGED_LANGS"
|
LANGS="$CHANGED_LANGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start generating test-matrix.yml
|
# Count languages
|
||||||
|
LANG_COUNT=$(echo $LANGS | wc -w)
|
||||||
|
echo "Testing $LANG_COUNT languages: $LANGS"
|
||||||
|
|
||||||
|
# Generate child pipeline config
|
||||||
cat > test-matrix.yml << 'EOF'
|
cat > test-matrix.yml << 'EOF'
|
||||||
# Dynamically generated test matrix - inception tests for changed SDKs
|
# Dynamically generated child pipeline - inception tests
|
||||||
# Each test runs: build/un → unsandbox → SDK → unsandbox → test code
|
# Each test runs: build/un → unsandbox → SDK → unsandbox → test code
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
|
||||||
|
default:
|
||||||
|
tags:
|
||||||
|
- build
|
||||||
|
|
||||||
|
variables:
|
||||||
|
UNSANDBOX_PUBLIC_KEY: $UNSANDBOX_PUBLIC_KEY
|
||||||
|
UNSANDBOX_SECRET_KEY: $UNSANDBOX_SECRET_KEY
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
tags:
|
|
||||||
- build
|
|
||||||
needs:
|
|
||||||
- build
|
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -51,9 +74,11 @@ done
|
||||||
|
|
||||||
# Complete the test job template
|
# Complete the test job template
|
||||||
cat >> test-matrix.yml << 'EOF'
|
cat >> test-matrix.yml << 'EOF'
|
||||||
|
before_script:
|
||||||
|
# Build the C CLI for inception testing (child pipeline needs its own build)
|
||||||
|
- bash scripts/build-clients.sh
|
||||||
script:
|
script:
|
||||||
- echo "=== Inception Test Matrix ==="
|
- echo "=== Inception Test: $SDK_LANG ==="
|
||||||
- echo "Testing SDK: $SDK_LANG"
|
|
||||||
- bash scripts/test-sdk.sh "$SDK_LANG"
|
- bash scripts/test-sdk.sh "$SDK_LANG"
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
|
|
@ -61,10 +86,11 @@ cat >> test-matrix.yml << 'EOF'
|
||||||
paths:
|
paths:
|
||||||
- "test-results-$SDK_LANG/"
|
- "test-results-$SDK_LANG/"
|
||||||
expire_in: 30 days
|
expire_in: 30 days
|
||||||
|
when: always
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
retry: 1
|
retry: 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Generated test-matrix.yml:"
|
echo "Generated test-matrix.yml with $LANG_COUNT parallel jobs:"
|
||||||
cat test-matrix.yml
|
cat test-matrix.yml
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
# Auto-generated test matrix placeholder
|
# Placeholder child pipeline - replaced by generate-matrix job
|
||||||
# Overwritten by generate-matrix job during CI/CD runs
|
# This file must be valid GitLab CI YAML for initial pipeline parsing
|
||||||
|
|
||||||
# Empty job that does nothing (valid GitLab CI syntax)
|
stages:
|
||||||
.test-matrix-placeholder:
|
- placeholder
|
||||||
|
|
||||||
|
placeholder:
|
||||||
|
stage: placeholder
|
||||||
|
tags:
|
||||||
|
- build
|
||||||
script:
|
script:
|
||||||
- echo "Placeholder"
|
- echo "This placeholder is replaced by dynamically generated test matrix"
|
||||||
rules:
|
rules:
|
||||||
- when: never
|
- when: never
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue