Skip to content

Commit 3a2bfb3

Browse files
committed
[CI] Add path-based triggers for niche workflows
Make expensive/niche workflows conditional on labels to reduce CI costs: - docs.yml: Only builds docs on PRs when Documentation or tutorials/ label is present. Always builds on push to main/nightly/release. - benchmarks_pr.yml: Only runs benchmarks when Performance or benchmarks/upload label is present. This is expensive (GPU, runs twice). - test-linux-sota.yml: Only runs SOTA tests when sota-implementations/ label is present. Always runs on push to main/nightly/release. Labels are auto-applied by the file-based labeler (auto-labeler.yml) when relevant files change, so developers don't need to manually add them. Core library tests (test-linux.yml) continue to run on all PRs since components are interconnected (e.g., replay buffers affect collectors). ghstack-source-id: cfcd503 Pull-Request: #3403
1 parent 4788068 commit 3a2bfb3

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.github/workflows/benchmarks_pr.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
# Continuous benchmarking for PRs
2+
#
3+
# Only runs when Performance or benchmarks/upload label is present.
4+
# This is expensive (GPU, runs twice for CPU/GPU comparison).
5+
# Add the label manually or use [Performance] prefix in PR title.
16
name: Continuous Benchmark (PR)
27
on:
38
pull_request:
9+
types: [opened, synchronize, labeled]
410

511
permissions: write-all
612

@@ -13,6 +19,11 @@ concurrency:
1319
jobs:
1420

1521
benchmark:
22+
# Only run benchmarks when Performance or benchmarks/upload label is present
23+
if: |
24+
contains(github.event.pull_request.labels.*.name, 'Performance') ||
25+
contains(github.event.pull_request.labels.*.name, 'performance') ||
26+
contains(github.event.pull_request.labels.*.name, 'benchmarks/upload')
1627
name: ${{ matrix.device }} Pytest benchmark
1728
runs-on: linux.g5.4xlarge.nvidia.gpu
1829
strategy:

.github/workflows/docs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# This workflow builds the torchrl docs and deploys them to gh-pages.
2+
#
3+
# For PRs, docs are only built when the Documentation or tutorials/ label is present.
4+
# This is auto-applied by the file-based labeler when doc files change.
5+
# Always builds on push to main/nightly/release branches and tags.
26
name: Generate documentation
37
on:
48
push:
@@ -10,6 +14,7 @@ on:
1014
- v[0-9]+.[0-9]+.[0-9]
1115
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
1216
pull_request:
17+
types: [opened, synchronize, labeled]
1318
workflow_dispatch:
1419

1520
concurrency:
@@ -24,6 +29,13 @@ permissions:
2429

2530
jobs:
2631
build-docs:
32+
# For PRs, only build docs when Documentation or tutorials/ label is present
33+
# Always build on push (main/nightly/release/tags) and workflow_dispatch
34+
if: |
35+
github.event_name == 'push' ||
36+
github.event_name == 'workflow_dispatch' ||
37+
contains(github.event.pull_request.labels.*.name, 'Documentation') ||
38+
contains(github.event.pull_request.labels.*.name, 'tutorials/')
2739
strategy:
2840
matrix:
2941
python_version: [ "3.12" ]

.github/workflows/test-linux-sota.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
# SOTA (State-of-the-Art) implementation tests
2+
#
3+
# For PRs, only runs when sota-implementations/ label is present.
4+
# This is auto-applied by the file-based labeler when sota files change.
5+
# Always runs on push to main/nightly/release branches.
16
name: SOTA Tests on Linux
27

38
on:
49
pull_request:
10+
types: [opened, synchronize, labeled]
511
push:
612
branches:
713
- nightly
@@ -24,6 +30,12 @@ permissions:
2430

2531
jobs:
2632
tests:
33+
# For PRs, only run when sota-implementations/ label is present
34+
# Always run on push (main/nightly/release) and workflow_dispatch
35+
if: |
36+
github.event_name == 'push' ||
37+
github.event_name == 'workflow_dispatch' ||
38+
contains(github.event.pull_request.labels.*.name, 'sota-implementations/')
2739
strategy:
2840
matrix:
2941
python_version: ["3.10"]

0 commit comments

Comments
 (0)