phpunit-nodb.yml 4.1 KB

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