feat: initial nc-py-app ExApp framework package #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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_app" | |
| 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@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - name: Install from source | |
| run: python3 -m pip install ".[dev]" | |
| - name: Run Analysis | |
| run: python3 -m pylint "nc_py_app/" | |
| tests-maria: | |
| needs: [analysis] | |
| runs-on: ubuntu-22.04 | |
| name: ${{ matrix.nextcloud }} • 🐍${{ matrix.python }} • Maria | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - nextcloud: 'stable32' | |
| python: '3.10' | |
| - nextcloud: 'stable33' | |
| python: '3.11' | |
| timeout-minutes: 60 | |
| services: | |
| mariadb: | |
| image: mariadb:11.8 | |
| 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@v6 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Checkout server | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| repository: nextcloud/server | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Checkout Notifications | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: nextcloud/notifications | |
| ref: ${{ matrix.nextcloud }} | |
| path: apps/notifications | |
| - name: Set up & run Nextcloud | |
| 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 config:system:set ratelimit.protection.enabled --value=false --type=boolean | |
| ./occ config:system:set overwrite.cli.url --value="http://localhost:8080" | |
| ./occ app:enable notifications | |
| PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & | |
| - name: Checkout nc_py_app | |
| uses: actions/checkout@v6 | |
| with: | |
| path: nc_py_app | |
| - name: Install nc_py_app | |
| working-directory: nc_py_app | |
| run: python3 -m pip -v install ".[dev]" | |
| - name: Checkout AppAPI | |
| uses: actions/checkout@v6 | |
| with: | |
| path: apps/app_api | |
| repository: nextcloud/app_api | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Install AppAPI & register ExApp | |
| run: | | |
| php occ app:enable app_api | |
| cd nc_py_app | |
| 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_app/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@v6 | |
| with: | |
| path: apps/spreed | |
| repository: nextcloud/spreed | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Install Talk | |
| working-directory: apps/spreed | |
| run: make dev-setup | |
| - name: Enable Talk | |
| run: php occ app:enable spreed | |
| - name: Run tests | |
| working-directory: nc_py_app | |
| run: | | |
| coverage run --data-file=.coverage.ci -m pytest | |
| coverage combine && coverage xml -o coverage_maria_${{ matrix.nextcloud }}.xml | |
| - name: Upload Codecov to artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage_maria_${{ matrix.nextcloud }}.xml | |
| path: nc_py_app/coverage_maria_${{ matrix.nextcloud }}.xml | |
| if-no-files-found: error | |
| - name: Upload NC logs | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: nc_log_maria_${{ matrix.nextcloud }} | |
| path: data/nextcloud.log | |
| if-no-files-found: warn | |
| tests-pgsql: | |
| needs: [analysis] | |
| runs-on: ubuntu-22.04 | |
| name: ${{ matrix.nextcloud }} • 🐍3.12 • PgSQL | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| nextcloud: [ 'stable31', 'stable32' ] | |
| env: | |
| NC_dbname: nextcloud_abz | |
| 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 | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.2' | |
| extensions: mbstring, fileinfo, intl, pdo_mysql, zip, gd | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Checkout server | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| repository: nextcloud/server | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Checkout Notifications | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: nextcloud/notifications | |
| ref: ${{ matrix.nextcloud }} | |
| path: apps/notifications | |
| - name: Set up & run Nextcloud | |
| 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 config:system:set ratelimit.protection.enabled --value=false --type=boolean | |
| ./occ config:system:set overwrite.cli.url --value="http://localhost:8080" | |
| ./occ app:enable notifications | |
| PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & | |
| - name: Checkout nc_py_app | |
| uses: actions/checkout@v6 | |
| with: | |
| path: nc_py_app | |
| - name: Install nc_py_app | |
| working-directory: nc_py_app | |
| run: python3 -m pip -v install ".[dev]" | |
| - name: Checkout AppAPI | |
| uses: actions/checkout@v6 | |
| with: | |
| path: apps/app_api | |
| repository: nextcloud/app_api | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Install AppAPI & register ExApp | |
| run: | | |
| php occ app:enable app_api | |
| cd nc_py_app | |
| 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_app/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@v6 | |
| with: | |
| path: apps/spreed | |
| repository: nextcloud/spreed | |
| ref: ${{ matrix.nextcloud }} | |
| - name: Install Talk | |
| working-directory: apps/spreed | |
| run: make dev-setup | |
| - name: Enable Talk | |
| run: php occ app:enable spreed | |
| - name: Run tests | |
| working-directory: nc_py_app | |
| run: | | |
| coverage run --data-file=.coverage.ci -m pytest | |
| coverage combine && coverage xml -o coverage_pgsql_${{ matrix.nextcloud }}.xml | |
| - name: Upload Codecov to artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage_pgsql_${{ matrix.nextcloud }}.xml | |
| path: nc_py_app/coverage_pgsql_${{ matrix.nextcloud }}.xml | |
| if-no-files-found: error | |
| - name: Upload NC logs | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: nc_log_pgsql_${{ matrix.nextcloud }} | |
| path: data/nextcloud.log | |
| if-no-files-found: warn | |
| tests-upload-coverage: | |
| needs: [tests-maria, tests-pgsql] | |
| permissions: | |
| contents: none | |
| runs-on: ubuntu-22.04 | |
| name: Upload Coverage | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download Coverage Artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: coverage | |
| pattern: coverage_* | |
| merge-multiple: true | |
| - name: Upload report to Codecov | |
| uses: codecov/codecov-action@v6 | |
| 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" |