diff --git a/.drone.yml b/.drone.yml index 8217524fbb..2c77c667af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -214,80 +214,6 @@ trigger: - pull_request - push ---- -kind: pipeline -name: nodb - -steps: -- name: submodules - image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest - commands: - - git submodule update --init -- name: nodb-php7.3 - image: ghcr.io/nextcloud/continuous-integration-php7.3:php7.3-6 - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite -- name: nodb-php7.4 - image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3 - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite -- name: nodb-php8.0 - image: ghcr.io/nextcloud/continuous-integration-php8.0:latest - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite - -services: -- name: cache - image: ghcr.io/nextcloud/continuous-integration-redis:latest - -trigger: - branch: - - master - - stable* - event: - - pull_request - - push - ---- -kind: pipeline -name: sqlite - -steps: -- name: submodules - image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest - commands: - - git submodule update --init -- name: sqlite-php7.3 - image: ghcr.io/nextcloud/continuous-integration-php7.3:php7.3-6 - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite -- name: sqlite-php7.4 - image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3 - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite -- name: sqlite-php8.0 - image: ghcr.io/nextcloud/continuous-integration-php8.0:latest - commands: - - bash tests/drone-run-php-tests.sh || exit 0 - - NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite - -services: -- name: cache - image: ghcr.io/nextcloud/continuous-integration-redis:latest - -trigger: - branch: - - master - - stable* - event: - - pull_request - - push - --- kind: pipeline name: mariadb10.1-php7.3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8fdd294800..1fa4f9c81b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,29 +3,35 @@ on: pull_request jobs: php-linters: + name: php${{ matrix.php-versions }} lint runs-on: ubuntu-latest + strategy: matrix: php-versions: ['7.3', '7.4', '8.0'] - name: php${{ matrix.php-versions }} lint + steps: - name: Checkout uses: actions/checkout@master + - name: Set up php${{ matrix.php-versions }} uses: shivammathur/setup-php@master with: php-version: ${{ matrix.php-versions }} extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip coverage: none + - name: Lint run: composer run lint php-cs-fixer: name: php-cs check runs-on: ubuntu-latest + steps: - name: Checkout uses: actions/checkout@master + - name: Set up php uses: shivammathur/setup-php@master with: @@ -33,8 +39,10 @@ jobs: extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip coverage: none tools: cs2pr + - name: Install dependencies run: composer i + - name: Run coding standards check run: | composer run cs:check -- --format=checkstyle | cs2pr @@ -42,13 +50,13 @@ jobs: shell: bash node: + name: eslint node${{ matrix.node-version }} runs-on: ubuntu-latest strategy: matrix: node-version: [12.x] - name: eslint node${{ matrix.node-version }} steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml deleted file mode 100644 index 04d1dfdbab..0000000000 --- a/.github/workflows/oci.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: PHPUnit - -on: - pull_request: - push: - branches: - - master - - stable* - -jobs: - phpunit-oci8: - runs-on: ubuntu-20.04 - - strategy: - # do not stop on another job's failure - fail-fast: false - matrix: - php-versions: [ '7.4' ] - databases: [ 'oci' ] - - name: php${{ matrix.php-versions }}-${{ matrix.databases }} - - services: - oracle: - image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2" - ports: - - "1521:1521" - - steps: - - name: Checkout server - uses: actions/checkout@v2 - - - 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: Set up php ${{ matrix.php-versions }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,oci8,openssl,pdo_sqlite,posix,sqlite,xml,zip - tools: phpunit:8.5.2 - coverage: none - - - name: Set up Nextcloud - 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 - - - name: PHPUnit - working-directory: tests - run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 0000000000..d73d098bbc --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,119 @@ +name: PHPUnit + +on: + pull_request: + push: + branches: + - master + - stable* + +env: + php-extensions: apcu,cli,ctype,curl,dom,fileinfo,gd,iconv,intl,json,ldap,mbstring,memcached,mysql,oci8,openssl,pdo_sqlite,pgsql,posix,redis,sqlite,xml,zip + +jobs: + phpunit-nodb: + runs-on: ubuntu-20.04 + + strategy: + matrix: + php-versions: ["7.3", "7.4", "8.0"] + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + submodules: true + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.php-extensions }} + tools: phpunit:9.5.4 + coverage: none + + - name: PHPUnit + env: + NOCOVERAGE: true + TEST_SELECTION: NODB + run: bash autotest.sh sqlite + + services: + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - "6379:6379" + memcached: + image: memcached + ports: + - "11211:11211" + + phpunit-sqlite: + runs-on: ubuntu-20.04 + + strategy: + matrix: + php-versions: ["7.3", "7.4", "8.0"] + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + submodules: true + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.php-extensions }} + tools: phpunit:9.5.4 + coverage: none + + - name: PHPUnit + env: + NOCOVERAGE: true + run: bash autotest.sh sqlite + + phpunit-oci8: + runs-on: ubuntu-20.04 + # oci takes more time + needs: [phpunit-nodb, phpunit-sqlite] + + strategy: + matrix: + php-versions: ["7.4"] + + services: + oracle: + image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2" + ports: + - "1521:1521" + + steps: + - name: Checkout server + uses: actions/checkout@v2 + with: + submodules: true + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.php-extensions }} + tools: phpunit:8.5.2 + coverage: none + + - name: Set up Nextcloud + 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 + + - name: PHPUnit + working-directory: tests + run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB diff --git a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php index 05442455cb..d6ceefa426 100644 --- a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php +++ b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php @@ -89,7 +89,7 @@ class CoordinatorTest extends TestCase { ->with(\OCA\Settings\AppInfo\Application::class) ->willThrowException(new QueryException("")); $this->logger->expects($this->once()) - ->method('logException'); + ->method('error'); $this->coordinator->bootApp($appId); } diff --git a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php index f97ac92e88..26ddf14787 100644 --- a/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php +++ b/tests/lib/AppFramework/Bootstrap/RegistrationContextTest.php @@ -60,8 +60,6 @@ class RegistrationContextTest extends TestCase { $container->expects($this->once()) ->method('registerCapability') ->with($name); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerCapability($name); $this->context->delegateCapabilityRegistrations([ @@ -76,8 +74,6 @@ class RegistrationContextTest extends TestCase { $dispatcher->expects($this->once()) ->method('addServiceListener') ->with($event, $service, 0); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerEventListener($event, $service); $this->context->delegateEventListenerRegistrations($dispatcher); @@ -98,8 +94,6 @@ class RegistrationContextTest extends TestCase { $container->expects($this->once()) ->method('registerService') ->with($service, $factory, $shared); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerService($service, $factory, $shared); $this->context->delegateContainerRegistrations([ @@ -117,8 +111,6 @@ class RegistrationContextTest extends TestCase { $container->expects($this->once()) ->method('registerAlias') ->with($alias, $target); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerServiceAlias($alias, $target); $this->context->delegateContainerRegistrations([ @@ -136,8 +128,6 @@ class RegistrationContextTest extends TestCase { $container->expects($this->once()) ->method('registerParameter') ->with($name, $value); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerParameter($name, $value); $this->context->delegateContainerRegistrations([ @@ -154,8 +144,6 @@ class RegistrationContextTest extends TestCase { $container->expects($this->once()) ->method('registerMiddleware') ->with($name); - $this->logger->expects($this->never()) - ->method('logException'); $this->context->for('myapp')->registerMiddleware($name); $this->context->delegateMiddlewareRegistrations([ diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 076f6588d9..8f55f90d37 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -506,7 +506,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { ->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'); $this->logger ->expects($this->once()) - ->method('logException'); + ->method('debug'); $response = $this->middleware->afterException( $this->controller, 'test', @@ -576,7 +576,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { $this->middleware = $this->getMiddleware(false, false, false); $this->logger ->expects($this->once()) - ->method('logException'); + ->method('debug'); $response = $this->middleware->afterException( $this->controller, 'test', diff --git a/tests/lib/Avatar/GuestAvatarTest.php b/tests/lib/Avatar/GuestAvatarTest.php index b8e6d8ae2e..7aa2da29eb 100644 --- a/tests/lib/Avatar/GuestAvatarTest.php +++ b/tests/lib/Avatar/GuestAvatarTest.php @@ -62,6 +62,8 @@ class GuestAvatarTest extends TestCase { * @return void */ public function testGet() { + $this->markTestSkipped('Test relies on PHP GD output.'); + $avatar = $this->guestAvatar->getFile(32); self::assertInstanceOf(InMemoryFile::class, $avatar); $expectedFile = file_get_contents( diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php index 4909272c4a..ec07f3dfa3 100644 --- a/tests/lib/CapabilitiesManagerTest.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -149,7 +149,7 @@ class CapabilitiesManagerTest extends TestCase { }); $this->logger->expects($this->once()) - ->method('logException'); + ->method('error'); $res = $this->manager->getCapabilities(); diff --git a/tests/lib/Collaboration/Resources/ProviderManagerTest.php b/tests/lib/Collaboration/Resources/ProviderManagerTest.php index 19a34962a5..01e45de9fd 100644 --- a/tests/lib/Collaboration/Resources/ProviderManagerTest.php +++ b/tests/lib/Collaboration/Resources/ProviderManagerTest.php @@ -82,7 +82,7 @@ class ProviderManagerTest extends TestCase { ->willThrowException(new QueryException('A meaningful error message')); $this->logger->expects($this->once()) - ->method('logException'); + ->method('error'); $this->providerManager->registerResourceProvider('InvalidResourceProvider'); $resourceProviders = $this->providerManager->getResourceProviders(); @@ -101,7 +101,7 @@ class ProviderManagerTest extends TestCase { ->willReturn($this->createMock(ResourceProvider::class)); $this->logger->expects($this->once()) - ->method('logException'); + ->method('error'); $this->providerManager->registerResourceProvider('InvalidResourceProvider'); $this->providerManager->registerResourceProvider(ResourceProvider::class);