diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml index aa8f96286..38328423d 100644 --- a/.github/workflows/oci.yml +++ b/.github/workflows/oci.yml @@ -1,73 +1,138 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + name: PHPUnit on: pull_request: + paths: + - '.github/workflows/**' + - 'appinfo/**' + - 'lib/**' + - 'templates/**' + - 'tests/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + push: branches: + - main - master - stable* +permissions: + contents: read + env: - APP_NAME: firstrunwizard + # Location of the phpunit.xml and phpunit.integration.xml files + PHPUNIT_CONFIG: ./tests/phpunit.xml + PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml jobs: - oci: + phpunit-oci: runs-on: ubuntu-latest strategy: - # do not stop on another job's failure - fail-fast: false matrix: php-versions: ['7.4'] - databases: ['oci'] server-versions: ['stable23'] - name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} - services: oracle: - image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2" + image: deepdiver/docker-oracle-xe-11g # 'wnameless/oracle-xe-11g-r2' ports: - - "1521:1521" + - 1521:1521/tcp steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + - name: Checkout server - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: + submodules: true repository: nextcloud/server ref: ${{ matrix.server-versions }} - - name: Checkout submodules - shell: bash - run: | - auth_header="$(git config --local --get http.https://github.com/.extraheader)" - git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - - name: Checkout app - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: apps/${{ env.APP_NAME }} - - name: Set up PHPUnit - working-directory: apps/${{ env.APP_NAME }} - run: composer i - - name: Set up php ${{ matrix.php-versions }} - uses: "shivammathur/setup-php@v2" + uses: shivammathur/setup-php@v2 with: - php-version: "${{ matrix.php-versions }}" - extensions: mbstring, iconv, fileinfo, intl, oci8 - tools: phpunit:8.5.2 + php-version: ${{ matrix.php-versions }} + extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8 + tools: phpunit coverage: none + - name: Check composer file existence + id: check_composer + uses: andstor/file-existence-action@v1 + with: + files: apps/${{ env.APP_NAME }}/composer.json + + - name: Set up PHPUnit + # Only run if phpunit config file exists + if: steps.check_composer.outputs.files_exists == 'true' + working-directory: apps/${{ env.APP_NAME }} + run: composer i + - name: Set up Nextcloud + env: + DB_PORT: 1521 run: | mkdir data - ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin - php -f index.php - ./occ app:enable --force ${{ env.APP_NAME }} + ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin + ./occ app:enable ${{ env.APP_NAME }} + + - name: Check PHPUnit config file existence + id: check_phpunit + uses: andstor/file-existence-action@v1 + with: + files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }} - name: PHPUnit - working-directory: apps/${{ env.APP_NAME }}/tests - run: phpunit -c phpunit.xml + # Only run if phpunit config file exists + if: steps.check_phpunit.outputs.files_exists == 'true' + working-directory: apps/${{ env.APP_NAME }} + run: phpunit -c ${{ env.PHPUNIT_CONFIG }} + + - name: Check PHPUnit integration config file existence + id: check_integration + uses: andstor/file-existence-action@v1 + with: + files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }} + + - name: Run Nextcloud + # Only run if phpunit integration config file exists + if: steps.check_integration.outputs.files_exists == 'true' + run: php -S localhost:8080 & + + - name: PHPUnit integration + # Only run if phpunit integration config file exists + if: steps.check_integration.outputs.files_exists == 'true' + working-directory: apps/${{ env.APP_NAME }} + run: phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }} + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: phpunit-oci + + if: always() + + name: phpunit-oci-summary + + steps: + - name: Summary status + run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/update-nextcloud-ocp.yml b/.github/workflows/update-nextcloud-ocp.yml new file mode 100644 index 000000000..a396b6f87 --- /dev/null +++ b/.github/workflows/update-nextcloud-ocp.yml @@ -0,0 +1,65 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: Update nextcloud/ocp + +on: + workflow_dispatch: + schedule: + - cron: "5 4 * * 0" + +jobs: + update-nextcloud-ocp: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + branches: ["master", "stable25", "stable24", "stable23"] + + name: update-nextcloud-ocp-${{ matrix.branches }} + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ matrix.branches }} + submodules: true + + - name: Set up php7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: ctype,curl,dom,fileinfo,gd,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip + coverage: none + + - name: Composer install + run: composer install + + - name: Composer update nextcloud/ocp + run: composer require --dev nextcloud/ocp:dev-${{ matrix.branches }} + continue-on-error: true + + - name: Reset checkout dirs + run: | + git clean -f 3rdparty + git clean -f vendor + git checkout 3rdparty vendor + continue-on-error: true + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.COMMAND_BOT_PAT }} + commit-message: Update psalm baseline + committer: GitHub + author: nextcloud-command + signoff: true + branch: automated/noid/${{ matrix.branches }}-update-nextcloud-ocp + title: "[${{ matrix.branches }}] Update nextcloud/ocp dependency" + body: | + Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency + labels: | + dependencies + 3. to review diff --git a/composer.json b/composer.json index 0c103ee58..85d0fced1 100644 --- a/composer.json +++ b/composer.json @@ -1,14 +1,20 @@ { - "name": "nextcloud/firstrunwizard", - "description": "The Nextcloud firstrunwizard", - "license": "AGPL", - "config": { - "optimize-autoloader": true, - "classmap-authoritative": true - }, - "require": { - }, - "scripts": { - "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l" - } + "name": "nextcloud/firstrunwizard", + "description": "The Nextcloud firstrunwizard", + "license": "AGPL", + "config": { + "optimize-autoloader": true, + "classmap-authoritative": true + }, + "scripts": { + "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l" + }, + "require-dev": { + "nextcloud/ocp": "dev-stable23" + }, + "autoload-dev": { + "psr-4": { + "OCP\\": "vendor/nextcloud/ocp/OCP" + } + } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..fd3fce387 --- /dev/null +++ b/composer.lock @@ -0,0 +1,211 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "b434de98d4c85369e3ff30f2927b6460", + "packages": [], + "packages-dev": [ + { + "name": "nextcloud/ocp", + "version": "dev-stable23", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "74fa82bb013bb329eb59b18d6eb94a660d724fea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/74fa82bb013bb329eb59b18d6eb94a660d724fea", + "reference": "74fa82bb013bb329eb59b18d6eb94a660d724fea", + "shasum": "" + }, + "require": { + "php": "^7.3 || ~8.0.0", + "psr/container": "^1.1.1", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "23.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "source": "https://github.com/nextcloud-deps/ocp/tree/stable23" + }, + "time": "2022-08-23T02:31:53+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.3.0" +}