@@ -12,6 +12,7 @@ permissions:
1212 id-token : write
1313 deployments : write
1414 contents : write
15+ pull-requests : write
1516
1617concurrency :
1718 # Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
5859 apt-get upgrade -y
5960 apt-get -y install libglu1-mesa libgl1-mesa-glx libosmesa6 gcc curl g++ unzip wget libglfw3-dev libgles2-mesa-dev libglew-dev sudo git cmake libz-dev libpython3.10-dev
6061 - name : Setup git
61- run : git config --global --add safe.directory /__w/rl/rl
62+ run : |
63+ git config --global --add safe.directory /__w/rl/rl
64+ git config --global user.name "github-action-benchmark"
65+ git config --global user.email "github@users.noreply.github.com"
6266 - name : setup Path
6367 run : |
6468 echo /usr/local/bin >> $GITHUB_PATH
@@ -93,19 +97,85 @@ jobs:
9397 export COMPOSITE_LP_AGGREGATE=0
9498 export TD_GET_DEFAULTS_TO_NONE=1
9599 python3 -m pytest -vvv --rank 0 --benchmark-json output.json --ignore test_collectors_benchmark.py
96- - name : Store benchmark results
100+
101+ # Upload benchmark results for main branch, manual dispatch, or PRs with 'benchmarks/upload' label
102+ - name : Upload benchmark results
103+ uses : actions/upload-artifact@v4
104+ if : ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmarks/upload')) }}
105+ with :
106+ name : ${{ matrix.device }}-benchmark-results
107+ path : benchmarks/output.json
108+
109+ # Upload benchmark results to gh-pages branch (only for main, manual dispatch, or PRs with 'benchmarks/upload' label)
110+ benchmark-upload :
111+ name : Upload benchmark results
112+ runs-on : ubuntu-latest
113+ needs : benchmark
114+ if : ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmarks/upload')) }}
115+ steps :
116+ - name : Show upload trigger reason
117+ run : |
118+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
119+ echo "Uploading benchmarks because this is the main branch"
120+ elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
121+ echo "Uploading benchmarks because of manual workflow dispatch"
122+ elif [ "${{ github.event_name }}" == "pull_request" ]; then
123+ echo "Uploading benchmarks because PR has 'benchmarks/upload' label"
124+ fi
125+ - name : Checkout
126+ uses : actions/checkout@v4
127+ - name : Download CPU benchmark results
128+ uses : actions/download-artifact@v4
129+ with :
130+ name : CPU-benchmark-results
131+ path : cpu-results
132+ - name : Download GPU benchmark results
133+ uses : actions/download-artifact@v4
134+ with :
135+ name : GPU-benchmark-results
136+ path : gpu-results
137+ - name : Show benchmark results summary
138+ run : |
139+ echo "=== CPU Benchmark Results ==="
140+ if [ -f "cpu-results/output.json" ]; then
141+ echo "CPU results found and will be uploaded"
142+ else
143+ echo "No CPU results found"
144+ fi
145+
146+ echo "=== GPU Benchmark Results ==="
147+ if [ -f "gpu-results/output.json" ]; then
148+ echo "GPU results found and will be uploaded"
149+ else
150+ echo "No GPU results found"
151+ fi
152+ - name : Store CPU benchmark results
153+ uses : benchmark-action/github-action-benchmark@v1
154+ with :
155+ name : CPU Benchmark Results
156+ tool : ' pytest'
157+ output-file-path : cpu-results/output.json
158+ fail-on-alert : true
159+ alert-threshold : ' 200%'
160+ alert-comment-cc-users : ' @vmoens'
161+ # Disable PR comments to avoid permission issues with PR reviews
162+ comment-on-alert : false
163+ github-token : ${{ secrets.GITHUB_TOKEN }}
164+ gh-pages-branch : gh-pages
165+ auto-push : true
166+ - name : Store GPU benchmark results
97167 uses : benchmark-action/github-action-benchmark@v1
98- if : ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
99- env :
100- GIT_WORK_TREE : /__w/rl/rl
101168 with :
102- name : ${{ matrix.device }} Benchmark Results
169+ name : GPU Benchmark Results
103170 tool : ' pytest'
104- output-file-path : benchmarks /output.json
171+ output-file-path : gpu-results /output.json
105172 fail-on-alert : true
106173 alert-threshold : ' 200%'
107174 alert-comment-cc-users : ' @vmoens'
108- comment-on-alert : true
175+ # Disable PR comments to avoid permission issues with PR reviews
176+ comment-on-alert : false
109177 github-token : ${{ secrets.GITHUB_TOKEN }}
110178 gh-pages-branch : gh-pages
111179 auto-push : true
180+ # Use regular comments instead of PR reviews to avoid permission issues
181+ comment-style : ' github'
0 commit comments