|
| 1 | +# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +name: DAV integration tests |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: integration-caldav-${{ github.head_ref || github.run_id }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + changes: |
| 13 | + runs-on: ubuntu-latest-low |
| 14 | + |
| 15 | + outputs: |
| 16 | + src: ${{ steps.changes.outputs.src}} |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 |
| 20 | + id: changes |
| 21 | + continue-on-error: true |
| 22 | + with: |
| 23 | + filters: | |
| 24 | + src: |
| 25 | + - '.github/workflows/**' |
| 26 | + - '3rdparty/**' |
| 27 | + - '**/*.php' |
| 28 | + - '**/lib/**' |
| 29 | + - '**/tests/**' |
| 30 | + - '**/vendor-bin/**' |
| 31 | + - 'build/integration/**' |
| 32 | + - '.php-cs-fixer.dist.php' |
| 33 | + - 'composer.json' |
| 34 | + - 'composer.lock' |
| 35 | +
|
| 36 | + integration-caldav: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + needs: changes |
| 39 | + |
| 40 | + if: needs.changes.outputs.src != 'false' && github.repository_owner != 'nextcloud-gmbh' |
| 41 | + |
| 42 | + strategy: |
| 43 | + # do not stop on another job's failure |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + php-versions: ['8.3'] |
| 47 | + endpoint: ['old', 'new'] |
| 48 | + service: ['CalDAV', 'CardDAV'] |
| 49 | + |
| 50 | + name: ${{ matrix.service }} (${{ matrix.endpoint }} endpoint) php${{ matrix.php-versions }} |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Checkout server |
| 54 | + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 |
| 55 | + with: |
| 56 | + submodules: true |
| 57 | + |
| 58 | + - name: Set up php ${{ matrix.php-versions }} |
| 59 | + uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2 |
| 60 | + with: |
| 61 | + php-version: ${{ matrix.php-versions }} |
| 62 | + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation |
| 63 | + 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 |
| 64 | + coverage: 'none' |
| 65 | + ini-file: development |
| 66 | + env: |
| 67 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + |
| 69 | + - name: Set up Python |
| 70 | + uses: LizardByte/setup-python-action@master |
| 71 | + with: |
| 72 | + python-version: '2.7' |
| 73 | + |
| 74 | + - name: Set up CalDAVTester |
| 75 | + run: | |
| 76 | + git clone --depth=1 https://github.com/apple/ccs-caldavtester.git CalDAVTester |
| 77 | + git clone --depth=1 https://github.com/apple/ccs-pycalendar.git pycalendar |
| 78 | +
|
| 79 | + - name: Set up Nextcloud |
| 80 | + run: | |
| 81 | + mkdir data |
| 82 | + ./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 admin |
| 83 | + # disable the trashbin, so recurrent deletion of the same object works |
| 84 | + ./occ config:app:set dav calendarRetentionObligation --value=0 |
| 85 | + # Prepare users |
| 86 | + OC_PASS=user01 ./occ user:add --password-from-env user01 |
| 87 | + OC_PASS=user02 ./occ user:add --password-from-env user02 |
| 88 | + # Prepare calendars |
| 89 | + ./occ dav:create-calendar user01 calendar |
| 90 | + ./occ dav:create-calendar user01 shared |
| 91 | + ./occ dav:create-calendar user02 calendar |
| 92 | + # Prepare address books |
| 93 | + ./occ dav:create-addressbook user01 addressbook |
| 94 | + ./occ dav:create-addressbook user02 addressbook |
| 95 | +
|
| 96 | + - name: Run Nextcloud |
| 97 | + run: | |
| 98 | + php -S localhost:8888 & |
| 99 | +
|
| 100 | + - name: Run CalDAVTester |
| 101 | + run: | |
| 102 | + cp "apps/dav/tests/travis/caldavtest/serverinfo-${{ matrix.endpoint }}${{ matrix.endpoint == 'old' && (matrix.service == 'CardDAV' && '-carddav' || '-caldav') || '' }}-endpoint.xml" "apps/dav/tests/travis/caldavtest/serverinfo.xml" |
| 103 | + pushd CalDAVTester |
| 104 | + PYTHONPATH="../pycalendar/src" python testcaldav.py --print-details-onfail --basedir "../apps/dav/tests/travis/caldavtest" -o cdt.txt \ |
| 105 | + "${{ matrix.service }}/current-user-principal.xml" \ |
| 106 | + "${{ matrix.service }}/sync-report.xml" \ |
| 107 | + ${{ matrix.endpoint == 'new' && format('{0}/sharing-{1}.xml', matrix.service, matrix.service == 'CalDAV' && 'calendars' || 'addressbooks') || ';' }} |
| 108 | + popd |
| 109 | +
|
| 110 | + - name: Print Nextcloud logs |
| 111 | + if: always() |
| 112 | + run: | |
| 113 | + cat data/nextcloud.log |
| 114 | +
|
| 115 | + caldav-integration-summary: |
| 116 | + permissions: |
| 117 | + contents: none |
| 118 | + runs-on: ubuntu-latest-low |
| 119 | + needs: [changes, integration-caldav] |
| 120 | + |
| 121 | + if: always() |
| 122 | + |
| 123 | + steps: |
| 124 | + - name: Summary status |
| 125 | + run: if ${{ needs.changes.outputs.src != 'false' && needs.integration-caldav.result != 'success' }}; then exit 1; fi |
0 commit comments