performance.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. env:
  25. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  26. - name: Set up Nextcloud
  27. run: |
  28. mkdir data
  29. ./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
  30. php -S localhost:8080 &
  31. - name: Apply blueprint
  32. uses: icewind1991/blueprint@v0.1.2
  33. with:
  34. blueprint: tests/blueprints/basic.toml
  35. ref: ${{ github.event.pull_request.head.ref }}
  36. - name: Run before measurements
  37. uses: nextcloud/profiler@fa03a1e6864fcb63fb92b8940fa72f5191baffbe
  38. with:
  39. run: |
  40. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  41. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  42. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  43. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  44. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  45. output: before.json
  46. - name: Apply PR
  47. run: |
  48. git fetch origin ${{ github.event.pull_request.head.ref }}
  49. git checkout ${{ github.event.pull_request.head.ref }}
  50. git submodule update
  51. ./occ upgrade
  52. - name: Run after measurements
  53. id: compare
  54. uses: nextcloud/profiler@fa03a1e6864fcb63fb92b8940fa72f5191baffbe
  55. with:
  56. run: |
  57. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  58. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  59. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  60. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  61. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  62. output: after.json
  63. compare-with: before.json
  64. - name: Upload profiles
  65. if: always()
  66. uses: actions/upload-artifact@v2
  67. with:
  68. name: profiles
  69. path: |
  70. before.json
  71. after.json
  72. - uses: actions/github-script@v5
  73. if: failure() && steps.compare.outcome == 'failure'
  74. with:
  75. github-token: ${{secrets.GITHUB_TOKEN}}
  76. script: |
  77. let comment = `Possible performance regression detected\n`;
  78. comment += `<details><summary>Show Output</summary>
  79. \`\`\`
  80. ${{ steps.compare.outputs.compare }}
  81. \`\`\`
  82. </details>`;
  83. github.rest.issues.createComment({
  84. issue_number: context.issue.number,
  85. owner: context.repo.owner,
  86. repo: context.repo.repo,
  87. body: comment
  88. })