Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,14 @@ jobs:
if-no-files-found: error

# Job 3: Test Go drivers and patterns (including acceptance tests)
# Note: Job always runs to ensure matrix.name is properly displayed in UI.
# Steps use conditions to skip actual work when tests aren't needed.
test-patterns:
name: Test ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [generate-matrix, generate-proto]
if: needs.generate-matrix.outputs.run_full == 'true' || needs.generate-matrix.outputs.has_test == 'true'
# No job-level 'if' - this ensures matrix.name is properly expanded in job names

strategy:
fail-fast: false
Expand Down Expand Up @@ -608,22 +610,37 @@ jobs:
pattern_dir: "patterns/unified"

steps:
- name: Check if tests should run
id: should-run
run: |
if [[ "${{ needs.generate-matrix.outputs.run_full }}" == "true" ]] || \
[[ "${{ needs.generate-matrix.outputs.has_test }}" == "true" ]]; then
echo "run=true" >> "$GITHUB_OUTPUT"
else
echo "run=false" >> "$GITHUB_OUTPUT"
echo "::notice::Skipping tests - no test-related changes detected"
fi

- name: Checkout
if: steps.should-run.outputs.run == 'true'
uses: actions/checkout@v6

- name: Setup Go
if: steps.should-run.outputs.run == 'true'
uses: actions/setup-go@v6
with:
go-version: "1.25.4"
cache: false # We'll use custom cache for more control

- name: Download generated proto code
if: steps.should-run.outputs.run == 'true'
uses: actions/download-artifact@v7
with:
name: proto-generated
path: pkg/plugin/gen/

- name: Cache Go dependencies and build cache
if: steps.should-run.outputs.run == 'true'
uses: actions/cache@v5
with:
path: |
Expand All @@ -635,22 +652,23 @@ jobs:
${{ runner.os }}-go-

- name: Download dependencies for acceptance tests
if: matrix.type == 'acceptance' && matrix.pattern_dir != ''
if: steps.should-run.outputs.run == 'true' && matrix.type == 'acceptance' && matrix.pattern_dir != ''
run: |
if [ -d "${{ matrix.pattern_dir }}" ]; then
cd ${{ matrix.pattern_dir }}
go mod download
fi

- name: Build pattern module for acceptance tests
if: matrix.type == 'acceptance' && matrix.pattern_dir != ''
if: steps.should-run.outputs.run == 'true' && matrix.type == 'acceptance' && matrix.pattern_dir != ''
run: |
if [ -d "${{ matrix.pattern_dir }}" ]; then
cd ${{ matrix.pattern_dir }}
go build ./...
fi

- name: Run tests with coverage for ${{ matrix.name }}
if: steps.should-run.outputs.run == 'true'
run: |
cd ${{ matrix.path }}
go test -v -race -coverprofile=coverage.out -covermode=atomic -timeout 15m ./...
Expand All @@ -659,6 +677,7 @@ jobs:
PRISM_TEST_QUIET: "1"

- name: Upload coverage
if: steps.should-run.outputs.run == 'true'
uses: actions/upload-artifact@v6
with:
name: coverage-${{ matrix.artifact }}
Expand Down
Loading