name: TheRock CI for composable_kernel

on:
  push:
    branches:
      - develop
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  # A PR number if a pull request and otherwise the commit hash. This cancels
  # queued and in-progress runs for the same PR (presubmit) or commit
  # (postsubmit). The workflow name is prepended to avoid conflicts between
  # different workflows.
  group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
  cancel-in-progress: true

jobs:
  therock-ci-linux:
    name: TheRock CI Linux
    permissions:
      contents: read
      id-token: write
    uses: ./.github/workflows/therock-ci-linux.yml
    secrets: inherit
    with:
      cmake_options: "-DTHEROCK_ENABLE_COMPOSABLE_KERNEL=ON -DTHEROCK_ENABLE_MIOPEN=ON -DTHEROCK_ENABLE_ALL=OFF -DTHEROCK_USE_EXTERNAL_CK=ON -DTHEROCK_CK_SOURCE_DIR=../"
      amdgpu_families: "gfx94X-dcgpu"
      test_runs_on: "linux-mi325-1gpu-ossci-rocm"

  therock_ci_summary:
    name: TheRock CI Summary
    if: always()
    needs:
      - therock-ci-linux
    runs-on: ubuntu-24.04
    steps:
      - name: Output failed jobs
        run: |
          echo '${{ toJson(needs) }}'
          FAILED_JOBS="$(echo '${{ toJson(needs) }}' \
            | jq --raw-output \
            'map_values(select(.result!="success" and .result!="skipped")) | keys | join(",")' \
          )"
          if [[ "${FAILED_JOBS}" != "" ]]; then
            echo "The following jobs failed: ${FAILED_JOBS}"
            exit 1
          fi
