1
0

performance.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  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@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
  24. with:
  25. php-version: ${{ matrix.php-versions }}
  26. extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
  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@6801ee10fc80f10b444388fb6ca9b36ad8a2ea83
  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: stable29
  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@6801ee10fc80f10b444388fb6ca9b36ad8a2ea83
  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: stable29
  69. compare-with: before.json
  70. - name: Upload profiles
  71. if: always()
  72. uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
  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. })