performance.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 remote add pr ${{ github.event.pull_request.head.repo.clone_url }}
  47. git fetch pr ${{ github.event.pull_request.head.ref }}
  48. git checkout -b pr/${{ github.event.pull_request.head.ref }}
  49. git submodule update
  50. ./occ upgrade
  51. - name: Run after measurements
  52. id: compare
  53. uses: nextcloud/profiler@fa03a1e6864fcb63fb92b8940fa72f5191baffbe
  54. with:
  55. run: |
  56. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  57. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  58. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  59. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  60. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  61. output: after.json
  62. compare-with: before.json
  63. - name: Upload profiles
  64. if: always()
  65. uses: actions/upload-artifact@v2
  66. with:
  67. name: profiles
  68. path: |
  69. before.json
  70. after.json
  71. - uses: actions/github-script@v5
  72. if: failure() && steps.compare.outcome == 'failure'
  73. with:
  74. github-token: ${{secrets.GITHUB_TOKEN}}
  75. script: |
  76. let comment = `Possible performance regression detected\n`;
  77. comment += `<details><summary>Show Output</summary>
  78. \`\`\`
  79. ${{ steps.compare.outputs.compare }}
  80. \`\`\`
  81. </details>`;
  82. github.rest.issues.createComment({
  83. issue_number: context.issue.number,
  84. owner: context.repo.owner,
  85. repo: context.repo.repo,
  86. body: comment
  87. })