Repository navigation
90 lines (87 loc) · 4.26 KB
/
Copy path_decide.yml
File metadata and controls
90 lines (87 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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 (nightly or release-branch push) | skip (non-approval review)
# suite: trt-api when the opt-in `ci:trt-api` label is present; otherwise empty
# 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 }}
suite:
description: "Explicit manual suite, or empty for lane selection"
value: ${{ jobs.decide.outputs.suite }}
jobs:
decide:
runs-on: ubuntu-latest
outputs:
lane: ${{ steps.pick.outputs.lane }}
backend: ${{ steps.pick.outputs.backend }}
suite: ${{ steps.pick.outputs.suite }}
steps:
- id: pick
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
REVIEW_STATE: ${{ github.event.review.state }}
# Lane labels (consolidated): `ci: full` runs all tiers (L0+L1+L2);
# `ci: nightly` also adds the nightly-only suites. Neither → fast (L0
# smoke) on PR pushes. (The old `Force All Tests[L0+L1+L2]` label is gone.)
HAS_FULL_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci: full') }}"
HAS_NIGHTLY_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci: nightly') }}"
HAS_TRT_API_LABEL: "${{ contains(github.event.pull_request.labels.*.name, 'ci:trt-api') }}"
# Backend labels narrow the engine; on a full/nightly run their absence
# means BOTH. Exact 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)
case "$REF" in
refs/heads/nightly) lane=nightly ;;
refs/heads/release/*) lane=nightly ;;
*) lane=full ;;
esac ;;
pull_request_review)
[ "$REVIEW_STATE" = "approved" ] && lane=full || lane=skip ;;
pull_request)
if [ "$HAS_NIGHTLY_LABEL" = "true" ]; then lane=nightly
elif [ "$HAS_FULL_LABEL" = "true" ]; then lane=full
else lane=fast; fi ;;
*) lane=fast ;;
esac
echo "lane=$lane" >> "$GITHUB_OUTPUT"
suite=""
if [ "$EVENT" = "pull_request" ] && [ "$HAS_TRT_API_LABEL" = "true" ]; then
suite=trt-api
fi
echo "suite=$suite" >> "$GITHUB_OUTPUT"
# Backend: explicit labels win; otherwise a fast PR push stays
# standard-only (cheap), while full/nightly default to BOTH engines.
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
elif [ -n "$suite" ]; then backend=both
elif [ "$lane" = "fast" ]; then backend=standard
else backend=both; fi ;;
*) backend=both ;; # push / approval / schedule
esac
echo "backend=$backend" >> "$GITHUB_OUTPUT"
echo "Resolved lane='$lane' suite='$suite' backend='$backend' (event=$EVENT)."