performance.yml 4.1 KB

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