Skip to content

Commit 01dc3c8

Browse files
feanilclaude
andcommitted
build: only collect per-test timing data on master pushes
The --report-log flag adds overhead (writing a JSONL file for every test) that's only useful for rebalancing work. Skip it entirely on PR runs by conditionally setting the flag via an env var; also gate the upload step on master so artifacts aren't created unnecessarily. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 48f0199 commit 01dc3c8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/unit-tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,20 @@ jobs:
111111
shell: bash
112112
run: |
113113
echo "unit_test_paths=$(python scripts/unit_test_shards_parser.py --shard-name=${{ matrix.shard_name }} )" >> $GITHUB_ENV
114+
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
115+
echo "report_log_arg=--report-log=reports/pytest-report-${{ matrix.shard_name }}.jsonl" >> $GITHUB_ENV
116+
else
117+
echo "report_log_arg=" >> $GITHUB_ENV
118+
fi
114119
115120
- name: run tests
116121
shell: bash
117122
run: |
118123
python -Wd -m pytest -p no:randomly --ds=${{ env.settings_path }} ${{ env.unit_test_paths }} --cov=. \
119-
--report-log=reports/pytest-report-${{ matrix.shard_name }}.jsonl
124+
${{ env.report_log_arg }}
120125
121126
- name: Upload pytest timing report
122-
if: always()
127+
if: github.ref == 'refs/heads/master'
123128
uses: actions/upload-artifact@v7
124129
with:
125130
name: pytest-report-${{ matrix.shard_name }}-${{ matrix.python-version }}-${{ matrix.django-version }}-${{ matrix.mongo-version }}-${{ matrix.os-version }}

0 commit comments

Comments
 (0)