From 83ec7c5be72564074217180cb62d5860aff91a95 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Sun, 2 Feb 2025 14:18:48 +0300 Subject: [PATCH] updated CI to test on newer NC versions --- .github/workflows/analysis-coverage.yml | 343 ++---------------------- README.md | 23 +- 2 files changed, 21 insertions(+), 345 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index fd4aab87..bba12fc2 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -20,8 +20,7 @@ env: APP_PORT: 9009 NC_AUTH_USER: "admin" NC_AUTH_PASS: "adminpassword" - NEXTCLOUD_VERSION: 28.0.7 - NEXTCLOUD_BRANCH: stable28 + NEXTCLOUD_BRANCH: stable30 jobs: analysis: @@ -40,292 +39,10 @@ jobs: - name: Run Analysis run: python3 -m pylint "nc_py_api/" - tests-maria: - needs: [analysis] - runs-on: ubuntu-22.04 - name: 28.X.X • 🐘8.1 • 🐍3.10 • Maria - timeout-minutes: 60 - - services: - mariadb: - image: mariadb:11.5 - env: - MARIADB_ROOT_PASSWORD: rootpassword - MYSQL_DATABASE: nextcloud - options: >- - --health-cmd mysqladmin ping - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 3306:3306 - - steps: - - name: Set up php - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd - - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - - name: cache-nextcloud - id: nextcloud_setup - uses: actions/cache@v4 - with: - path: nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 - key: ${{ env.NEXTCLOUD_VERSION }} - - - name: Download Nextcloud - if: steps.nextcloud_setup.outputs.cache-hit != 'true' - run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 - - - name: Set up Nextcloud - run: | - tar -xjf nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 --strip-components 1 - mkdir data - php occ maintenance:install --verbose --database=mysql --database-name=nextcloud \ - --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass ${{ env.NC_AUTH_PASS }} - php occ config:system:set loglevel --value=1 --type=integer - php occ config:system:set debug --value=true --type=boolean - PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Checkout AppAPI - uses: actions/checkout@v4 - with: - path: apps/app_api - repository: nextcloud/app_api - ref: stable29 - - - name: Install AppAPI - run: | - php occ app:enable app_api - cd nc_py_api - coverage run --data-file=.coverage.ci_install tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - python3 tests/_app_security_checks.py http://127.0.0.1:$APP_PORT - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Checkout Talk - uses: actions/checkout@v4 - with: - path: apps/spreed - repository: nextcloud/spreed - ref: ${{ env.NEXTCLOUD_BRANCH }} - - - name: Install Talk - working-directory: apps/spreed - run: make dev-setup - - - name: Enable Talk - run: php occ app:enable spreed - - - name: Generate coverage report (1) - working-directory: nc_py_api - run: | - coverage run --data-file=.coverage.talk_bot tests/_talk_bot.py & - echo $! > /tmp/_talk_bot.pid - coverage run --data-file=.coverage.ci -m pytest - kill -15 $(cat /tmp/_talk_bot.pid) - timeout 3m tail --pid=$(cat /tmp/_talk_bot.pid) -f /dev/null - coverage run --data-file=.coverage.at_the_end -m pytest tests/_tests_at_the_end.py - - - name: Uninstall NcPyApi - run: | - php occ app_api:app:unregister "$APP_ID" --silent --force - php occ app_api:daemon:unregister manual_install - - - name: Generate coverage report (2) - working-directory: nc_py_api - run: | - coverage run --data-file=.coverage.ci_install_models tests/_install_init_handler_models.py & - echo $! > /tmp/_install_models.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install_models.pid) - timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null - cd nc_py_api - coverage combine && coverage xml -o coverage_maria_${{ env.NEXTCLOUD_VERSION }}_3.10_8.1.xml - - - name: Upload Codecov to artifacts - uses: actions/upload-artifact@v4 - with: - name: coverage_maria_${{ env.NEXTCLOUD_VERSION }}_3.10_8.1.xml - path: nc_py_api/coverage_maria_${{ env.NEXTCLOUD_VERSION }}_3.10_8.1.xml - if-no-files-found: error - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_log_maria_${{ env.NEXTCLOUD_VERSION }}_3.10_8.1 - path: data/nextcloud.log - if-no-files-found: warn - - tests-pgsql: - needs: [analysis] - runs-on: ubuntu-22.04 - name: 28.X.X • 🐘8.2 • 🐍3.11 • PgSQL - env: - NC_dbname: nextcloud_abz - DATABASE_PGSQL: 1 - timeout-minutes: 60 - - services: - postgres: - image: postgres:17 - env: - POSTGRES_USER: root - POSTGRES_PASSWORD: rootpassword - POSTGRES_DB: ${{ env.NC_dbname }} - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - steps: - - name: Set up php 8.2 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd - - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: cache-nextcloud - id: nextcloud_setup - uses: actions/cache@v4 - with: - path: nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 - key: ${{ env.NEXTCLOUD_VERSION }} - - - name: Download Nextcloud - if: steps.nextcloud_setup.outputs.cache-hit != 'true' - run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 - - - name: Set up Nextcloud - run: | - tar -xjf nextcloud-${{ env.NEXTCLOUD_VERSION }}.tar.bz2 --strip-components 1 - mkdir data - php occ maintenance:install --verbose --database=pgsql --database-name=${{ env.NC_dbname }} \ - --database-host=127.0.0.1 --database-user=root --database-pass=rootpassword \ - --admin-user admin --admin-pass ${{ env.NC_AUTH_PASS }} - php occ config:system:set loglevel --value=1 - php occ config:system:set debug --value=true --type=boolean - PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v4 - with: - path: nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Checkout AppAPI - uses: actions/checkout@v4 - with: - path: apps/app_api - repository: nextcloud/app_api - ref: stable29 - - - name: Install AppAPI - run: | - php occ app:enable app_api - cd nc_py_api - coverage run --data-file=.coverage.ci_install tests/_install.py & - echo $! > /tmp/_install.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - python3 tests/_app_security_checks.py http://127.0.0.1:$APP_PORT - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Checkout Talk - uses: actions/checkout@v4 - with: - path: apps/spreed - repository: nextcloud/spreed - ref: ${{ env.NEXTCLOUD_BRANCH }} - - - name: Install Talk - working-directory: apps/spreed - run: make dev-setup - - - name: Enable Talk - run: php occ app:enable spreed - - - name: Generate coverage report (1) - working-directory: nc_py_api - run: | - coverage run --data-file=.coverage.talk_bot tests/_talk_bot.py & - echo $! > /tmp/_talk_bot.pid - coverage run --data-file=.coverage.ci -m pytest - kill -15 $(cat /tmp/_talk_bot.pid) - timeout 3m tail --pid=$(cat /tmp/_talk_bot.pid) -f /dev/null - coverage run --data-file=.coverage.at_the_end -m pytest tests/_tests_at_the_end.py - - - name: Uninstall NcPyApi - run: | - php occ app_api:app:unregister "$APP_ID" --silent --force - php occ app_api:daemon:unregister manual_install - - - name: Generate coverage report (2) - working-directory: nc_py_api - run: | - coverage run --data-file=.coverage.ci_install_models tests/_install_init_handler_models.py & - echo $! > /tmp/_install_models.pid - python3 tests/_install_wait.py http://127.0.0.1:$APP_PORT/heartbeat "\"status\":\"ok\"" 15 0.5 - cd .. - sh nc_py_api/scripts/ci_register.sh "$APP_ID" "$APP_VERSION" "$APP_SECRET" "localhost" "$APP_PORT" - kill -15 $(cat /tmp/_install_models.pid) - timeout 3m tail --pid=$(cat /tmp/_install_models.pid) -f /dev/null - cd nc_py_api - coverage combine && coverage xml -o coverage_pgsql_${{ env.NEXTCLOUD_VERSION }}_3.11_8.2.xml - - - name: Upload Codecov to artifacts - uses: actions/upload-artifact@v4 - with: - name: coverage_pgsql_${{ env.NEXTCLOUD_VERSION }}_3.11_8.2.xml - path: nc_py_api/coverage_pgsql_${{ env.NEXTCLOUD_VERSION }}_3.11_8.2.xml - if-no-files-found: error - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: nc_log_pgsql_${{ env.NEXTCLOUD_VERSION }}_3.11_8.2 - path: data/nextcloud.log - if-no-files-found: warn - tests-oci: needs: [analysis] runs-on: ubuntu-22.04 - name: stable28 • 🐘8.1 • 🐍3.11 • OCI + name: stable30 • 🐍3.11 • OCI timeout-minutes: 60 services: @@ -393,7 +110,7 @@ jobs: with: path: apps/app_api repository: nextcloud/app_api - ref: stable29 + ref: ${{ env.NEXTCLOUD_BRANCH }} - name: Install AppAPI run: | @@ -413,33 +130,33 @@ jobs: run: | coverage run --data-file=.coverage.ci -m pytest coverage run --data-file=.coverage.at_the_end -m pytest tests/_tests_at_the_end.py - coverage combine && coverage xml -o coverage_oci_${{ env.NEXTCLOUD_BRANCH }}_3.11_8.1.xml + coverage combine && coverage xml -o coverage_oci_${{ env.NEXTCLOUD_BRANCH }}.xml env: SKIP_NC_CLIENT_TESTS: 1 - name: Upload Codecov to artifacts uses: actions/upload-artifact@v4 with: - name: coverage_oci_${{ env.NEXTCLOUD_BRANCH }}_3.11_8.1.xml - path: nc_py_api/coverage_oci_${{ env.NEXTCLOUD_BRANCH }}_3.11_8.1.xml + name: coverage_oci_${{ env.NEXTCLOUD_BRANCH }}.xml + path: nc_py_api/coverage_oci_${{ env.NEXTCLOUD_BRANCH }}.xml if-no-files-found: error - name: Upload NC logs if: always() uses: actions/upload-artifact@v4 with: - name: nc_log_oci_${{ env.NEXTCLOUD_BRANCH }}_3.11_8.1 + name: nc_log_oci_${{ env.NEXTCLOUD_BRANCH }} path: data/nextcloud.log if-no-files-found: warn - tests-latest-maria: + tests-maria: needs: [analysis] runs-on: ubuntu-22.04 - name: ${{ matrix.nextcloud }} • 🐘8.2 • 🐍3.10 • Maria + name: ${{ matrix.nextcloud }} • 🐍3.10 • Maria strategy: fail-fast: false matrix: - nextcloud: [ 'stable28', 'stable29', 'stable30' ] + nextcloud: [ 'stable30', 'stable31' ] timeout-minutes: 60 services: @@ -460,7 +177,7 @@ jobs: - name: Set up php uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.1' extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd, curl - uses: actions/setup-python@v5 @@ -524,20 +241,11 @@ jobs: run: python3 -m pip -v install ".[dev]" - name: Checkout AppAPI - if: ${{ matrix.nextcloud != 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api repository: nextcloud/app_api - ref: stable29 - - - name: Checkout AppAPI - if: ${{ matrix.nextcloud == 'stable30' }} - uses: actions/checkout@v4 - with: - path: apps/app_api - repository: nextcloud/app_api - ref: stable30 + ref: ${{ matrix.nextcloud }} - name: Install AppAPI run: | @@ -609,14 +317,14 @@ jobs: path: data/nextcloud.log if-no-files-found: warn - test-latest-pgsql: + tests-pgsql: needs: [analysis] runs-on: ubuntu-22.04 - name: ${{ matrix.nextcloud }} • 🐘8.2 • 🐍3.11 • PgSQL + name: ${{ matrix.nextcloud }} • 🐍3.11 • PgSQL strategy: fail-fast: false matrix: - nextcloud: [ 'stable28', 'stable29', 'stable30' ] + nextcloud: [ 'stable30', 'stable31' ] env: NC_dbname: nextcloud_abz DATABASE_PGSQL: 1 @@ -641,7 +349,7 @@ jobs: - name: Set up php uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.1' extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd - uses: actions/setup-python@v5 @@ -693,20 +401,11 @@ jobs: run: python3 -m pip -v install ".[dev]" - name: Checkout AppAPI - if: ${{ matrix.nextcloud != 'stable30' }} - uses: actions/checkout@v4 - with: - path: apps/app_api - repository: nextcloud/app_api - ref: stable29 - - - name: Checkout AppAPI - if: ${{ matrix.nextcloud == 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api repository: nextcloud/app_api - ref: stable30 + ref: ${{ matrix.nextcloud }} - name: Install AppAPI run: | @@ -790,7 +489,7 @@ jobs: strategy: fail-fast: false matrix: - nextcloud: [ 'stable27', 'stable28', 'stable29', 'stable30', 'master' ] + nextcloud: [ 'stable30', 'stable31' ] env: NEXTCLOUD_URL: "http://localhost:8080/index.php" timeout-minutes: 60 @@ -822,7 +521,6 @@ jobs: - name: Checkout Notes uses: actions/checkout@v4 - if: ${{ !startsWith(matrix.nextcloud, 'master') }} with: repository: nextcloud/notes ref: "main" @@ -830,7 +528,6 @@ jobs: - name: Checkout Files Locking uses: actions/checkout@v4 - if: ${{ !startsWith(matrix.nextcloud, 'stable27') && !startsWith(matrix.nextcloud, 'master') }} with: repository: nextcloud/files_lock ref: ${{ matrix.nextcloud }} @@ -850,11 +547,9 @@ jobs: PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & - name: Enable Notes - if: ${{ !startsWith(matrix.nextcloud, 'stable27') && !startsWith(matrix.nextcloud, 'master') }} run: ./occ app:enable notes - name: Enable Files Locking - if: ${{ !startsWith(matrix.nextcloud, 'stable27') && !startsWith(matrix.nextcloud, 'master') }} run: ./occ app:enable files_lock - name: Checkout NcPyApi @@ -889,7 +584,7 @@ jobs: if-no-files-found: warn tests-upload-coverage: - needs: [tests-maria, tests-pgsql, tests-oci, tests-latest-maria, test-latest-pgsql, tests-client-sqlite] + needs: [tests-maria, tests-pgsql, tests-oci, tests-client-sqlite] permissions: contents: none runs-on: ubuntu-22.04 diff --git a/README.md b/README.md index 1ecc7ca6..df408814 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Docs](https://github.com/cloud-py-api/nc_py_api/actions/workflows/docs.yml/badge.svg)](https://cloud-py-api.github.io/nc_py_api/) [![codecov](https://codecov.io/github/cloud-py-api/nc_py_api/branch/main/graph/badge.svg?token=C91PL3FYDQ)](https://codecov.io/github/cloud-py-api/nc_py_api) -![NextcloudVersion](https://img.shields.io/badge/Nextcloud-27%20%7C%2028%20%7C%2029%20%7C%2030-blue) +![NextcloudVersion](https://img.shields.io/badge/Nextcloud-%2028%20%7C%2029%20%7C%2030%20%7C%2031-blue) ![PythonVersion](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue) ![impl](https://img.shields.io/pypi/implementation/nc_py_api) ![pypi](https://img.shields.io/pypi/v/nc_py_api.svg) @@ -16,6 +16,7 @@ Python library that provides a robust and well-documented API that allows developers to interact with and extend Nextcloud's functionality. ### The key features are: + * **Fast**: High performance, and as low-latency as possible. * **Intuitive**: Fast to code, easy to use. * **Reliable**: Minimum number of incompatible changes. @@ -23,24 +24,6 @@ Python library that provides a robust and well-documented API that allows develo * **Easy**: Designed to be easy to use with excellent documentation. * **Sync + Async**: Provides both sync and async APIs. -### Capabilities -| **_Capability_** | Nextcloud 27 | Nextcloud 28 | Nextcloud 29 | Nextcloud 30 | -|------------------------------|:------------:|:------------:|:------------:|:------------:| -| Calendar | ✅ | ✅ | ✅ | ✅ | -| File System & Tags | ✅ | ✅ | ✅ | ✅ | -| Nextcloud Talk | ✅ | ✅ | ✅ | ✅ | -| Notifications | ✅ | ✅ | ✅ | ✅ | -| Shares | ✅ | ✅ | ✅ | ✅ | -| Users & Groups | ✅ | ✅ | ✅ | ✅ | -| User & Weather status | ✅ | ✅ | ✅ | ✅ | -| Other APIs** | ✅ | ✅ | ✅ | ✅ | -| Talk Bot API* | ✅ | ✅ | ✅ | ✅ | -| Settings UI API* | N/A | N/A | ✅ | ✅ | -| TaskProcessing Provider API* | N/A | N/A | N/A | ✅ | - -*_available only for **NextcloudApp**_
-**_Activity, Notes_ - ### Differences between the Nextcloud and NextcloudApp classes The **Nextcloud** class functions as a standard Nextcloud client, @@ -57,8 +40,6 @@ but NextcloudApp has a broader selection since applications typically require ac Any code written for the Nextcloud class can easily be adapted for use with the NextcloudApp class, as long as it doesn't involve calls that require user password verification. -**NextcloudApp** avalaible only from Nextcloud 27.1.2 and greater version with installed **AppAPI**. - ### Nextcloud skeleton app in Python ```python3