benchmark.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: Setup Miniforge
  18. uses: conda-incubator/setup-miniconda@v3
  19. with:
  20. miniforge-version: "24.1.2-0"
  21. activate-environment: asv-bench
  22. - name: Install Requirements
  23. run: pip install -r requirements.txt
  24. - name: Cache Django
  25. uses: actions/cache@v3
  26. with:
  27. path: Django/*
  28. key: Django
  29. - name: Run Benchmarks
  30. shell: bash -l {0}
  31. run: |-
  32. asv machine --machine ubuntu-latest --yes > /dev/null
  33. echo 'Beginning benchmarks...'
  34. asv continuous --interleave-processes -a processes=2 --split --show-stderr 'HEAD^' 'HEAD' |\
  35. sed -n -E '/(before.*after.*ratio)|(BENCHMARKS)/,$p' >> out.txt
  36. echo 'Benchmarks Done.'
  37. echo '```' >> $GITHUB_STEP_SUMMARY
  38. cat out.txt >> $GITHUB_STEP_SUMMARY
  39. echo '```' >> $GITHUB_STEP_SUMMARY
  40. if grep -q "PERFORMANCE DECREASED" out.txt;
  41. then
  42. exit 1
  43. fi