From a05b635aefa4f68959703ac18b108b037ecbe73a Mon Sep 17 00:00:00 2001 From: Klaus Purer <22799-klausi@users.noreply.drupalcode.org> Date: Fri, 9 Aug 2024 14:36:31 +0000 Subject: [PATCH] test(gitlab): Switch to drupal.org Gitlab testing (#3467189) --- .codecov.yml | 6 -- .cspell-project-words.txt | 5 -- .cspell.json | 25 +++++++ .github/workflows/testing.yml | 120 ---------------------------------- .gitlab-ci.yml | 29 ++++++++ .scrutinizer.yml | 6 -- composer.json | 9 +++ phpunit.xml.dist | 24 ------- 8 files changed, 63 insertions(+), 161 deletions(-) delete mode 100644 .codecov.yml delete mode 100644 .cspell-project-words.txt create mode 100644 .cspell.json delete mode 100644 .github/workflows/testing.yml create mode 100644 .gitlab-ci.yml delete mode 100644 .scrutinizer.yml delete mode 100644 phpunit.xml.dist diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index 60349b61d..000000000 --- a/.codecov.yml +++ /dev/null @@ -1,6 +0,0 @@ -codecov: - branch: '8.x-3.x' - -ignore: - - 'tests/**/*' # Ignore the core test directory. - - 'modules/**/tests/**/*' # Ignore sub-module test directories. diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt deleted file mode 100644 index 4303e1a55..000000000 --- a/.cspell-project-words.txt +++ /dev/null @@ -1,5 +0,0 @@ -dataproducer -dataproducers -GraphiQL -graphqls -webonyx diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 000000000..005fca4da --- /dev/null +++ b/.cspell.json @@ -0,0 +1,25 @@ +{ + "description": "Cspell config for graphql module.", + "language": "en-US", + "allowCompoundWords": false, + "globRoot": ".", + "minWordLength": 4, + "ignorePaths": [ + "assets/explorer/dist/*", + "assets/voyager/dist/*" + ], + "dictionaries": [], + "dictionaryDefinitions": [], + "words": [ + "dataproducer", + "dataproducers", + "GraphiQL", + "graphqls", + "webonyx" + ], + "flagWords": [ + "e-mail", + "grey", + "queuing" + ] +} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml deleted file mode 100644 index 89da49b3d..000000000 --- a/.github/workflows/testing.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: Tests -on: - push: - branches: [ 8.x-4.x ] - pull_request: - branches: [ 8.x-4.x ] -jobs: - drupal: - name: Drupal ${{ matrix.drupal-core }} (PHP ${{ matrix.php-versions }}) - # We cannot use ubuntu-latest right now as it still points to 22.04 and we need a newer database driver. - runs-on: ubuntu-24.04 - env: - extensions: mbstring, xml, pdo_sqlite, gd, opcache - strategy: - fail-fast: false - matrix: - php-versions: ['8.1', '8.2', '8.3'] - drupal-core: ['10.3.x'] - phpstan: ['0'] - include: - # Extra run to test older supported Drupal 10.2.x. - - php-versions: '8.1' - drupal-core: '10.2.x' - phpstan: '0' - # We only need to run PHPStan once on the latest PHP version. - - php-versions: '8.3' - drupal-core: '11.0.x' - phpstan: '1' - steps: - - name: Checkout Drupal core - uses: actions/checkout@v4 - with: - repository: drupal/drupal - ref: ${{ matrix.drupal-core }} - - - name: Checkout graphql module - uses: actions/checkout@v4 - with: - path: modules/graphql - - - name: Setup PHP extension cache - id: extcache - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} - # Ideally this would be based on env.extensions, how can we make a - # hash out of that? - key: cache-v1 - - - name: Cache PHP extensions - uses: actions/cache@v4 - with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} - - - name: Setup PHP, with composer and extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - # Disable Xdebug for better performance. - coverage: none - ini-file: development - extensions: ${{ env.extensions }} - - - name: Get composer cache directory - id: composercache - run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composercache.outputs.dir }} - # Use composer.json for key, if composer.lock is not committed. - # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install Drupal core dependencies - run: | - composer install --no-progress --prefer-dist --optimize-autoloader - composer --no-interaction run-script drupal-phpunit-upgrade - composer config --no-plugins allow-plugins.phpstan/extension-installer true - - # Revisit - check for latest release of dependent modules. - - name: Install GraphQL dependencies - run: | - composer --no-interaction --no-progress require \ - webonyx/graphql-php:^14.8 \ - drupal/typed_data:^2.0 \ - drupal/redirect:dev-1.x - - - name: Run PHPUnit - run: | - cp modules/graphql/phpunit.xml.dist core/phpunit.xml - ./vendor/bin/phpunit --configuration core/phpunit.xml modules/graphql - env: - SIMPLETEST_DB: "sqlite://localhost/:memory:" - - - name: Install PHPStan and Coder dependencies - if: ${{ matrix.phpstan == '1' }} - # Pin the exact Coder version to upgrade manually when we want to. - run: | - composer --no-interaction --no-progress require \ - phpstan/phpstan:^1.11.9 \ - mglaman/phpstan-drupal:^1.1.2 \ - phpstan/phpstan-deprecation-rules:^1.0.0 \ - jangregor/phpstan-prophecy:^1.0.0 \ - phpstan/phpstan-phpunit:^1.4 \ - phpstan/extension-installer:^1.4 - composer --no-interaction --no-progress --with-all-dependencies upgrade drupal/coder:8.3.24 - - - name: Run PHPStan - if: ${{ matrix.phpstan == '1' }} - run: cd modules/graphql && ../../vendor/bin/phpstan analyse - - - name: Run PHPCS - if: ${{ matrix.phpstan == '1' }} - run: cd modules/graphql && ../../vendor/bin/phpcs -p diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..b3671a4a5 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ +################ +# Uses the GitLabCI template for Drupal projects. +# The full documentation is on https://project.pages.drupalcode.org/gitlab_templates/ +################ + +include: + - project: $_GITLAB_TEMPLATES_REPO + ref: $_GITLAB_TEMPLATES_REF + file: + - "/includes/include.drupalci.main.yml" + - "/includes/include.drupalci.variables.yml" + - "/includes/include.drupalci.workflows.yml" + +variables: + SKIP_ESLINT: 1 + SKIP_STYLELINT: 1 + # We only wan to run PHPStan once on the max PHP version, skip default runs. + SKIP_PHPSTAN: 1 + OPT_IN_TEST_PREVIOUS_MINOR: 1 + OPT_IN_TEST_NEXT_MINOR: 1 + OPT_IN_TEST_MAX_PHP: 1 + OPT_IN_TEST_NEXT_MAJOR: 1 + +phpstan (custom): + extends: phpstan + rules: + - when: on_success + needs: + - "composer (next major)" diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 66206882d..000000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,6 +0,0 @@ -filter: - excluded_paths: - - 'tests/*' - -checks: - php: true diff --git a/composer.json b/composer.json index 2db50bd0a..4ac382c37 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,14 @@ "php": ">=8.1", "webonyx/graphql-php": "^14.8.0" }, + "require-dev": { + "drupal/redirect": "^1.0", + "phpstan/phpstan": "^1.11.2", + "mglaman/phpstan-drupal": "^1.1.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "jangregor/phpstan-prophecy": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.0.0", + "phpstan/extension-installer": "^1.0" + }, "minimum-stability": "dev" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 8ca8c2cb7..000000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - ./tests/TestSuites/UnitTestSuite.php - - - ./tests/TestSuites/KernelTestSuite.php - - - - - ../modules/graphql/src - - ../modules/graphql - ../modules/graphql - - - -