Skip to content

feat: Add task processing API #1139

feat: Add task processing API

feat: Add task processing API #1139

name: Analysis & Coverage
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ana_cov-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
NEXTCLOUD_URL: "http://localhost:8080"
APP_ID: "nc_py_api"
APP_VERSION: "1.0.0"
APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E"
APP_PORT: 9009
NC_AUTH_USER: "admin"
NC_AUTH_PASS: "adminpassword"
jobs:
analysis:
runs-on: macos-14
name: Analysis
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install from source
run: python3 -m pip install ".[dev]"
- name: Run Analysis
run: python3 -m pylint "nc_py_api/"
tests-maria:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐘${{ matrix.php-version }} • 🐍${{ matrix.python }} • Maria
strategy:
fail-fast: false
matrix:
include:
- nextcloud: "27.1.4"
python: "3.10"
php-version: "8.1"
timeout-minutes: 60
services:
mariadb:
image: mariadb:11.3
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: ${{ matrix.php-version }}
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Stable27
if: ${{ startsWith(matrix.nextcloud, '27.') }}
run: echo "NC_BRANCH_NAME=stable27" >> $GITHUB_ENV
- name: cache-nextcloud
id: nextcloud_setup
uses: actions/cache@v4
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=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: cloud-py-api/app_api
- 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.NC_BRANCH_NAME }}
- 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_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
path: nc_py_api/coverage_maria_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_maria_${{ 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:
include:
- nextcloud: "27.1.4"
python: "3.11"
php-version: "8.2"
env:
NC_dbname: nextcloud_abz
DATABASE_PGSQL: 1
timeout-minutes: 60
services:
postgres:
image: postgres:16
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@v5
with:
python-version: ${{ matrix.python }}
- name: Stable27
if: ${{ startsWith(matrix.nextcloud, '27.') }}
run: echo "NC_BRANCH_NAME=stable27" >> $GITHUB_ENV
- name: cache-nextcloud
id: nextcloud_setup
uses: actions/cache@v4
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 ${{ 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: cloud-py-api/app_api
- 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.NC_BRANCH_NAME }}
- 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_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
path: nc_py_api/coverage_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_pgsql_${{ matrix.nextcloud }}_${{ matrix.python }}_${{ matrix.php-version }}
path: data/nextcloud.log
if-no-files-found: warn
tests-stable27-oci:
needs: [analysis]
runs-on: ubuntu-22.04
name: stable27 • 🐘8.1 • 🐍3.11 • OCI
timeout-minutes: 60
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: '8.1'
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, \
posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, oci8
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: 'stable27'
- name: Checkout Notifications
uses: actions/checkout@v4
with:
repository: nextcloud/notifications
ref: 'stable27'
path: apps/notifications
- name: Set up Nextcloud
run: |
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 ${{ 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 ".[app,dev-min]"
- name: Checkout AppAPI
uses: actions/checkout@v4
with:
path: apps/app_api
repository: cloud-py-api/app_api
- 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: Generate coverage report
working-directory: nc_py_api
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_stable27_3.11_8.1.xml
env:
SKIP_NC_CLIENT_TESTS: 1
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_oci_stable27_3.11_8.1.xml
path: nc_py_api/coverage_oci_stable27_3.11_8.1.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_oci_stable27_3.11_8.1
path: data/nextcloud.log
if-no-files-found: warn
tests-latest-maria:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐘8.2 • 🐍3.10 • Maria
strategy:
fail-fast: false
matrix:
nextcloud: [ 'stable27', 'stable28', 'master' ]
timeout-minutes: 60
services:
mariadb:
image: mariadb:11.3
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.2
extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd, curl
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.nextcloud }}
- name: Checkout Notifications
uses: actions/checkout@v4
with:
repository: nextcloud/notifications
ref: ${{ matrix.nextcloud }}
path: apps/notifications
- name: Checkout Notes
uses: actions/checkout@v4
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
with:
repository: nextcloud/notes
ref: "main"
path: apps/notes
- name: Checkout Files Locking
uses: actions/checkout@v4
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
with:
repository: nextcloud/files_lock
ref: ${{ matrix.nextcloud }}
path: apps/files_lock
- name: Set up & run Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./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 }}
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ app:enable notifications
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
- name: Enable Files Locking
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: ./occ app:enable files_lock
- name: Enable Notes
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: ./occ app:enable notes
- 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: cloud-py-api/app_api
- 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: Talk Branch Main
if: ${{ startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV
- name: Talk Branch Other
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV
- name: Checkout Talk
uses: actions/checkout@v4
with:
path: apps/spreed
repository: nextcloud/spreed
ref: ${{ env.TALK_BRANCH_NAME }}
- 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_async.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_${{ matrix.nextcloud }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_maria_${{ matrix.nextcloud }}.xml
path: nc_py_api/coverage_maria_${{ matrix.nextcloud }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_maria_${{ matrix.nextcloud }}
path: data/nextcloud.log
if-no-files-found: warn
test-latest-pgsql:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐘8.2 • 🐍3.11 • PgSQL
strategy:
fail-fast: false
matrix:
nextcloud: [ 'stable27', 'stable28', 'master' ]
env:
NC_dbname: nextcloud_abz
DATABASE_PGSQL: 1
timeout-minutes: 60
services:
postgres:
image: postgres:16
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
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: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.nextcloud }}
- name: Checkout Notifications
uses: actions/checkout@v4
with:
repository: nextcloud/notifications
ref: ${{ matrix.nextcloud }}
path: apps/notifications
- name: Checkout Activity
uses: actions/checkout@v4
with:
repository: nextcloud/activity
ref: ${{ matrix.nextcloud }}
path: apps/activity
- name: Set up & run Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./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 }}
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ app:enable notifications
./occ app:enable activity
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: cloud-py-api/app_api
- name: Install AppAPI
run: |
php occ app:enable app_api
cd nc_py_api
coverage run --data-file=.coverage.ci_install tests/_install_async.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: Talk Branch Main
if: ${{ startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV
- name: Talk Branch Other
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV
- name: Checkout Talk
uses: actions/checkout@v4
with:
path: apps/spreed
repository: nextcloud/spreed
ref: ${{ env.TALK_BRANCH_NAME }}
- 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_async.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
env:
NPA_TIMEOUT: None
NPA_TIMEOUT_DAV: None
NPA_NC_CERT: False
- 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_${{ matrix.nextcloud }}.xml
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_pgsql_${{ matrix.nextcloud }}.xml
path: nc_py_api/coverage_pgsql_${{ matrix.nextcloud }}.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_pgsql_${{ matrix.nextcloud }}
path: data/nextcloud.log
if-no-files-found: warn
tests-client-sqlite:
needs: [analysis]
runs-on: ubuntu-22.04
name: ${{ matrix.nextcloud }} • 🐍3.12 • Client
strategy:
fail-fast: false
matrix:
nextcloud: [ 'stable26', 'stable27', 'stable28', 'master' ]
env:
NEXTCLOUD_URL: "http://localhost:8080/index.php"
timeout-minutes: 60
steps:
- name: Set up php
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, curl
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Checkout server
uses: actions/checkout@v4
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.nextcloud }}
- name: Checkout Activity
uses: actions/checkout@v4
with:
repository: nextcloud/activity
ref: ${{ matrix.nextcloud }}
path: apps/activity
- name: Checkout Notes
uses: actions/checkout@v4
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
with:
repository: nextcloud/notes
ref: "main"
path: apps/notes
- name: Checkout Files Locking
uses: actions/checkout@v4
if: ${{ !startsWith(matrix.nextcloud, 'stable26') && !startsWith(matrix.nextcloud, 'master') }}
with:
repository: nextcloud/files_lock
ref: ${{ matrix.nextcloud }}
path: apps/files_lock
- name: Set up & run Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 \
--database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
--admin-user admin --admin-pass ${{ env.NC_AUTH_PASS }}
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ app:enable activity
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
- name: Enable Notes
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: ./occ app:enable notes
- name: Enable Files Locking
if: ${{ !startsWith(matrix.nextcloud, 'stable26') && !startsWith(matrix.nextcloud, 'master') }}
run: ./occ app:enable files_lock
- 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 . pytest pytest-asyncio coverage pillow
- name: Talk Branch Main
if: ${{ startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV
- name: Talk Branch Other
if: ${{ !startsWith(matrix.nextcloud, 'master') }}
run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV
- name: Checkout Talk
uses: actions/checkout@v4
with:
path: apps/spreed
repository: nextcloud/spreed
ref: ${{ env.TALK_BRANCH_NAME }}
- name: Install Talk
working-directory: apps/spreed
run: make dev-setup
- name: Enable Talk
run: php occ app:enable spreed
- name: Generate coverage report
working-directory: nc_py_api
run: coverage run -m pytest && coverage xml -o coverage_sqlite_${{ matrix.nextcloud }}_client.xml
env:
SKIP_AA_TESTS: 1
NPA_NC_CERT: ''
- name: Upload Codecov to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage_sqlite_${{ matrix.nextcloud }}_client.xml
path: nc_py_api/coverage_sqlite_${{ matrix.nextcloud }}_client.xml
if-no-files-found: error
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v4
with:
name: nc_log_sqlite_${{ matrix.nextcloud }}
path: data/nextcloud.log
if-no-files-found: warn
tests-upload-coverage:
needs: [tests-maria, tests-pgsql, tests-stable27-oci, tests-latest-maria, test-latest-pgsql, tests-client-sqlite]
permissions:
contents: none
runs-on: ubuntu-22.04
name: Upload Coverage
steps:
- uses: actions/checkout@v4
- name: Download Coverage Artifacts
uses: actions/download-artifact@v4
with:
path: coverage
pattern: coverage_*
merge-multiple: true
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage
fail_ci_if_error: true
verbose: true
tests-success:
permissions:
contents: none
runs-on: ubuntu-22.04
needs: [tests-upload-coverage]
name: Tests-OK
steps:
- run: echo "Tests passed successfully"