Skip to content

chore(guides): add OWNERS files to all well-lit path guides (#1663) #16

chore(guides): add OWNERS files to all well-lit path guides (#1663)

chore(guides): add OWNERS files to all well-lit path guides (#1663) #16

Workflow file for this run

name: CI-PR-Test
on:
push:
branches: [main]
paths:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-*.yaml
- .github/workflows/build-image.yaml
- docker/**
- patches/**
- scripts/**
- guides/**/*.yaml
- guides/**/*.gotmpl
# All PRs use pull_request_target so workflow code runs from main (secrets available for forks).
# Secrets are gated behind a GitHub Environment with required reviewers.
pull_request_target:
types: [opened, synchronize, reopened]
branches: [main]
workflow_dispatch:
inputs:
pr_or_branch:
description: 'Pull-request number or branch name to test'
required: true
default: 'main'
type: string
custom_image_tag:
description: 'Custom XPU image tag to use (optional)'
required: false
default: ''
type: string
permissions:
contents: read
packages: write
security-events: write
concurrency:
group: ci-pr-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Quick check: do any image-related files have changes?
# Runs immediately without approval — only reads the GitHub API diff,
# does not execute PR code. Used to skip the approval gate when no
# images need building.
needs-build-check:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
outputs:
any_image_changes: ${{ steps.check.outputs.any_image_changes }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
images:
- 'docker/**'
- name: Summarize
id: check
run: |
echo "any_image_changes=${{ steps.filter.outputs.images }}" >> $GITHUB_OUTPUT
# Gate: require approval only when image-related files changed.
# For pull_request_target (fork PRs): requires approval from a maintainer via
# the "build-approval" GitHub Environment with required reviewers.
# Skipped entirely when no image files changed — builds will be skipped anyway.
# For push/workflow_dispatch: proceeds automatically via auto-gate.
pr-gate:
needs: [needs-build-check]
if: >-
github.event_name == 'pull_request_target' &&
needs.needs-build-check.outputs.any_image_changes == 'true'
runs-on: ubuntu-latest
environment: build-approval
steps:
- run: echo "Build authorized by maintainer"
auto-gate:
if: github.event_name != 'pull_request_target'
runs-on: ubuntu-latest
steps:
- run: echo "Auto-authorized (push or dispatch)"
# Detect which files have changed to determine which tests to run
detect-changes:
needs: [pr-gate, auto-gate]
if: ${{ !cancelled() && !failure() }}
runs-on: ubuntu-latest
outputs:
xpu-optimized-baseline: ${{ steps.filter.outputs.xpu-optimized-baseline }}
xpu-pd-disaggregation: ${{ steps.filter.outputs.xpu-pd-disaggregation }}
xpu-prefix-cache: ${{ steps.filter.outputs.xpu-prefix-cache }}
hpu-optimized-baseline: ${{ steps.filter.outputs.hpu-optimized-baseline }}
hpu-pd-disaggregation: ${{ steps.filter.outputs.hpu-pd-disaggregation }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha || '' }}
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
xpu-optimized-baseline:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-optimized-baseline-xpu.yaml
- .github/scripts/e2e/**
- docker/common-versions
- guides/**/values_xpu.yaml
- guides/optimized-baseline/ms-optimized-baseline/values_xpu.yaml
- guides/optimized-baseline/helmfile.yaml.gotmpl
xpu-pd-disaggregation:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-pd-xpu.yaml
- .github/scripts/e2e/**
- docker/common-versions
- guides/**/values_xpu.yaml
- guides/pd-disaggregation/ms-pd/values_xpu.yaml
- guides/pd-disaggregation/README.xpu.md
- guides/pd-disaggregation/helmfile.yaml.gotmpl
xpu-prefix-cache:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-prefix-cache-xpu.yaml
- .github/scripts/e2e/**
- docker/common-versions
- guides/**/values_xpu.yaml
- guides/precise-prefix-cache-routing/**/values_xpu.yaml
- guides/precise-prefix-cache-routing/helmfile.yaml.gotmpl
hpu-optimized-baseline:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-optimized-baseline-hpu.yaml
- .github/scripts/e2e/**
- docker/Dockerfile.hpu
- guides/**/values-hpu.yaml
- guides/optimized-baseline/ms-optimized-baseline/values-hpu.yaml
- guides/optimized-baseline/helmfile.yaml.gotmpl
hpu-pd-disaggregation:
- .github/workflows/ci-pr-test.yaml
- .github/workflows/e2e-pd-hpu.yaml
- .github/scripts/e2e/**
- docker/Dockerfile.hpu
- guides/**/values_hpu.yaml
- guides/pd-disaggregation/ms-pd/values_hpu.yaml
- guides/pd-disaggregation/README.hpu.md
- guides/pd-disaggregation/helmfile.yaml.gotmpl
# Call the build-image workflow to build any changed images
# Resolves build-image.yaml from main (pull_request_target), checks out PR code via ref.
build-images:
needs: [needs-build-check, pr-gate, auto-gate]
if: ${{ !cancelled() && !failure() }}
uses: ./.github/workflows/build-image.yaml
with:
ref: ${{ github.event.pull_request.head.sha || '' }}
secrets: inherit
# Call the XPU optimized baseline test workflow
test-xpu-optimized-baseline:
needs: [detect-changes, build-images]
# Run tests if:
# 1. It's a manual workflow_dispatch, OR
# 2. Related files changed AND (build succeeded OR build was skipped)
if: >-
${{ (github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.xpu-optimized-baseline == 'true') &&
(needs.build-images.result == 'success' || needs.build-images.result == 'skipped') }}
uses: ./.github/workflows/e2e-optimized-baseline-xpu.yaml
with:
pr_or_branch: ${{ github.event.inputs.pr_or_branch || github.event.pull_request.number }}
# Only use custom image tag if user provides it, or if XPU image was actually built in this PR
# Otherwise, let the test use the default image from values_xpu.yaml
custom_image_tag: >-
${{ github.event.inputs.custom_image_tag != '' &&
github.event.inputs.custom_image_tag ||
(needs.build-images.outputs.xpu == 'true' &&
github.event.pull_request.number != '' &&
format('pr-{0}', github.event.pull_request.number) || '') }}
secrets: inherit
# Call the XPU PD test workflow
test-xpu-pd:
needs: [detect-changes, build-images]
# Run tests if:
# 1. It's a manual workflow_dispatch, OR
# 2. Related files changed AND (build succeeded OR build was skipped)
if: >-
${{ (github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.xpu-pd-disaggregation == 'true') &&
(needs.build-images.result == 'success' || needs.build-images.result == 'skipped') }}
uses: ./.github/workflows/e2e-pd-xpu.yaml
with:
pr_or_branch: ${{ github.event.inputs.pr_or_branch || github.event.pull_request.number }}
# Only use custom image tag if user provides it, or if XPU image was actually built in this PR
# Otherwise, let the test use the default image from values_xpu.yaml
custom_image_tag: >-
${{ github.event.inputs.custom_image_tag != '' &&
github.event.inputs.custom_image_tag ||
(needs.build-images.outputs.xpu == 'true' &&
github.event.pull_request.number != '' &&
format('pr-{0}', github.event.pull_request.number) || '') }}
secrets: inherit
# Call the XPU Prefix Cache test workflow
test-xpu-prefix-cache:
needs: [detect-changes, build-images]
# Run tests if:
# 1. It's a manual workflow_dispatch, OR
# 2. Related files changed AND (build succeeded OR build was skipped)
if: >-
${{ (github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.xpu-prefix-cache == 'true') &&
(needs.build-images.result == 'success' || needs.build-images.result == 'skipped') }}
uses: ./.github/workflows/e2e-prefix-cache-xpu.yaml
with:
pr_or_branch: ${{ github.event.inputs.pr_or_branch || github.event.pull_request.number }}
# Only use custom image tag if user provides it, or if XPU image was actually built in this PR
# Otherwise, let the test use the default image from values_xpu.yaml
custom_image_tag: >-
${{ github.event.inputs.custom_image_tag != '' &&
github.event.inputs.custom_image_tag ||
(needs.build-images.outputs.xpu == 'true' &&
github.event.pull_request.number != '' &&
format('pr-{0}', github.event.pull_request.number) || '') }}
secrets: inherit
# Call the HPU optimized baseline test workflow
test-hpu-optimized-baseline:
needs: [detect-changes, build-images]
# Run tests if:
# 1. It's a manual workflow_dispatch, OR
# 2. Related files changed AND (build succeeded OR build was skipped)
if: >-
${{ (github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.hpu-optimized-baseline == 'true') &&
(needs.build-images.result == 'success' || needs.build-images.result == 'skipped') }}
uses: ./.github/workflows/e2e-optimized-baseline-hpu.yaml
with:
pr_or_branch: ${{ github.event.inputs.pr_or_branch || github.event.pull_request.number }}
# Only use custom image tag if user provides it, or if HPU image was actually built in this PR
# Otherwise, let the test use the default image from values-hpu.yaml
custom_image_tag: >-
${{ github.event.inputs.custom_image_tag != '' &&
github.event.inputs.custom_image_tag ||
(needs.build-images.outputs.hpu == 'true' &&
github.event.pull_request.number != '' &&
format('pr-{0}', github.event.pull_request.number) || '') }}
secrets: inherit
# Call the HPU PD test workflow
test-hpu-pd:
needs: [detect-changes, build-images]
# Run tests if:
# 1. It's a manual workflow_dispatch, OR
# 2. Related files changed AND (build succeeded OR build was skipped)
if: >-
${{ (github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.hpu-pd-disaggregation == 'true') &&
(needs.build-images.result == 'success' || needs.build-images.result == 'skipped') }}
uses: ./.github/workflows/e2e-pd-hpu.yaml
with:
pr_or_branch: ${{ github.event.inputs.pr_or_branch || github.event.pull_request.number }}
# Only use custom image tag if user provides it, or if HPU image was actually built in this PR
# Otherwise, let the test use the default image from values_hpu.yaml
custom_image_tag: >-
${{ github.event.inputs.custom_image_tag != '' &&
github.event.inputs.custom_image_tag ||
(needs.build-images.outputs.hpu == 'true' &&
github.event.pull_request.number != '' &&
format('pr-{0}', github.event.pull_request.number) || '') }}
secrets: inherit