performance.yml 3.6 KB

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