Files
rocm-systems/.github/workflows/therock-ci.yml
T
2025-08-02 22:08:24 -04:00

144 líneas
4.4 KiB
YAML

name: TheRock CI
on:
push:
branches:
- develop
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
inputs:
projects:
type: string
description: "Insert space-separated list of projects to test or 'all' to test all projects. ex: 'projects/rocprim projects/hipcub'"
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:
setup:
name: "Setup"
runs-on: ubuntu-24.04
outputs:
projects: ${{ steps.projects.outputs.projects }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github
sparse-checkout-cone-mode: true
# # will be needed for `patch_monorepo.py` but necessary now
# - name: Checkout TheRock Repository
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# with:
# repository: "ROCm/TheRock"
# path: "TheRock"
# ref: 0730cccf8b98e012d64750f26032bd760360fa45
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pydantic requests
# # For our "rocPRIM" MVP, there are no patches to apply. This will be un-commented and used later!
# - name: Patch monorepo
# run: |
# python TheRock/build_tools/github_actions/patch_monorepo.py \
# --repo rocm-systems
- name: Detect changed subtrees
id: detect
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/scripts/pr_detect_changed_subtrees.py \
--repo "${{ github.repository }}" \
--pr "${{ github.event.pull_request.number }}" \
--config ".github/repos-config.json"
- name: Determine projects to run
id: projects
env:
SUBTREES: ${{ steps.detect.outputs.subtrees }}
PROJECTS: ${{ inputs.projects }}
# TODO(geomin12): #590 Enable TheRock CI for forked PRs
IS_FORKED_PR: ${{ github.event.pull_request.head.repo.fork == true }}
run: |
python .github/scripts/therock_configure_ci.py
therock-ci-linux:
name: TheRock CI Linux
permissions:
contents: read
id-token: write
needs: setup
if: ${{ needs.setup.outputs.projects != '[]' }}
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.setup.outputs.projects) }}
uses: ./.github/workflows/therock-ci-linux.yml
secrets: inherit
with:
cmake_options: ${{ matrix.projects.cmake_options }}
project_to_test: ${{ matrix.projects.project_to_test }}
subtree_checkout: ${{ matrix.projects.subtree_checkout }}
therock-ci-windows:
name: TheRock CI Windows
permissions:
contents: read
id-token: write
needs: setup
if: ${{ needs.setup.outputs.projects != '[]' }}
strategy:
fail-fast: false
matrix:
projects: ${{ fromJSON(needs.setup.outputs.projects) }}
uses: ./.github/workflows/therock-ci-windows.yml
secrets: inherit
with:
cmake_options: ${{ matrix.projects.cmake_options }}
project_to_test: ${{ matrix.projects.project_to_test }}
subtree_checkout: ${{ matrix.projects.subtree_checkout }}
therock_ci_summary:
name: TheRock CI Summary
if: always()
needs:
- setup
- therock-ci-linux
- therock-ci-windows
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