Skip to content
Snippets Groups Projects
Commit 0d7b5f2a authored by Jibran Ijaz's avatar Jibran Ijaz
Browse files

Issue #3406391 by jibran: Add Gitlab CI support

parent 006ce471
No related branches found
Tags 8.x-1.11
1 merge request!15Issue #3406391 by jibran: Add Gitlab CI support
Pipeline #61061 passed
Showing
with 140 additions and 25 deletions
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
# EXPERIMENTAL: For Drupal 7, remove the above line and uncomment the below.
# - '/includes/include.drupalci.main-d7.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
variables:
_TARGET_PHP: "8.1"
# SKIP_ESLINT: '1'
# Broaden test coverage. Current Drupal version is 10.1.x.
# Opt in to testing previous & next minor (Drupal 10.0.x and 10.2.x).
# OPT_IN_TEST_PREVIOUS_MINOR: '1'
OPT_IN_TEST_NEXT_MINOR: '1'
# Opt in to testing previous major (Drupal 9.5.x).
# OPT_IN_TEST_PREVIOUS_MAJOR: '1'
# Show more log output
_PHPUNIT_EXTRA: '--verbose'
# Convenient, and we have no secrets.
_SHOW_ENVIRONMENT_VARIABLES: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
......@@ -15,7 +15,7 @@
}
},
"require": {
"drupal/core": "^9 || ^10",
"drupal/core": "^10.1",
"drupal/entity": "^1.0",
"softcreatr/jsonpath": "^0.7 || ^0.8",
"php": ">=8.1"
......
......@@ -2,7 +2,7 @@ name: 'Data Pipelines'
package: Data Pipelines
type: module
description: 'Provides the ability to manage datasets.'
core_version_requirement: ^9 || ^10
core_version_requirement: ^10.1
php: 8.0
dependencies:
- drupal:link
......
......@@ -37,6 +37,7 @@ function data_pipelines_post_update_add_machine_name(&$sandbox = NULL) {
->condition('machine_name', $machine_name)
->range(0, 1)
->count()
->accessCheck(FALSE)
->execute();
};
foreach ($datasets as $id => $dataset) {
......
......@@ -2,7 +2,7 @@ name: 'Data Pipelines - Elasticsearch'
package: Testing
type: module
description: 'Provides an ElasticSearch destination for data pipelines.'
core_version_requirement: ^9 || ^10
core_version_requirement: ^10.1
php: 8.0
dependencies:
- data_pipelines:data_pipelines
......@@ -6,6 +6,7 @@ use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Utility\Error;
use Drupal\data_pipelines\DatasetData;
use Drupal\data_pipelines\DatasetPipelinePluginManager;
use Drupal\data_pipelines\Destination\DatasetDestinationPluginBase;
......@@ -82,7 +83,7 @@ class ElasticSearchDestination extends DatasetDestinationPluginBase implements C
* @param \Elasticsearch\Client|null $client
* The client. Used for testing.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, DatasetPipelinePluginManager $pipeline_manager, LoggerInterface $logger, Client $client = NULL) {
final public function __construct(array $configuration, $plugin_id, $plugin_definition, DatasetPipelinePluginManager $pipeline_manager, LoggerInterface $logger, Client $client = NULL) {
parent::__construct($configuration + $this->defaultConfiguration(), $plugin_id, $plugin_definition);
$this->logger = $logger;
$this->client = $client;
......@@ -93,7 +94,7 @@ class ElasticSearchDestination extends DatasetDestinationPluginBase implements C
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
return new static(
$configuration,
$plugin_id,
......@@ -240,7 +241,7 @@ class ElasticSearchDestination extends DatasetDestinationPluginBase implements C
return $this->getClient()->ping();
}
catch (ElasticsearchException $e) {
watchdog_exception('data_pipelines', $e);
Error::logException($this->logger, $e);
return FALSE;
}
}
......@@ -296,7 +297,7 @@ class ElasticSearchDestination extends DatasetDestinationPluginBase implements C
$this->getClient()->indices()->create($index_params_base + $index_params);
}
catch (\Exception $e) {
watchdog_exception('data_pipelines', $e);
Error::logException($this->logger, $e);
throw new CouldNotCreateIndexException(sprintf("Failed to create index %s", $index_id), 0, $e);
}
}
......
name: Data Pipelines - Elasticsearch - Test Pipelines
package: Data Pipelines
description: 'Provides tests data set plugins for Data Pipelines - Elasticsearch'
core_version_requirement: ^9 || ^10
core_version_requirement: ^10.1
php: 8.0
type: module
dependencies:
......
......@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Drupal\Tests\data_pipelines_elasticsearch\Kernel;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\data_pipelines\DatasetPipelinePluginManager;
use Drupal\data_pipelines\Entity\Destination;
use Drupal\data_pipelines\Entity\DestinationInterface;
......@@ -13,6 +12,7 @@ use Drupal\Tests\data_pipelines\Kernel\DatasetKernelTestBase;
use Elasticsearch\Client;
use Elasticsearch\Namespaces\IndicesNamespace;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\NullLogger;
/**
......
......@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Drupal\Tests\data_pipelines_elasticsearch\Kernel;
use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\data_pipelines\DatasetData;
use Drupal\data_pipelines\DatasetPipelinePluginManager;
use Drupal\data_pipelines\Entity\DestinationInterface;
......@@ -14,6 +13,7 @@ use Drupal\Tests\data_pipelines\Kernel\DatasetKernelTestBase;
use Elasticsearch\Client;
use Elasticsearch\Namespaces\IndicesNamespace;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Psr\Log\NullLogger;
/**
......@@ -161,7 +161,7 @@ class ElasticsearchDestinationTest extends DatasetKernelTestBase {
$bulk = [
'index' => 'foo_' . $dataset->getMachineName(),
'body' => []
'body' => [],
];
foreach ($dataset->getDataIterator() as $delta => $data) {
assert($data instanceof DatasetData);
......
<?php
/**
* @file
*/
declare(strict_types=1);
namespace Drupal\data_pipelines\Destination;
use Drupal\data_pipelines\Entity\DatasetInterface;
/**
* Processing operation enum.
*/
enum ProcessingOperationEnum: string {
case BEGIN = 'begin';
......
......@@ -39,7 +39,7 @@ class DestinationForm extends EntityForm {
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* The messenger service.
*/
public function __construct(EntityStorageInterface $storage, DatasetDestinationPluginManager $destinationPluginManager, MessengerInterface $messenger) {
final public function __construct(EntityStorageInterface $storage, DatasetDestinationPluginManager $destinationPluginManager, MessengerInterface $messenger) {
$this->storage = $storage;
$this->destinationPluginManager = $destinationPluginManager;
$this->messenger = $messenger;
......@@ -220,6 +220,7 @@ class DestinationForm extends EntityForm {
]));
}
$form_state->setRedirectUrl($destination->toUrl('collection'));
return $status;
}
}
......@@ -50,7 +50,7 @@ abstract class FileDestinationBase extends DatasetDestinationPluginBase implemen
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $streamWrapperManager
* The stream wrapper manager.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, FileSystemInterface $fileSystem, StreamWrapperManagerInterface $streamWrapperManager) {
final public function __construct(array $configuration, $plugin_id, $plugin_definition, FileSystemInterface $fileSystem, StreamWrapperManagerInterface $streamWrapperManager) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->fileSystem = $fileSystem;
$this->streamWrapperManager = $streamWrapperManager;
......
......@@ -27,7 +27,7 @@ class SourceDeriver extends DeriverBase implements ContainerDeriverInterface {
* @param \Drupal\data_pipelines\Source\Resource\SourceResourceManager $source_resource_manager
* The source resource manager.
*/
public function __construct(SourceResourceManager $source_resource_manager) {
final public function __construct(SourceResourceManager $source_resource_manager) {
$this->sourceResourceManager = $source_resource_manager;
}
......
......@@ -44,7 +44,7 @@ abstract class DatasetSourceBase extends PluginBase implements DatasetSourceInte
* @param \Drupal\Core\Logger\LoggerChannelInterface $logger_channel
* The logger channel service.
*/
public function __construct(array $configuration, string $plugin_id, array $plugin_definition, SourceResourceInterface $source_resource, LoggerChannelInterface $logger_channel) {
final public function __construct(array $configuration, string $plugin_id, array $plugin_definition, SourceResourceInterface $source_resource, LoggerChannelInterface $logger_channel) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->sourceResource = $source_resource;
$this->loggerChannel = $logger_channel;
......
......@@ -17,11 +17,12 @@ final class File extends SourceResourceBase {
/**
* {@inheritDoc}
*/
public function getResource(DatasetInterface $dataset, string $field_name) {
public function getResource(DatasetInterface $dataset, string $field_name): mixed {
if (!empty($file = self::getFieldValue($dataset, $field_name, 'entity'))) {
assert($file instanceof FileInterface);
return fopen($file->getFileUri(), 'r');
}
return NULL;
}
/**
......
......@@ -23,7 +23,7 @@ interface SourceResourceInterface {
* @return resource
* A resource.
*/
public function getResource(DatasetInterface $dataset, string $field_name);
public function getResource(DatasetInterface $dataset, string $field_name): mixed;
/**
* Gets the base field definition for the resource field.
......
......@@ -16,7 +16,7 @@ final class Text extends SourceResourceBase {
/**
* {@inheritdoc}
*/
public function getResource(DatasetInterface $dataset, string $field_name) {
public function getResource(DatasetInterface $dataset, string $field_name): mixed {
if (!empty($string = self::getFieldValue($dataset, $field_name))) {
if ($resource = fopen('php://temp', 'r+')) {
fwrite($resource, $string);
......@@ -24,6 +24,7 @@ final class Text extends SourceResourceBase {
return $resource;
}
}
return NULL;
}
/**
......
......@@ -86,7 +86,7 @@ final class Uri extends SourceResourceBase {
/**
* {@inheritDoc}
*/
public function getResource(DatasetInterface $dataset, string $field_name) {
public function getResource(DatasetInterface $dataset, string $field_name): mixed {
if (!empty($uri = self::getFieldValue($dataset, $field_name))) {
$cid = sprintf('dataset:%s', $dataset->getMachineName());
if ($cached = $this->cacheBackend->get($cid)) {
......
name: Data Pipelines - Test Pipelines
package: Testing
description: 'Provides tests data set plugins'
core_version_requirement: ^9 || ^10
core_version_requirement: ^10.1
php: 8.0
type: module
dependencies:
......
......@@ -41,7 +41,7 @@ class StateDestination extends DatasetDestinationPluginBase implements Container
* @param \Drupal\Core\State\StateInterface $state
* The state service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state) {
final public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->state = $state;
}
......@@ -102,6 +102,7 @@ class StateDestination extends DatasetDestinationPluginBase implements Container
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
return [];
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment