phpunit-nodb.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. # This is the testsuite running all non-database agnostic unit tests
  6. name: PHPUnit nodb
  7. on:
  8. pull_request:
  9. schedule:
  10. - cron: "5 2 * * *"
  11. permissions:
  12. contents: read
  13. concurrency:
  14. group: phpunit-nodb-${{ github.head_ref || github.run_id }}
  15. cancel-in-progress: true
  16. jobs:
  17. changes:
  18. runs-on: ubuntu-latest-low
  19. outputs:
  20. src: ${{ steps.changes.outputs.src }}
  21. steps:
  22. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  23. id: changes
  24. continue-on-error: true
  25. with:
  26. filters: |
  27. src:
  28. - '.github/workflows/**'
  29. - '3rdparty/**'
  30. - '**/appinfo/**'
  31. - '**/lib/**'
  32. - '**/templates/**'
  33. - '**/tests/**'
  34. - 'vendor/**'
  35. - 'vendor-bin/**'
  36. - '.php-cs-fixer.dist.php'
  37. - 'composer.json'
  38. - 'composer.lock'
  39. - '**.php'
  40. phpunit-nodb:
  41. runs-on: ubuntu-latest
  42. needs: changes
  43. if: needs.changes.outputs.src != 'false'
  44. strategy:
  45. matrix:
  46. php-versions: ['8.1', '8.2', '8.3']
  47. include:
  48. - php-versions: '8.2'
  49. coverage: ${{ github.event_name != 'pull_request' }}
  50. name: No DB unit tests (PHP ${{ matrix.php-versions }})
  51. services:
  52. cache:
  53. image: ghcr.io/nextcloud/continuous-integration-redis:latest
  54. ports:
  55. - 6379:6379/tcp
  56. options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
  57. steps:
  58. - name: Checkout server
  59. uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
  60. with:
  61. submodules: true
  62. - name: Set up php ${{ matrix.php-versions }}
  63. uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2
  64. with:
  65. php-version: ${{ matrix.php-versions }}
  66. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  67. extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
  68. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  69. ini-file: development
  70. # Required for tests that use pcntl
  71. ini-values: disable_functions=""
  72. env:
  73. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  74. - name: Set up dependencies
  75. run: composer i
  76. - name: Set up Nextcloud
  77. run: |
  78. mkdir data
  79. cp tests/redis.config.php config/
  80. cp tests/preseed-config.php config/config.php
  81. ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
  82. php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
  83. - name: PHPUnit nodb testsuite
  84. run: composer run test -- --exclude-group DB,SLOWDB ${{ matrix.coverage && ' --coverage-clover ./clover.nodb.xml' || '' }}
  85. - name: Upload nodb code coverage
  86. if: ${{ !cancelled() && matrix.coverage }}
  87. uses: codecov/codecov-action@v4.1.1
  88. with:
  89. files: ./clover.nodb.xml
  90. flags: phpunit-nodb
  91. - name: Print logs
  92. if: always()
  93. run: |
  94. cat data/nextcloud.log
  95. summary:
  96. permissions:
  97. contents: none
  98. runs-on: ubuntu-latest-low
  99. needs: [changes, phpunit-nodb]
  100. if: always()
  101. name: phpunit-nodb-summary
  102. steps:
  103. - name: Summary status
  104. run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-nodb.result != 'success' }}; then exit 1; fi