1
0

performance.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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: Disabled on forks
  20. if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
  21. run: |
  22. echo 'Can not run performance tests on forks'
  23. exit 1
  24. - name: Checkout server before PR
  25. uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
  26. with:
  27. submodules: true
  28. ref: ${{ github.event.pull_request.base.ref }}
  29. - name: Set up php ${{ matrix.php-versions }}
  30. uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 #v2.31.1
  31. with:
  32. php-version: ${{ matrix.php-versions }}
  33. 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
  34. env:
  35. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  36. - name: Set up Nextcloud
  37. run: |
  38. mkdir data
  39. ./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
  40. php -S localhost:8080 &
  41. - name: Apply blueprint
  42. uses: icewind1991/blueprint@v0.1.2
  43. with:
  44. blueprint: tests/blueprints/basic.toml
  45. ref: ${{ github.event.pull_request.head.ref }}
  46. - name: Run before measurements
  47. uses: nextcloud/profiler@6801ee10fc80f10b444388fb6ca9b36ad8a2ea83
  48. with:
  49. run: |
  50. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  51. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  52. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  53. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  54. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  55. output: before.json
  56. profiler-branch: master
  57. - name: Apply PR
  58. run: |
  59. git remote add pr '${{ github.event.pull_request.head.repo.clone_url }}'
  60. git fetch pr '${{ github.event.pull_request.head.ref }}'
  61. git checkout -b 'pr/${{ github.event.pull_request.head.ref }}'
  62. git submodule update
  63. ./occ upgrade
  64. - name: Run after measurements
  65. id: compare
  66. uses: nextcloud/profiler@6801ee10fc80f10b444388fb6ca9b36ad8a2ea83
  67. with:
  68. run: |
  69. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test
  70. curl -s -u test:test http://localhost:8080/remote.php/dav/files/test/test.txt
  71. curl -s -X PROPFIND -u test:test http://localhost:8080/remote.php/dav/files/test/many_files
  72. curl -s -u test:test -T README.md http://localhost:8080/remote.php/dav/files/test/new_file.txt
  73. curl -s -u test:test -X DELETE http://localhost:8080/remote.php/dav/files/test/new_file.txt
  74. output: after.json
  75. profiler-branch: master
  76. compare-with: before.json
  77. - name: Upload profiles
  78. if: always()
  79. uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
  80. with:
  81. name: profiles
  82. path: |
  83. before.json
  84. after.json
  85. - uses: actions/github-script@v7
  86. if: failure() && steps.compare.outcome == 'failure'
  87. with:
  88. github-token: ${{secrets.GITHUB_TOKEN}}
  89. script: |
  90. let comment = `Possible performance regression detected\n`;
  91. comment += `<details><summary>Show Output</summary>
  92. \`\`\`
  93. ${{ steps.compare.outputs.compare }}
  94. \`\`\`
  95. </details>`;
  96. github.rest.issues.createComment({
  97. issue_number: context.issue.number,
  98. owner: context.repo.owner,
  99. repo: context.repo.repo,
  100. body: comment
  101. })