# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: E2E test with manifests

on:
  pull_request_target:
    branches: ["main", "*rc"]
    types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
    paths:
      - "**/Dockerfile**"
      - "**.py"
      - "**/kubernetes/**/manifest/**"
      - "**/tests/test_manifest**"
      - "!**.md"
      - "!**.txt"
      - "!**/kubernetes/**/gmc/**"
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  job1:
    uses: ./.github/workflows/_get-test-matrix.yml
    with:
      diff_excluded_files: '\.github|docker_compose|gmc|assets|\.md|\.txt|benchmark'
      test_mode: "manifest"

  run-example:
    needs: job1
    strategy:
      matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }}
      fail-fast: false
    uses: ./.github/workflows/_example-workflow.yml
    with:
      node: ${{ matrix.hardware }}
      example: ${{ matrix.example }}
      tag: ${{ github.event.pull_request.head.sha }}
      test_k8s: true
    secrets: inherit
