1
0

performance.yml 4.0 KB

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