Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
62 changes: 62 additions & 0 deletions .github/workflows/_decide.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: _decide

# Resolve the lane + backend from the triggering event. Shared by the
# per-platform entry workflows (ci-linux-x86_64 / ci-windows / ci-sbsa) so the
# rules live in exactly one place. `github.*` here refers to the caller's event.
#
# lane: fast (PR push) | full (approval / `ci: full` / main push) |
# nightly (schedule) | skip (non-approval review)
# backend: standard | rtx | both — from the `backend: TensorRT[-RTX]` labels
# (or the workflow_dispatch `backend` input)

on:
workflow_call:
outputs:
lane:
description: "fast | full | nightly | skip"
value: ${{ jobs.decide.outputs.lane }}
backend:
description: "standard | rtx | both"
value: ${{ jobs.decide.outputs.backend }}

jobs:
decide:
runs-on: ubuntu-latest
outputs:
lane: ${{ steps.pick.outputs.lane }}
backend: ${{ steps.pick.outputs.backend }}
steps:
- id: pick
env:
EVENT: ${{ github.event_name }}
REVIEW_STATE: ${{ github.event.review.state }}
HAS_FULL_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci: full') }}"
# Exact array-element match: 'backend: TensorRT' != 'backend: TensorRT-RTX'.
HAS_RTX_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'backend: TensorRT-RTX') }}"
HAS_STD_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'backend: TensorRT') }}"
DISPATCH_LANE: ${{ github.event.inputs.lane }}
DISPATCH_BACKEND: ${{ github.event.inputs.backend }}
run: |
set -euo pipefail
case "$EVENT" in
schedule) lane=nightly ;;
workflow_dispatch) lane="${DISPATCH_LANE:-full}" ;;
push) lane=full ;; # main canary
pull_request_review)
[ "$REVIEW_STATE" = "approved" ] && lane=full || lane=skip ;;
pull_request)
[ "$HAS_FULL_LABEL" = "true" ] && lane=full || lane=fast ;;
*) lane=fast ;;
esac
echo "lane=$lane" >> "$GITHUB_OUTPUT"
case "$EVENT" in
workflow_dispatch) backend="${DISPATCH_BACKEND:-both}" ;;
pull_request)
if [ "$HAS_RTX_LABEL" = "true" ] && [ "$HAS_STD_LABEL" = "true" ]; then backend=both
elif [ "$HAS_RTX_LABEL" = "true" ]; then backend=rtx
elif [ "$HAS_STD_LABEL" = "true" ]; then backend=standard
else backend=standard; fi ;;
*) backend=both ;; # push / approval / schedule
esac
echo "backend=$backend" >> "$GITHUB_OUTPUT"
echo "Resolved lane='$lane' backend='$backend' (event=$EVENT)."
Loading
Loading