diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 9d623588e..000000000 --- a/.drone.yml +++ /dev/null @@ -1,131 +0,0 @@ -kind: pipeline -name: checkers -steps: -- name: compatibility - image: nextcloudci/php7.3:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server - # Code checker - - ./occ app:check-code $APP_NAME -c strong-comparison - - ./occ app:check-code $APP_NAME -c deprecation - - cd apps/$APP_NAME/ -- name: syntax-php7.2 - image: nextcloudci/php7.2:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - - composer install - - ./vendor/bin/parallel-lint --exclude ./vendor/ . -- name: syntax-php7.3 - image: nextcloudci/php7.3:php7.3-2 - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - - composer install - - ./vendor/bin/parallel-lint --exclude ./vendor/ . -- name: syntax-php7.4 - image: nextcloudci/php7.4:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - - composer install - - ./vendor/bin/parallel-lint --exclude ./vendor/ . -trigger: - branch: - - master - - stable* - event: - - pull_request - - push ---- -kind: pipeline -name: unit-php7.3 -steps: - - name: php7.3 - image: nextcloudci/php7.3:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server/ - - php occ app:enable deck - - cd apps/$APP_NAME - - composer install - - phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml - - phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml -trigger: - branch: - - master - - stable* - event: - - pull_request - - push -kind: pipeline -name: unit-php7.4 -steps: - - name: php7.4 - image: nextcloudci/php7.4:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server/ - - php occ app:enable deck - - cd apps/$APP_NAME - - composer install - - phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml - - phpunit -c tests/phpunit.integration.xml --coverage-clover build/php-integration.coverage.xml -trigger: - branch: - - master - - stable* - event: - - pull_request - - push ---- -kind: pipeline -name: integration -steps: - - name: integration - image: nextcloudci/php7.3:latest - environment: - APP_NAME: deck - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server/ - - php occ app:enable deck - - cd apps/$APP_NAME - - cd tests/integration - - ./run.sh || true -trigger: - branch: - - master - - stable* - event: - - pull_request - - push diff --git a/.github/workflows/app-code-check.yml b/.github/workflows/app-code-check.yml new file mode 100644 index 000000000..202d78d8c --- /dev/null +++ b/.github/workflows/app-code-check.yml @@ -0,0 +1,55 @@ +name: PHP AppCode Check + +on: + pull_request: + push: + branches: + - master + - stable* + +env: + APP_NAME: deck + +jobs: + unit-tests: + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: ['7.4'] + server-versions: ['master', 'stable18', 'stable19', 'stable20'] + + name: AppCode check php${{ matrix.php-versions }}-${{ matrix.server-versions }} + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + 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 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite + + - name: Checkout app + uses: actions/checkout@v2 + with: + path: apps/${{ env.APP_NAME }} + + - name: App code check + run: php occ app:check-code ${{ env.APP_NAME }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 000000000..53f66078f --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,215 @@ +name: PHPUnit + +on: + pull_request: + push: + branches: + - master + - stable* + +env: + APP_NAME: deck + +jobs: + php: + runs-on: ubuntu-latest + + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: + php-versions: ['7.4'] + databases: ['sqlite'] + server-versions: ['master'] + + name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + 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 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite + coverage: none + + - name: Set up PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: composer i + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + mkdir data + ./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password + ./occ app:enable --force ${{ env.APP_NAME }} + php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml + + - name: PHPUnit integration + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml + + mysql: + runs-on: ubuntu-latest + + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: + php-versions: ['7.3', '7.4'] + databases: ['mysql'] + server-versions: ['master'] + + name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} + + services: + mysql: + image: mariadb + ports: + - 4444:3306/tcp + env: + MYSQL_ROOT_PASSWORD: rootpassword + options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5 + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + 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 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql + coverage: none + + - name: Set up PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: composer i + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + mkdir data + ./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password + ./occ app:enable --force ${{ env.APP_NAME }} + php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml + + - name: PHPUnit integration + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml + + pgsql: + runs-on: ubuntu-latest + + strategy: + # do not stop on another job's failure + fail-fast: false + matrix: + php-versions: ['7.4'] + databases: ['pgsql'] + server-versions: ['master'] + + name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }} + + services: + postgres: + image: postgres + ports: + - 4444:5432/tcp + env: + POSTGRES_USER: root + POSTGRES_PASSWORD: rootpassword + POSTGRES_DB: nextcloud + options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5 + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + 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 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + tools: phpunit + extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql + coverage: none + + - name: Set up PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: composer i + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + mkdir data + ./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password + ./occ app:enable --force ${{ env.APP_NAME }} + php -S localhost:8080 & + + - name: PHPUnit + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml + + - name: PHPUnit integration + working-directory: apps/${{ env.APP_NAME }} + run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1653527da..000000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: php -services: - - mysql -php: - - 7.3 -env: - - CORE_BRANCH=master DB=mysql - -matrix: - include: - - php: 7.2 - env: "DB=sqlite CORE_BRANCH=stable20" - -before_install: - - export PATH="$PWD/vendor/bin:$PATH" - - phpunit --version - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh deck $CORE_BRANCH $DB - - cd ../server - - ./occ app:enable deck - -before_script: - - cd apps/deck - -script: - - composer install - - make test-unit - -after_success: - - bash <(curl -s https://codecov.io/bash) - -after_failure: - - cat ../../data/nextcloud.log - -notifications: - email: false diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 048dc5b3c..3393e6f98 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,7 +23,7 @@ namespace OCA\Deck\AppInfo; -$version = \OC_Util::getVersion()[0]; +$version = \OCP\Util::getVersion()[0]; if ($version >= 20) { class Application extends Application20 { } diff --git a/lib/AppInfo/ApplicationLegacy.php b/lib/AppInfo/ApplicationLegacy.php index 22a3f6ac5..eec44dd4b 100644 --- a/lib/AppInfo/ApplicationLegacy.php +++ b/lib/AppInfo/ApplicationLegacy.php @@ -24,7 +24,6 @@ namespace OCA\Deck\AppInfo; use Exception; -use OC_Util; use OCA\Deck\Activity\CommentEventHandler; use OCA\Deck\Capabilities; use OCA\Deck\Collaboration\Resources\ResourceProvider; @@ -172,7 +171,7 @@ class ApplicationLegacy extends App { } protected function registerCollaborationResources(): void { - $version = OC_Util::getVersion()[0]; + $version = \OCP\Util::getVersion()[0]; if ($version < 16) { return; } diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 477add264..516ca158a 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -532,7 +532,7 @@ class BoardService { $this->changeHelper->boardChanged($boardId); // TODO: use the dispatched event for this - $version = \OC_Util::getVersion()[0]; + $version = \OCP\Util::getVersion()[0]; if ($version >= 16) { try { $resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class); @@ -621,7 +621,7 @@ class BoardService { $this->activityManager->triggerEvent(ActivityManager::DECK_OBJECT_BOARD, $acl, ActivityManager::SUBJECT_BOARD_UNSHARE); $this->changeHelper->boardChanged($acl->getBoardId()); - $version = \OC_Util::getVersion()[0]; + $version = \OCP\Util::getVersion()[0]; if ($version >= 16) { try { $resourceProvider = \OC::$server->query(\OCA\Deck\Collaboration\Resources\ResourceProvider::class);