summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorDeepak Dinesh <d.deepakdinesh13@gmail.com>2022-07-22 12:11:48 +0530
committerCarlton Gibson <carlton@noumenal.es>2022-09-06 17:58:07 +0200
commit982a970251bf2255a5fb587d3e953a2fcd563107 (patch)
treed68b658f481507a08a7f739714d206a55b0002d2 /.github
parent4a1150b41d1312feacd4316b2691227f5a509ae9 (diff)
downloaddjango-982a970251bf2255a5fb587d3e953a2fcd563107.tar.gz
Fixed #33862 -- Added workflow to run the ASV benchmarks for labeled PR.
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/benchmark.yml41
1 files changed, 41 insertions, 0 deletions
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml
new file mode 100644
index 0000000000..0bc65b9d10
--- /dev/null
+++ b/.github/workflows/benchmark.yml
@@ -0,0 +1,41 @@
+name: Benchmark
+
+on:
+ pull_request:
+ types: [ labeled, synchronize, opened, reopened ]
+
+permissions:
+ contents: read
+
+jobs:
+ Run_benchmarks:
+ if: contains(github.event.pull_request.labels.*.name, 'benchmark')
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout Benchmark Repo
+ uses: actions/checkout@v3
+ with:
+ repository: django/django-asv
+ path: "."
+ - name: Install Requirements
+ run: pip install -r requirements.txt
+ - name: Cache Django
+ uses: actions/cache@v3
+ with:
+ path: Django/*
+ key: Django
+ - name: Run Benchmarks
+ shell: bash -l {0}
+ run: |-
+ asv machine --machine ubuntu-latest --yes > /dev/null
+ echo 'Beginning benchmarks...'
+ asv continuous --interleave-processes -a processes=2 --split --show-stderr 'HEAD^' 'HEAD' |\
+ sed -n -E '/(before.*after.*ratio)|(BENCHMARKS)/,$p' >> out.txt
+ echo 'Benchmarks Done.'
+ echo '```' >> $GITHUB_STEP_SUMMARY
+ cat out.txt >> $GITHUB_STEP_SUMMARY
+ echo '```' >> $GITHUB_STEP_SUMMARY
+ if grep -q "PERFORMANCE DECREASED" out.txt;
+ then
+ exit 1
+ fi