performance.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. name: Performance testing
  2. on:
  3. pull_request:
  4. jobs:
  5. performance-testing:
  6. runs-on: ubuntu-latest
  7. if: ${{ github.repository_owner != 'nextcloud-gmbh' }}
  8. strategy:
  9. fail-fast: false
  10. matrix:
  11. php-versions: ['8.0']
  12. name: performance-${{ matrix.php-versions }}
  13. steps:
  14. - name: Checkout server before PR
  15. uses: actions/checkout@v3
  16. with:
  17. submodules: true
  18. ref: ${{ github.event.pull_request.base.ref }}
  19. - name: Set up php ${{ matrix.php-versions }}
  20. uses: shivammathur/setup-php@v2
  21. with:
  22. php-version: ${{ matrix.php-versions }}
  23. tools: phpunit:9
  24. extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
  25. env:
  26. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  27. - name: Set up Nextcloud
  28. run: |
  29. mkdir data
  30. ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
  31. php -S localhost:8080 &
  32. - name: Apply blueprint
  33. uses: icewind1991/blueprint@v0.1.2
  34. with:
  35. blueprint: tests/blueprints/basic.toml
  36. ref: ${{ github.event.pull_request.head.ref }}
  37. - name: Run before measurements
  38. uses: nextcloud/profiler@1e66a9de5f76a01e9d1db4f0153bcc1cbf989b3d
  39. with:
  40. run: |
  41. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  42. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  43. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  44. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  45. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  46. output: before.json
  47. profiler-branch: stable26
  48. - name: Apply PR
  49. run: |
  50. git remote add pr ${{ github.event.pull_request.head.repo.clone_url }}
  51. git fetch pr ${{ github.event.pull_request.head.ref }}
  52. git checkout -b pr/${{ github.event.pull_request.head.ref }}
  53. git submodule update
  54. ./occ upgrade
  55. - name: Run after measurements
  56. id: compare
  57. uses: nextcloud/profiler@1e66a9de5f76a01e9d1db4f0153bcc1cbf989b3d
  58. with:
  59. run: |
  60. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  61. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  62. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  63. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  64. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  65. output: after.json
  66. profiler-branch: master
  67. compare-with: before.json
  68. - name: Upload profiles
  69. if: always()
  70. uses: actions/upload-artifact@v2
  71. with:
  72. name: profiles
  73. path: |
  74. before.json
  75. after.json
  76. - uses: actions/github-script@v5
  77. if: failure() && steps.compare.outcome == 'failure'
  78. with:
  79. github-token: ${{secrets.GITHUB_TOKEN}}
  80. script: |
  81. let comment = `Possible performance regression detected\n`;
  82. comment += `<details><summary>Show Output</summary>
  83. \`\`\`
  84. ${{ steps.compare.outputs.compare }}
  85. \`\`\`
  86. </details>`;
  87. github.rest.issues.createComment({
  88. issue_number: context.issue.number,
  89. owner: context.repo.owner,
  90. repo: context.repo.repo,
  91. body: comment
  92. })