From b6863a081a730863fc888f7bd7c28edc34a3ba19 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 16:29:27 +0300 Subject: [PATCH 01/11] new AppEcosystem fix Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 74fb6c69..154f10ad 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -23,6 +23,7 @@ on: env: NEXTCLOUD_URL: "http://localhost:8080/index.php" APP_ID: "nc_py_api" + APP_PORT: 9009 APP_VERSION: "1.0.0" APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E" NC_AUTH_USER: "admin" @@ -137,10 +138,8 @@ jobs: sleep 5s php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ --net=host --host="127.0.0.1" --expose="local" - php occ app_ecosystem_v2:app:register $APP_ID $APP_VERSION "NcPyApi" \ - --daemon-config-id 1 \ - --port 9002 \ - --secret $APP_SECRET \ + php occ app_ecosystem_v2:app:register \ + "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -e --force-scopes --system-app kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null @@ -266,10 +265,8 @@ jobs: sleep 5s php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ --net=host --host="127.0.0.1" --expose="local" - php occ app_ecosystem_v2:app:register $APP_ID $APP_VERSION "NcPyApi" \ - --daemon-config-id 1 \ - --port 9002 \ - --secret $APP_SECRET \ + php occ app_ecosystem_v2:app:register \ + "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -e --force-scopes --system-app kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null @@ -388,10 +385,8 @@ jobs: sleep 5s php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ --net=host --host="127.0.0.1" --expose="local" - php occ app_ecosystem_v2:app:register $APP_ID $APP_VERSION "NcPyApi" \ - --daemon-config-id 1 \ - --port 9002 \ - --secret $APP_SECRET \ + php occ app_ecosystem_v2:app:register \ + "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -e --force-scopes --system-app kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null From cd24063518a3f05ec1485ddaeef47ffe199f3f90 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 16:36:49 +0300 Subject: [PATCH 02/11] new AppEcosystem fix(2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 242 ++++++++++++------------ tests/_install.py | 28 ++- 2 files changed, 141 insertions(+), 129 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 154f10ad..273319e3 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -298,124 +298,124 @@ jobs: path: data/nextcloud.log if-no-files-found: warn - tests-oci: - needs: [analysis] - runs-on: ubuntu-22.04 - name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • OCI - strategy: - fail-fast: false - matrix: - nextcloud: [ "27.0.0" ] - python: [ "3.11" ] - php-version: [ "8.2" ] - - services: - oracle: - image: ghcr.io/gvenzl/oracle-xe:11 - env: - ORACLE_RANDOM_PASSWORD: true - APP_USER: useroracle - APP_USER_PASSWORD: userpassword - options: >- - --health-cmd healthcheck.sh - --health-interval 10s - --health-timeout 5s - --health-retries 10 - ports: - - 1521:1521/tcp - - steps: - - name: Set up php - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \ - posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 - - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: cache-nextcloud - id: nextcloud_setup - uses: actions/cache@v3 - with: - path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 - key: ${{ matrix.nextcloud }} - - - name: Download Nextcloud - if: steps.nextcloud_setup.outputs.cache-hit != 'true' - run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 - - - name: Set up Nextcloud - run: | - tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 - mkdir data - php occ maintenance:install --verbose --database=oci --database-name=XE \ - --database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \ - --admin-user admin --admin-pass admin - php occ config:system:set loglevel --value=1 --type=integer - php occ config:system:set debug --value=true --type=boolean - php occ config:system:set allow_local_remote_servers --value true - php -S localhost:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v3 - with: - path: nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Checkout AppEcosystemV2 - uses: actions/checkout@v3 - with: - path: apps/app_ecosystem_v2 - repository: cloud-py-api/app_ecosystem_v2 - - - name: Install AppEcosystemV2 - run: | - patch -p 1 -i apps/app_ecosystem_v2/base_php.patch - php occ app:enable app_ecosystem_v2 - cd nc_py_api - coverage run --data-file=.coverage.ci_install tests/_install.py & - echo $! > /tmp/_install.pid - cd .. - sleep 5s - php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ - --net=host --host="127.0.0.1" --expose="local" - php occ app_ecosystem_v2:app:register \ - "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ - -e --force-scopes --system-app - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Generate coverage report - working-directory: nc_py_api - run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html - env: - SKIP_NC_WO_AE: 1 - - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 - with: - name: coverage_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: nc_py_api/htmlcov - if-no-files-found: error - - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: nc_py_api/coverage.xml - fail_ci_if_error: true - verbose: true - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: nc_log_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: data/nextcloud.log - if-no-files-found: warn +# tests-oci: +# needs: [analysis] +# runs-on: ubuntu-22.04 +# name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • OCI +# strategy: +# fail-fast: false +# matrix: +# nextcloud: [ "27.0.0" ] +# python: [ "3.11" ] +# php-version: [ "8.2" ] +# +# services: +# oracle: +# image: ghcr.io/gvenzl/oracle-xe:11 +# env: +# ORACLE_RANDOM_PASSWORD: true +# APP_USER: useroracle +# APP_USER_PASSWORD: userpassword +# options: >- +# --health-cmd healthcheck.sh +# --health-interval 10s +# --health-timeout 5s +# --health-retries 10 +# ports: +# - 1521:1521/tcp +# +# steps: +# - name: Set up php +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php-version }} +# extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \ +# posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 +# +# - uses: actions/setup-python@v4 +# with: +# python-version: ${{ matrix.python }} +# +# - name: cache-nextcloud +# id: nextcloud_setup +# uses: actions/cache@v3 +# with: +# path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 +# key: ${{ matrix.nextcloud }} +# +# - name: Download Nextcloud +# if: steps.nextcloud_setup.outputs.cache-hit != 'true' +# run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 +# +# - name: Set up Nextcloud +# run: | +# tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 +# mkdir data +# php occ maintenance:install --verbose --database=oci --database-name=XE \ +# --database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \ +# --admin-user admin --admin-pass admin +# php occ config:system:set loglevel --value=1 --type=integer +# php occ config:system:set debug --value=true --type=boolean +# php occ config:system:set allow_local_remote_servers --value true +# php -S localhost:8080 & +# +# - name: Checkout NcPyApi +# uses: actions/checkout@v3 +# with: +# path: nc_py_api +# +# - name: Install NcPyApi +# working-directory: nc_py_api +# run: python3 -m pip -v install ".[dev]" +# +# - name: Checkout AppEcosystemV2 +# uses: actions/checkout@v3 +# with: +# path: apps/app_ecosystem_v2 +# repository: cloud-py-api/app_ecosystem_v2 +# +# - name: Install AppEcosystemV2 +# run: | +# patch -p 1 -i apps/app_ecosystem_v2/base_php.patch +# php occ app:enable app_ecosystem_v2 +# cd nc_py_api +# coverage run --data-file=.coverage.ci_install tests/_install.py & +# echo $! > /tmp/_install.pid +# cd .. +# sleep 5s +# php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ +# --net=host --host="127.0.0.1" --expose="local" +# php occ app_ecosystem_v2:app:register \ +# "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ +# -e --force-scopes --system-app +# kill -15 $(cat /tmp/_install.pid) +# timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null +# +# - name: Generate coverage report +# working-directory: nc_py_api +# run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html +# env: +# SKIP_NC_WO_AE: 1 +# +# - name: HTML coverage to artifacts +# uses: actions/upload-artifact@v3 +# with: +# name: coverage_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} +# path: nc_py_api/htmlcov +# if-no-files-found: error +# +# - name: Upload report to Codecov +# uses: codecov/codecov-action@v3 +# with: +# token: ${{ secrets.CODECOV_TOKEN }} +# file: nc_py_api/coverage.xml +# fail_ci_if_error: true +# verbose: true +# +# - name: Upload NC logs +# if: always() +# uses: actions/upload-artifact@v3 +# with: +# name: nc_log_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} +# path: data/nextcloud.log +# if-no-files-found: warn diff --git a/tests/_install.py b/tests/_install.py index 8daf7a33..15fc11c4 100644 --- a/tests/_install.py +++ b/tests/_install.py @@ -1,6 +1,7 @@ +from os import environ + import uvicorn from fastapi import FastAPI -import urllib3 from nc_py_api import NextcloudApp, set_enabled_handler, ApiScope, set_scopes @@ -15,13 +16,24 @@ def enabled_handler(enabled: bool, _nc: NextcloudApp) -> str: @APP.on_event("startup") def initialization(): set_enabled_handler(APP, enabled_handler) - set_scopes(APP, { - "required": [ApiScope.SYSTEM, ApiScope.DAV, ApiScope.USER_INFO, ApiScope.USER_STATUS, - ApiScope.NOTIFICATIONS, ApiScope.WEATHER_STATUS], - "optional": [] - }) + set_scopes( + APP, + { + "required": [ + ApiScope.SYSTEM, + ApiScope.DAV, + ApiScope.USER_INFO, + ApiScope.USER_STATUS, + ApiScope.NOTIFICATIONS, + ApiScope.WEATHER_STATUS, + ], + "optional": [], + }, + ) if __name__ == "__main__": - urllib3.disable_warnings() - uvicorn.run("_install:APP", host="0.0.0.0", port=9002, log_level='trace') + app_host = environ.get("APP_HOST", "") + uvicorn.run( + "_install:APP", host=app_host if app_host else "0.0.0.0", port=int(environ["APP_PORT"]), log_level="trace" + ) From 385629c529de2b51ec25e49754e7c2d9ff028e8c Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 16:45:01 +0300 Subject: [PATCH 03/11] new AppEcosystem fix(2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 273319e3..62a3a9d1 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -265,6 +265,7 @@ jobs: sleep 5s php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ --net=host --host="127.0.0.1" --expose="local" + echo "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" php occ app_ecosystem_v2:app:register \ "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -e --force-scopes --system-app From 89fcf6aac16a70b84e928604f3185f5ee2487df5 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 17:50:09 +0300 Subject: [PATCH 04/11] new AppEcosystem fix(2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 290 ++++++++++++------------ 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 62a3a9d1..63f5a20f 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -30,25 +30,25 @@ env: NC_AUTH_PASS: "adminpassword" jobs: - analysis: - runs-on: macos-12 - name: Analysis - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.9" - - - name: Install from source - run: python3 -m pip install ".[dev]" wheel - - - name: Run Analysis - run: python3 -m pylint "setup.py" "nc_py_api/" +# analysis: +# runs-on: macos-12 +# name: Analysis +# +# steps: +# - uses: actions/checkout@v3 +# +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.9" +# +# - name: Install from source +# run: python3 -m pip install ".[dev]" wheel +# +# - name: Run Analysis +# run: python3 -m pylint "setup.py" "nc_py_api/" tests-maria: - needs: [analysis] +# needs: [analysis] runs-on: ubuntu-22.04 name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • Maria strategy: @@ -139,7 +139,7 @@ jobs: php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ --net=host --host="127.0.0.1" --expose="local" php occ app_ecosystem_v2:app:register \ - "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ + "{\"appid\":\"$APP_ID\",\"name\":\"$APP_ID\",\"daemon_config_id\":1,\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"port\":$APP_PORT}" \ -e --force-scopes --system-app kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null @@ -171,133 +171,133 @@ jobs: path: data/nextcloud.log if-no-files-found: warn - tests-pgsql: - needs: [analysis] - runs-on: ubuntu-22.04 - name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • PgSQL - strategy: - fail-fast: false - matrix: - nextcloud: [ "26.0.3" ] - python: [ "3.11" ] - php-version: [ "8.1" ] - include: - - nextcloud: "27.0.0" - python: "3.10" - php-version: "8.2" - env: - NC_dbname: nextcloud_abz - - services: - postgres: - image: postgres:15 - 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 ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd - - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - - name: cache-nextcloud - id: nextcloud_setup - uses: actions/cache@v3 - with: - path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 - key: ${{ matrix.nextcloud }} - - - name: Download Nextcloud - if: steps.nextcloud_setup.outputs.cache-hit != 'true' - run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 - - - name: Set up Nextcloud - run: | - tar -xjf nextcloud-${{ matrix.nextcloud }}.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 adminpassword - php occ config:system:set loglevel --value=1 - php occ config:system:set debug --value=true --type=boolean - php occ config:system:set allow_local_remote_servers --value true - php -S localhost:8080 & - - - name: Checkout NcPyApi - uses: actions/checkout@v3 - with: - path: nc_py_api - - - name: Install NcPyApi - working-directory: nc_py_api - run: python3 -m pip -v install ".[dev]" - - - name: Checkout AppEcosystemV2 - uses: actions/checkout@v3 - if: ${{ !startsWith(matrix.nextcloud, '26.') }} - with: - path: apps/app_ecosystem_v2 - repository: cloud-py-api/app_ecosystem_v2 - - - name: Install AppEcosystemV2 - if: ${{ !startsWith(matrix.nextcloud, '26.') }} - run: | - patch -p 1 -i apps/app_ecosystem_v2/base_php.patch - php occ app:enable app_ecosystem_v2 - cd nc_py_api - coverage run --data-file=.coverage.ci_install tests/_install.py & - echo $! > /tmp/_install.pid - cd .. - sleep 5s - php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ - --net=host --host="127.0.0.1" --expose="local" - echo "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" - php occ app_ecosystem_v2:app:register \ - "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ - -e --force-scopes --system-app - kill -15 $(cat /tmp/_install.pid) - timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - - name: Generate coverage report - working-directory: nc_py_api - run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html - - - name: HTML coverage to artifacts - uses: actions/upload-artifact@v3 - with: - name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: nc_py_api/htmlcov - if-no-files-found: error - - - name: Upload report to Codecov - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: nc_py_api/coverage.xml - fail_ci_if_error: true - verbose: true - - - name: Upload NC logs - if: always() - uses: actions/upload-artifact@v3 - with: - name: nc_log_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} - path: data/nextcloud.log - if-no-files-found: warn +# tests-pgsql: +# needs: [analysis] +# runs-on: ubuntu-22.04 +# name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • PgSQL +# strategy: +# fail-fast: false +# matrix: +# nextcloud: [ "26.0.3" ] +# python: [ "3.11" ] +# php-version: [ "8.1" ] +# include: +# - nextcloud: "27.0.0" +# python: "3.10" +# php-version: "8.2" +# env: +# NC_dbname: nextcloud_abz +# +# services: +# postgres: +# image: postgres:15 +# 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 ${{ matrix.php-version }} +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php-version }} +# extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd +# +# - uses: actions/setup-python@v4 +# with: +# python-version: ${{ matrix.python }} +# +# - name: cache-nextcloud +# id: nextcloud_setup +# uses: actions/cache@v3 +# with: +# path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 +# key: ${{ matrix.nextcloud }} +# +# - name: Download Nextcloud +# if: steps.nextcloud_setup.outputs.cache-hit != 'true' +# run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 +# +# - name: Set up Nextcloud +# run: | +# tar -xjf nextcloud-${{ matrix.nextcloud }}.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 adminpassword +# php occ config:system:set loglevel --value=1 +# php occ config:system:set debug --value=true --type=boolean +# php occ config:system:set allow_local_remote_servers --value true +# php -S localhost:8080 & +# +# - name: Checkout NcPyApi +# uses: actions/checkout@v3 +# with: +# path: nc_py_api +# +# - name: Install NcPyApi +# working-directory: nc_py_api +# run: python3 -m pip -v install ".[dev]" +# +# - name: Checkout AppEcosystemV2 +# uses: actions/checkout@v3 +# if: ${{ !startsWith(matrix.nextcloud, '26.') }} +# with: +# path: apps/app_ecosystem_v2 +# repository: cloud-py-api/app_ecosystem_v2 +# +# - name: Install AppEcosystemV2 +# if: ${{ !startsWith(matrix.nextcloud, '26.') }} +# run: | +# patch -p 1 -i apps/app_ecosystem_v2/base_php.patch +# php occ app:enable app_ecosystem_v2 +# cd nc_py_api +# coverage run --data-file=.coverage.ci_install tests/_install.py & +# echo $! > /tmp/_install.pid +# cd .. +# sleep 5s +# php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ +# --net=host --host="127.0.0.1" --expose="local" +## echo "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" +# php occ app_ecosystem_v2:app:register \ +# "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ +# -e --force-scopes --system-app +# kill -15 $(cat /tmp/_install.pid) +# timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null +# +# - name: Generate coverage report +# working-directory: nc_py_api +# run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html +# +# - name: HTML coverage to artifacts +# uses: actions/upload-artifact@v3 +# with: +# name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} +# path: nc_py_api/htmlcov +# if-no-files-found: error +# +# - name: Upload report to Codecov +# uses: codecov/codecov-action@v3 +# with: +# token: ${{ secrets.CODECOV_TOKEN }} +# file: nc_py_api/coverage.xml +# fail_ci_if_error: true +# verbose: true +# +# - name: Upload NC logs +# if: always() +# uses: actions/upload-artifact@v3 +# with: +# name: nc_log_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} +# path: data/nextcloud.log +# if-no-files-found: warn # tests-oci: # needs: [analysis] From 925f859a2bc3bf7cd5110204c913eebd70691f56 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 18:02:11 +0300 Subject: [PATCH 05/11] new AppEcosystem fix(2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 495 ++++++++++++------------ 1 file changed, 247 insertions(+), 248 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 63f5a20f..1a6ad7b0 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -171,252 +171,251 @@ jobs: path: data/nextcloud.log if-no-files-found: warn -# tests-pgsql: -# needs: [analysis] -# runs-on: ubuntu-22.04 -# name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • PgSQL -# strategy: -# fail-fast: false -# matrix: -# nextcloud: [ "26.0.3" ] -# python: [ "3.11" ] -# php-version: [ "8.1" ] -# include: -# - nextcloud: "27.0.0" -# python: "3.10" -# php-version: "8.2" -# env: -# NC_dbname: nextcloud_abz -# -# services: -# postgres: -# image: postgres:15 -# 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 ${{ matrix.php-version }} -# uses: shivammathur/setup-php@v2 -# with: -# php-version: ${{ matrix.php-version }} -# extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd -# -# - uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python }} -# -# - name: cache-nextcloud -# id: nextcloud_setup -# uses: actions/cache@v3 -# with: -# path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 -# key: ${{ matrix.nextcloud }} -# -# - name: Download Nextcloud -# if: steps.nextcloud_setup.outputs.cache-hit != 'true' -# run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 -# -# - name: Set up Nextcloud -# run: | -# tar -xjf nextcloud-${{ matrix.nextcloud }}.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 adminpassword -# php occ config:system:set loglevel --value=1 -# php occ config:system:set debug --value=true --type=boolean -# php occ config:system:set allow_local_remote_servers --value true -# php -S localhost:8080 & -# -# - name: Checkout NcPyApi -# uses: actions/checkout@v3 -# with: -# path: nc_py_api -# -# - name: Install NcPyApi -# working-directory: nc_py_api -# run: python3 -m pip -v install ".[dev]" -# -# - name: Checkout AppEcosystemV2 -# uses: actions/checkout@v3 -# if: ${{ !startsWith(matrix.nextcloud, '26.') }} -# with: -# path: apps/app_ecosystem_v2 -# repository: cloud-py-api/app_ecosystem_v2 -# -# - name: Install AppEcosystemV2 -# if: ${{ !startsWith(matrix.nextcloud, '26.') }} -# run: | -# patch -p 1 -i apps/app_ecosystem_v2/base_php.patch -# php occ app:enable app_ecosystem_v2 -# cd nc_py_api -# coverage run --data-file=.coverage.ci_install tests/_install.py & -# echo $! > /tmp/_install.pid -# cd .. -# sleep 5s -# php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ -# --net=host --host="127.0.0.1" --expose="local" -## echo "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" -# php occ app_ecosystem_v2:app:register \ -# "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -# -e --force-scopes --system-app -# kill -15 $(cat /tmp/_install.pid) -# timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null -# -# - name: Generate coverage report -# working-directory: nc_py_api -# run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html -# -# - name: HTML coverage to artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} -# path: nc_py_api/htmlcov -# if-no-files-found: error -# -# - name: Upload report to Codecov -# uses: codecov/codecov-action@v3 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# file: nc_py_api/coverage.xml -# fail_ci_if_error: true -# verbose: true -# -# - name: Upload NC logs -# if: always() -# uses: actions/upload-artifact@v3 -# with: -# name: nc_log_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} -# path: data/nextcloud.log -# if-no-files-found: warn + tests-pgsql: + needs: [analysis] + runs-on: ubuntu-22.04 + name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • PgSQL + strategy: + fail-fast: false + matrix: + nextcloud: [ "26.0.3" ] + python: [ "3.11" ] + php-version: [ "8.1" ] + include: + - nextcloud: "27.0.0" + python: "3.10" + php-version: "8.2" + env: + NC_dbname: nextcloud_abz -# tests-oci: -# needs: [analysis] -# runs-on: ubuntu-22.04 -# name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • OCI -# strategy: -# fail-fast: false -# matrix: -# nextcloud: [ "27.0.0" ] -# python: [ "3.11" ] -# php-version: [ "8.2" ] -# -# services: -# oracle: -# image: ghcr.io/gvenzl/oracle-xe:11 -# env: -# ORACLE_RANDOM_PASSWORD: true -# APP_USER: useroracle -# APP_USER_PASSWORD: userpassword -# options: >- -# --health-cmd healthcheck.sh -# --health-interval 10s -# --health-timeout 5s -# --health-retries 10 -# ports: -# - 1521:1521/tcp -# -# steps: -# - name: Set up php -# uses: shivammathur/setup-php@v2 -# with: -# php-version: ${{ matrix.php-version }} -# extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \ -# posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 -# -# - uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python }} -# -# - name: cache-nextcloud -# id: nextcloud_setup -# uses: actions/cache@v3 -# with: -# path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 -# key: ${{ matrix.nextcloud }} -# -# - name: Download Nextcloud -# if: steps.nextcloud_setup.outputs.cache-hit != 'true' -# run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 -# -# - name: Set up Nextcloud -# run: | -# tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 -# mkdir data -# php occ maintenance:install --verbose --database=oci --database-name=XE \ -# --database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \ -# --admin-user admin --admin-pass admin -# php occ config:system:set loglevel --value=1 --type=integer -# php occ config:system:set debug --value=true --type=boolean -# php occ config:system:set allow_local_remote_servers --value true -# php -S localhost:8080 & -# -# - name: Checkout NcPyApi -# uses: actions/checkout@v3 -# with: -# path: nc_py_api -# -# - name: Install NcPyApi -# working-directory: nc_py_api -# run: python3 -m pip -v install ".[dev]" -# -# - name: Checkout AppEcosystemV2 -# uses: actions/checkout@v3 -# with: -# path: apps/app_ecosystem_v2 -# repository: cloud-py-api/app_ecosystem_v2 -# -# - name: Install AppEcosystemV2 -# run: | -# patch -p 1 -i apps/app_ecosystem_v2/base_php.patch -# php occ app:enable app_ecosystem_v2 -# cd nc_py_api -# coverage run --data-file=.coverage.ci_install tests/_install.py & -# echo $! > /tmp/_install.pid -# cd .. -# sleep 5s -# php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ -# --net=host --host="127.0.0.1" --expose="local" -# php occ app_ecosystem_v2:app:register \ -# "{"appid":"$APP_ID","name":"$APP_ID","daemon_config_id":1,"version":"$APP_VERSION","secret":"$APP_SECRET","port":"$APP_PORT"}" \ -# -e --force-scopes --system-app -# kill -15 $(cat /tmp/_install.pid) -# timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null -# -# - name: Generate coverage report -# working-directory: nc_py_api -# run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html -# env: -# SKIP_NC_WO_AE: 1 -# -# - name: HTML coverage to artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: coverage_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} -# path: nc_py_api/htmlcov -# if-no-files-found: error -# -# - name: Upload report to Codecov -# uses: codecov/codecov-action@v3 -# with: -# token: ${{ secrets.CODECOV_TOKEN }} -# file: nc_py_api/coverage.xml -# fail_ci_if_error: true -# verbose: true -# -# - name: Upload NC logs -# if: always() -# uses: actions/upload-artifact@v3 -# with: -# name: nc_log_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} -# path: data/nextcloud.log -# if-no-files-found: warn + services: + postgres: + image: postgres:15 + 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 ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: cache-nextcloud + id: nextcloud_setup + uses: actions/cache@v3 + with: + path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 + key: ${{ matrix.nextcloud }} + + - name: Download Nextcloud + if: steps.nextcloud_setup.outputs.cache-hit != 'true' + run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 + + - name: Set up Nextcloud + run: | + tar -xjf nextcloud-${{ matrix.nextcloud }}.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 adminpassword + php occ config:system:set loglevel --value=1 + php occ config:system:set debug --value=true --type=boolean + php occ config:system:set allow_local_remote_servers --value true + php -S localhost:8080 & + + - name: Checkout NcPyApi + uses: actions/checkout@v3 + with: + path: nc_py_api + + - name: Install NcPyApi + working-directory: nc_py_api + run: python3 -m pip -v install ".[dev]" + + - name: Checkout AppEcosystemV2 + uses: actions/checkout@v3 + if: ${{ !startsWith(matrix.nextcloud, '26.') }} + with: + path: apps/app_ecosystem_v2 + repository: cloud-py-api/app_ecosystem_v2 + + - name: Install AppEcosystemV2 + if: ${{ !startsWith(matrix.nextcloud, '26.') }} + run: | + patch -p 1 -i apps/app_ecosystem_v2/base_php.patch + php occ app:enable app_ecosystem_v2 + cd nc_py_api + coverage run --data-file=.coverage.ci_install tests/_install.py & + echo $! > /tmp/_install.pid + cd .. + sleep 5s + php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ + --net=host --host="127.0.0.1" --expose="local" + php occ app_ecosystem_v2:app:register \ + "{\"appid\":\"$APP_ID\",\"name\":\"$APP_ID\",\"daemon_config_id\":1,\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"port\":$APP_PORT}" \ + -e --force-scopes --system-app + kill -15 $(cat /tmp/_install.pid) + timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null + + - name: Generate coverage report + working-directory: nc_py_api + run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html + + - name: HTML coverage to artifacts + uses: actions/upload-artifact@v3 + with: + name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} + path: nc_py_api/htmlcov + if-no-files-found: error + + - name: Upload report to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: nc_py_api/coverage.xml + fail_ci_if_error: true + verbose: true + + - name: Upload NC logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: nc_log_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} + path: data/nextcloud.log + if-no-files-found: warn + + tests-oci: + needs: [analysis] + runs-on: ubuntu-22.04 + name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • OCI + strategy: + fail-fast: false + matrix: + nextcloud: [ "27.0.0" ] + python: [ "3.11" ] + php-version: [ "8.2" ] + + services: + oracle: + image: ghcr.io/gvenzl/oracle-xe:11 + env: + ORACLE_RANDOM_PASSWORD: true + APP_USER: useroracle + APP_USER_PASSWORD: userpassword + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + ports: + - 1521:1521/tcp + + steps: + - name: Set up php + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \ + posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: cache-nextcloud + id: nextcloud_setup + uses: actions/cache@v3 + with: + path: nextcloud-${{ matrix.nextcloud }}.tar.bz2 + key: ${{ matrix.nextcloud }} + + - name: Download Nextcloud + if: steps.nextcloud_setup.outputs.cache-hit != 'true' + run: wget -q https://download.nextcloud.com/server/releases/nextcloud-${{ matrix.nextcloud }}.tar.bz2 + + - name: Set up Nextcloud + run: | + tar -xjf nextcloud-${{ matrix.nextcloud }}.tar.bz2 --strip-components 1 + mkdir data + php occ maintenance:install --verbose --database=oci --database-name=XE \ + --database-host=127.0.0.1 --database-port=1521 --database-user=useroracle --database-pass=userpassword \ + --admin-user admin --admin-pass admin + php occ config:system:set loglevel --value=1 --type=integer + php occ config:system:set debug --value=true --type=boolean + php occ config:system:set allow_local_remote_servers --value true + php -S localhost:8080 & + + - name: Checkout NcPyApi + uses: actions/checkout@v3 + with: + path: nc_py_api + + - name: Install NcPyApi + working-directory: nc_py_api + run: python3 -m pip -v install ".[dev]" + + - name: Checkout AppEcosystemV2 + uses: actions/checkout@v3 + with: + path: apps/app_ecosystem_v2 + repository: cloud-py-api/app_ecosystem_v2 + + - name: Install AppEcosystemV2 + run: | + patch -p 1 -i apps/app_ecosystem_v2/base_php.patch + php occ app:enable app_ecosystem_v2 + cd nc_py_api + coverage run --data-file=.coverage.ci_install tests/_install.py & + echo $! > /tmp/_install.pid + cd .. + sleep 5s + php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0 \ + --net=host --host="127.0.0.1" --expose="local" + php occ app_ecosystem_v2:app:register \ + "{\"appid\":\"$APP_ID\",\"name\":\"$APP_ID\",\"daemon_config_id\":1,\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"port\":$APP_PORT}" \ + -e --force-scopes --system-app + kill -15 $(cat /tmp/_install.pid) + timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null + + - name: Generate coverage report + working-directory: nc_py_api + run: coverage run --data-file=.coverage.ci -m pytest && coverage combine && coverage xml && coverage html + env: + SKIP_NC_WO_AE: 1 + + - name: HTML coverage to artifacts + uses: actions/upload-artifact@v3 + with: + name: coverage_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} + path: nc_py_api/htmlcov + if-no-files-found: error + + - name: Upload report to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: nc_py_api/coverage.xml + fail_ci_if_error: true + verbose: true + + - name: Upload NC logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: nc_log_oci_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }} + path: data/nextcloud.log + if-no-files-found: warn From 7ac80f139e8b107c781801ae65ac630304fdcbfa Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 18:03:56 +0300 Subject: [PATCH 06/11] new AppEcosystem fix(2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 1a6ad7b0..be77346a 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -30,25 +30,25 @@ env: NC_AUTH_PASS: "adminpassword" jobs: -# analysis: -# runs-on: macos-12 -# name: Analysis -# -# steps: -# - uses: actions/checkout@v3 -# -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.9" -# -# - name: Install from source -# run: python3 -m pip install ".[dev]" wheel -# -# - name: Run Analysis -# run: python3 -m pylint "setup.py" "nc_py_api/" + analysis: + runs-on: macos-12 + name: Analysis + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.9" + + - name: Install from source + run: python3 -m pip install ".[dev]" wheel + + - name: Run Analysis + run: python3 -m pylint "setup.py" "nc_py_api/" tests-maria: -# needs: [analysis] + needs: [analysis] runs-on: ubuntu-22.04 name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • Maria strategy: From e203ba0858df45c9a207875720a8b5693de222eb Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 18:11:29 +0300 Subject: [PATCH 07/11] fixed weather_status random fails Signed-off-by: Alexander Piskun --- tests/weather_status_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/weather_status_test.py b/tests/weather_status_test.py index 311695e5..1f931190 100644 --- a/tests/weather_status_test.py +++ b/tests/weather_status_test.py @@ -18,7 +18,7 @@ def test_get_set_location(nc): assert loc["longitude"] == 0.0 assert isinstance(loc["address"], str) assert isinstance(loc["mode"], int) - assert nc.weather_status.set_location(address="Paris, France") + assert nc.weather_status.set_location(address="Paris, 75007, France") loc = nc.weather_status.get_location() assert loc["latitude"] assert loc["longitude"] @@ -43,7 +43,7 @@ def test_get_set_location_no_lat_lon_address(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_forecast(nc): - nc.weather_status.set_location(address="Paris, France") + nc.weather_status.set_location(address="Paris, 75007, France") forecast = nc.weather_status.get_forecast() assert isinstance(forecast, list) assert forecast From 0a479a299cddb82a343425dcc03e1aa60e770d95 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 18:41:30 +0300 Subject: [PATCH 08/11] tried fix CI, error comes from NC Signed-off-by: Alexander Piskun --- CHANGELOG.md | 4 +-- tests/weather_status_test.py | 63 +++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e0c3341..7d11f3fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [0.0.21 - 2023-06-04] +## [0.0.21 - 2023-07-04] ### Added @@ -12,6 +12,6 @@ All notable changes to this project will be documented in this file. - All input environment variables now in Upper Case. -## [0.0.20 - 2023-06-03] +## [0.0.20 - 2023-07-03] - Written from the scratch new version of the Nextcloud Python Client. Deep Alpha. diff --git a/tests/weather_status_test.py b/tests/weather_status_test.py index 1f931190..c78be85d 100644 --- a/tests/weather_status_test.py +++ b/tests/weather_status_test.py @@ -1,5 +1,6 @@ import pytest +from nc_py_api import NextcloudException from nc_py_api.weather_status import WeatherLocationMode from gfixture import NC_TO_TEST @@ -12,27 +13,32 @@ def test_available(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_set_location(nc): - nc.weather_status.set_location(longitude=0.0, latitude=0.0) - loc = nc.weather_status.get_location() - assert loc["latitude"] == 0.0 - assert loc["longitude"] == 0.0 - assert isinstance(loc["address"], str) - assert isinstance(loc["mode"], int) - assert nc.weather_status.set_location(address="Paris, 75007, France") - loc = nc.weather_status.get_location() - assert loc["latitude"] - assert loc["longitude"] - assert loc["address"].find("Paris") != -1 - assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776) - loc = nc.weather_status.get_location() - assert loc["latitude"] == 41.896655 - assert loc["longitude"] == 12.488776 - assert loc["address"].find("Rom") != -1 - assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France") - loc = nc.weather_status.get_location() - assert loc["latitude"] == 41.896655 - assert loc["longitude"] == 12.488776 - assert loc["address"].find("Rom") != -1 + try: + nc.weather_status.set_location(longitude=0.0, latitude=0.0) + loc = nc.weather_status.get_location() + assert loc["latitude"] == 0.0 + assert loc["longitude"] == 0.0 + assert isinstance(loc["address"], str) + assert isinstance(loc["mode"], int) + assert nc.weather_status.set_location(address="Paris, 75007, France") + loc = nc.weather_status.get_location() + assert loc["latitude"] + assert loc["longitude"] + assert loc["address"].find("Paris") != -1 + assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776) + loc = nc.weather_status.get_location() + assert loc["latitude"] == 41.896655 + assert loc["longitude"] == 12.488776 + assert loc["address"].find("Rom") != -1 + assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France") + loc = nc.weather_status.get_location() + assert loc["latitude"] == 41.896655 + assert loc["longitude"] == 12.488776 + assert loc["address"].find("Rom") != -1 + except NextcloudException as e: + if e.status_code != 500: + raise e from None + print("\033[93m" + " WARNING: Set Location failed." + "\033[0m") @pytest.mark.parametrize("nc", NC_TO_TEST) @@ -43,11 +49,16 @@ def test_get_set_location_no_lat_lon_address(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_forecast(nc): - nc.weather_status.set_location(address="Paris, 75007, France") - forecast = nc.weather_status.get_forecast() - assert isinstance(forecast, list) - assert forecast - assert isinstance(forecast[0], dict) + try: + nc.weather_status.set_location(address="Paris, 75007, France") + forecast = nc.weather_status.get_forecast() + assert isinstance(forecast, list) + assert forecast + assert isinstance(forecast[0], dict) + except NextcloudException as e: + if e.status_code != 500: + raise e from None + print("\033[93m" + " WARNING: Get Forecast failed." + "\033[0m") @pytest.mark.parametrize("nc", NC_TO_TEST) From fbd54d1220c470b797955ebb599031e012d1d3a9 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 18:56:03 +0300 Subject: [PATCH 09/11] correct fix for host DNS problems Signed-off-by: Alexander Piskun --- tests/weather_status_test.py | 70 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/tests/weather_status_test.py b/tests/weather_status_test.py index c78be85d..f0ddd5d2 100644 --- a/tests/weather_status_test.py +++ b/tests/weather_status_test.py @@ -13,32 +13,33 @@ def test_available(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_set_location(nc): - try: - nc.weather_status.set_location(longitude=0.0, latitude=0.0) - loc = nc.weather_status.get_location() - assert loc["latitude"] == 0.0 - assert loc["longitude"] == 0.0 - assert isinstance(loc["address"], str) - assert isinstance(loc["mode"], int) - assert nc.weather_status.set_location(address="Paris, 75007, France") - loc = nc.weather_status.get_location() - assert loc["latitude"] - assert loc["longitude"] - assert loc["address"].find("Paris") != -1 - assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776) - loc = nc.weather_status.get_location() - assert loc["latitude"] == 41.896655 - assert loc["longitude"] == 12.488776 - assert loc["address"].find("Rom") != -1 - assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France") - loc = nc.weather_status.get_location() - assert loc["latitude"] == 41.896655 - assert loc["longitude"] == 12.488776 - assert loc["address"].find("Rom") != -1 - except NextcloudException as e: - if e.status_code != 500: - raise e from None - print("\033[93m" + " WARNING: Set Location failed." + "\033[0m") + nc.weather_status.set_location(longitude=0.0, latitude=0.0) + loc = nc.weather_status.get_location() + assert loc["latitude"] == 0.0 + assert loc["longitude"] == 0.0 + assert isinstance(loc["address"], str) + assert isinstance(loc["mode"], int) + assert nc.weather_status.set_location(address="Paris, 75007, France") + loc = nc.weather_status.get_location() + assert loc["latitude"] + assert loc["longitude"] + if loc["address"].find("Unknown") != -1: + pytest.skip("Some network problem on the host") + assert loc["address"].find("Paris") != -1 + assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776) + loc = nc.weather_status.get_location() + assert loc["latitude"] == 41.896655 + assert loc["longitude"] == 12.488776 + if loc["address"].find("Unknown") != -1: + pytest.skip("Some network problem on the host") + assert loc["address"].find("Rom") + assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France") + loc = nc.weather_status.get_location() + assert loc["latitude"] == 41.896655 + assert loc["longitude"] == 12.488776 + if loc["address"].find("Unknown") != -1: + pytest.skip("Some network problem on the host") + assert loc["address"].find("Rom") != -1 @pytest.mark.parametrize("nc", NC_TO_TEST) @@ -49,16 +50,13 @@ def test_get_set_location_no_lat_lon_address(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_forecast(nc): - try: - nc.weather_status.set_location(address="Paris, 75007, France") - forecast = nc.weather_status.get_forecast() - assert isinstance(forecast, list) - assert forecast - assert isinstance(forecast[0], dict) - except NextcloudException as e: - if e.status_code != 500: - raise e from None - print("\033[93m" + " WARNING: Get Forecast failed." + "\033[0m") + nc.weather_status.set_location(address="Paris, 75007, France") + if nc.weather_status.get_location()["address"].find("Unknown") != -1: + pytest.skip("Some network problem on the host") + forecast = nc.weather_status.get_forecast() + assert isinstance(forecast, list) + assert forecast + assert isinstance(forecast[0], dict) @pytest.mark.parametrize("nc", NC_TO_TEST) From d92dd371b05973c39fbfd2eb7dc06dcd016ec725 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 19:06:00 +0300 Subject: [PATCH 10/11] correct fix for host DNS problems Signed-off-by: Alexander Piskun --- tests/weather_status_test.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/weather_status_test.py b/tests/weather_status_test.py index f0ddd5d2..0bf53be5 100644 --- a/tests/weather_status_test.py +++ b/tests/weather_status_test.py @@ -19,7 +19,12 @@ def test_get_set_location(nc): assert loc["longitude"] == 0.0 assert isinstance(loc["address"], str) assert isinstance(loc["mode"], int) - assert nc.weather_status.set_location(address="Paris, 75007, France") + try: + assert nc.weather_status.set_location(address="Paris, 75007, France") + except NextcloudException as e: + if e.status_code == 500: + pytest.skip("Some network problem on the host") + raise e from None loc = nc.weather_status.get_location() assert loc["latitude"] assert loc["longitude"] @@ -32,7 +37,7 @@ def test_get_set_location(nc): assert loc["longitude"] == 12.488776 if loc["address"].find("Unknown") != -1: pytest.skip("Some network problem on the host") - assert loc["address"].find("Rom") + assert loc["address"].find("Rom") != -1 assert nc.weather_status.set_location(latitude=41.896655, longitude=12.488776, address="Paris, France") loc = nc.weather_status.get_location() assert loc["latitude"] == 41.896655 From c02491d2114bb53f512320604512514be287434f Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Tue, 4 Jul 2023 19:11:56 +0300 Subject: [PATCH 11/11] correct fix for host DNS problems Signed-off-by: Alexander Piskun --- tests/weather_status_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/weather_status_test.py b/tests/weather_status_test.py index 0bf53be5..36e108cd 100644 --- a/tests/weather_status_test.py +++ b/tests/weather_status_test.py @@ -55,7 +55,7 @@ def test_get_set_location_no_lat_lon_address(nc): @pytest.mark.parametrize("nc", NC_TO_TEST) def test_get_forecast(nc): - nc.weather_status.set_location(address="Paris, 75007, France") + nc.weather_status.set_location(latitude=41.896655, longitude=12.488776) if nc.weather_status.get_location()["address"].find("Unknown") != -1: pytest.skip("Some network problem on the host") forecast = nc.weather_status.get_forecast()