benchmark.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. name: Benchmark
  2. on:
  3. pull_request:
  4. types: [ labeled, synchronize, opened, reopened ]
  5. permissions:
  6. contents: read
  7. jobs:
  8. Run_benchmarks:
  9. if: contains(github.event.pull_request.labels.*.name, 'benchmark')
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout Benchmark Repo
  13. uses: actions/checkout@v4
  14. with:
  15. repository: django/django-asv
  16. path: "."
  17. - name: Install Requirements
  18. run: pip install -r requirements.txt
  19. - name: Cache Django
  20. uses: actions/cache@v3
  21. with:
  22. path: Django/*
  23. key: Django
  24. - name: Run Benchmarks
  25. shell: bash -l {0}
  26. run: |-
  27. asv machine --machine ubuntu-latest --yes > /dev/null
  28. echo 'Beginning benchmarks...'
  29. asv continuous --interleave-processes -a processes=2 --split --show-stderr 'HEAD^' 'HEAD' |\
  30. sed -n -E '/(before.*after.*ratio)|(BENCHMARKS)/,$p' >> out.txt
  31. echo 'Benchmarks Done.'
  32. echo '```' >> $GITHUB_STEP_SUMMARY
  33. cat out.txt >> $GITHUB_STEP_SUMMARY
  34. echo '```' >> $GITHUB_STEP_SUMMARY
  35. if grep -q "PERFORMANCE DECREASED" out.txt;
  36. then
  37. exit 1
  38. fi