You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

phpunit-pgsql.yml 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. name: PHPUnit pgsql
  6. on:
  7. pull_request:
  8. schedule:
  9. - cron: "5 2 * * *"
  10. permissions:
  11. contents: read
  12. concurrency:
  13. group: phpunit-pgsql-${{ github.head_ref || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. changes:
  17. runs-on: ubuntu-latest-low
  18. outputs:
  19. src: ${{ steps.changes.outputs.src }}
  20. steps:
  21. - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  22. id: changes
  23. continue-on-error: true
  24. with:
  25. filters: |
  26. src:
  27. - '.github/workflows/**'
  28. - '3rdparty/**'
  29. - '**/appinfo/**'
  30. - '**/lib/**'
  31. - '**/templates/**'
  32. - '**/tests/**'
  33. - 'vendor/**'
  34. - 'vendor-bin/**'
  35. - '.php-cs-fixer.dist.php'
  36. - 'composer.json'
  37. - 'composer.lock'
  38. - '**.php'
  39. phpunit-pgsql:
  40. runs-on: ubuntu-latest
  41. needs: changes
  42. if: needs.changes.outputs.src != 'false'
  43. strategy:
  44. matrix:
  45. php-versions: ['8.0']
  46. # To keep the matrix smaller we ignore PostgreSQL '11', '13', '14' as we already test 10 and 15 as lower and upper bound
  47. postgres-versions: ['10', '15', '16']
  48. include:
  49. - php-versions: '8.3'
  50. postgres-versions: '15'
  51. coverage: ${{ github.event_name != 'pull_request' }}
  52. name: PostgreSQL ${{ matrix.postgres-versions }} (PHP ${{ matrix.php-versions }}) - database tests
  53. services:
  54. cache:
  55. image: ghcr.io/nextcloud/continuous-integration-redis:latest
  56. ports:
  57. - 6379:6379/tcp
  58. options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
  59. postgres:
  60. image: ghcr.io/nextcloud/continuous-integration-postgres-${{ matrix.postgres-versions }}:latest
  61. ports:
  62. - 4444:5432/tcp
  63. env:
  64. POSTGRES_USER: root
  65. POSTGRES_PASSWORD: rootpassword
  66. POSTGRES_DB: nextcloud
  67. options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
  68. steps:
  69. - name: Checkout server
  70. uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
  71. with:
  72. submodules: true
  73. - name: Set up php ${{ matrix.php-versions }}
  74. uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
  75. with:
  76. php-version: ${{ matrix.php-versions }}
  77. # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
  78. extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
  79. coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
  80. ini-file: development
  81. env:
  82. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  83. - name: Set up dependencies
  84. run: composer i
  85. - name: Set up Nextcloud
  86. env:
  87. DB_PORT: 4444
  88. run: |
  89. mkdir data
  90. cp tests/redis.config.php config/
  91. cp tests/preseed-config.php config/config.php
  92. ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
  93. php -f tests/enable_all.php | grep -i -C9999 error && echo "Error during app setup" && exit 1 || exit 0
  94. - name: PHPUnit database tests
  95. run: composer run test:db ${{ matrix.coverage && ' -- --coverage-clover ./clover.db.xml' || '' }}
  96. - name: Upload db code coverage
  97. if: ${{ !cancelled() && matrix.coverage }}
  98. uses: codecov/codecov-action@v4.1.1
  99. with:
  100. files: ./clover.db.xml
  101. flags: phpunit-postgres
  102. - name: Run repair steps
  103. run: |
  104. ./occ maintenance:repair --include-expensive
  105. - name: Print logs
  106. if: always()
  107. run: |
  108. cat data/nextcloud.log
  109. summary:
  110. permissions:
  111. contents: none
  112. runs-on: ubuntu-latest-low
  113. needs: [changes, phpunit-pgsql]
  114. if: always()
  115. name: phpunit-pgsql-summary
  116. steps:
  117. - name: Summary status
  118. run: if ${{ needs.changes.outputs.src != 'false' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi