Skip to content

Commit

Permalink
add support of Drupal 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Apr 3, 2024
1 parent 712ff71 commit fa3dd83
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 63 deletions.
65 changes: 29 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,22 @@ jobs:

strategy:
matrix:
drupal_version: ['10.0']
drupal_version: ['10.0', '10.1', '10.2']
module: ['nbsp']
experimental: [false]

steps:
- uses: actions/checkout@v3
- run: docker-compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker-compose stack
run: docker-compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
continue-on-error: ${{ matrix.experimental }}
- uses: actions/checkout@v4
- run: docker compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker compose stack
run: docker compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
- name: Up a persistent Docker Container
run: docker-compose -f docker-compose.yml up -d drupal
run: docker compose -f docker-compose.yml up -d drupal
- name: wait on Docker to be ready, especially Apache that takes many seconds to be up
run: docker-compose exec -T drupal wait-for-it drupal:80 -t 60
run: docker compose exec -T drupal wait-for-it drupal:80 -t 60
- name: wait on Docker to be ready, especially MariaDB that takes many seconds to be up
run: docker-compose exec -T drupal wait-for-it db:3306 -t 60
run: docker compose exec -T drupal wait-for-it db:3306 -t 60
- name: Run unit tests
run: docker-compose -f docker-compose.yml exec -T -u www-data drupal phpunit --no-coverage --group=${{ matrix.module }} --exclude-group=${{ matrix.module }}_functional --configuration=/var/www/html/phpunit.xml
continue-on-error: ${{ matrix.experimental }}
run: docker compose -f docker-compose.yml exec -T -u www-data drupal phpunit --no-coverage --group=${{ matrix.module }} --exclude-group=${{ matrix.module }}_functional --configuration=/var/www/html/phpunit.xml

tests-functional:
name: Functional Tests
Expand All @@ -39,30 +36,26 @@ jobs:

strategy:
matrix:
drupal_version: ['10.0']
drupal_version: ['10.0', '10.1', '10.2']
module: ['nbsp']
experimental: [false]

steps:
- uses: actions/checkout@v3
- run: docker-compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker-compose stack
run: docker-compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
continue-on-error: ${{ matrix.experimental }}
- uses: actions/checkout@v4
- run: docker compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker compose stack
run: docker compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
- name: Up a persistent Docker Container
run: docker-compose -f docker-compose.yml up -d drupal chrome
run: docker compose -f docker-compose.yml up -d drupal chrome
- name: wait on Docker to be ready, especially Apache that takes many seconds to be up
run: docker-compose exec -T drupal wait-for-it drupal:80 -t 60
run: docker compose exec -T drupal wait-for-it drupal:80 -t 60
- name: wait on Docker to be ready, especially MariaDB that takes many seconds to be up
run: docker-compose exec -T drupal wait-for-it db:3306 -t 60
run: docker compose exec -T drupal wait-for-it db:3306 -t 60
- name: wait on Docker to be ready, especially Chrome that takes many seconds to be up
run: docker-compose exec -T drupal wait-for-it chrome:9515 -t 60
run: docker compose exec -T drupal wait-for-it chrome:9515 -t 60
- name: Bootstrap Drupal
run: docker-compose -f docker-compose.yml exec -T -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y
continue-on-error: ${{ matrix.experimental }}
run: docker compose -f docker-compose.yml exec -T -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y
- name: Run tests
run: docker-compose -f docker-compose.yml exec -T -u www-data drupal phpunit --no-coverage --group=${{ matrix.module }}_functional --configuration=/var/www/html/phpunit.xml --fail-on-risky
continue-on-error: ${{ matrix.experimental }}
run: docker compose -f docker-compose.yml exec -T -u www-data drupal phpunit --no-coverage --group=${{ matrix.module }}_functional --configuration=/var/www/html/phpunit.xml --fail-on-risky

upgrade-status:
name: Upgrade Status
Expand All @@ -74,19 +67,19 @@ jobs:
module: ['nbsp']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- run: docker-compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker-compose stack
run: docker-compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
- run: docker compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker compose stack
run: docker compose -f docker-compose.yml build --pull --build-arg BASE_IMAGE_TAG=${{ matrix.drupal_version }} drupal
- name: Up a persistent Docker Container
run: docker-compose -f docker-compose.yml up -d drupal
run: docker compose -f docker-compose.yml up -d drupal
- name: Add upgrade status dependency
run: docker-compose exec -T drupal wait-for-it db:3306 -- composer require --dev drupal/upgrade_status --no-interaction
run: docker compose exec -T drupal wait-for-it db:3306 -- composer require --dev drupal/upgrade_status --no-interaction
- name: Bootstrap Drupal
run: docker-compose -f docker-compose.yml exec -T -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y
run: docker compose -f docker-compose.yml exec -T -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y
- name: Enable upgrade status
run: docker-compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush en upgrade_status -y
run: docker compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush en upgrade_status -y
- name: Run upgrade status
run: docker-compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush upgrade_status:analyze ${{ matrix.module }}
run: docker compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush upgrade_status:analyze ${{ matrix.module }}
24 changes: 12 additions & 12 deletions .github/workflows/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install modules
run: yarn
- name: Run ESLint
Expand All @@ -16,7 +16,7 @@ jobs:
name: prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install modules
run: yarn
- name: Run Prettier
Expand All @@ -29,10 +29,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1
- uses: actions/checkout@v3
tools: cs2pr, composer:v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/phpcs ./ --report=checkstyle | cs2pr

Expand All @@ -43,10 +43,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1, phpmd
- uses: actions/checkout@v3
tools: cs2pr, composer:v2, phpmd
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: phpmd ./ text ./phpmd.xml --suffixes php,module,inc,install,test,profile,theme,css,info,txt --exclude *Test.php,*vendor/*

Expand All @@ -57,18 +57,18 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1, phpcpd
- uses: actions/checkout@v3
tools: cs2pr, composer:v2, phpcpd
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: phpcpd ./src --suffix .php --suffix .module --suffix .inc --suffix .install --suffix .test --suffix .profile --suffix .theme --suffix .css --suffix .info --suffix .txt --exclude *.md --exclude *.info.yml --exclude tests --exclude vendor/

phpdd:
name: PhpDeprecationDetector (phpdd)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: docker-compose -f docker-compose.yml pull --include-deps drupal
- name: Build the docker-compose stack
run: docker-compose -f docker-compose.yml build drupal
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- add coverage of Drupal 10.1.x
- add coverage of Drupal 10.2.x

## [3.0.1] - 2023-06-02
### Fixed
Expand Down
26 changes: 13 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ globally on your environment:
* drush
* Latest dev release of Drupal 8.x|9.x.
* docker
* docker-compose
* docker compose

### Project bootstrap

Once run, you will be able to access to your fresh installed Drupal on `localhost::8888`.

docker-compose build --pull --build-arg BASE_IMAGE_TAG=10.0 drupal
docker compose build --pull --build-arg BASE_IMAGE_TAG=10.1 drupal
(get a coffee, this will take some time...)
docker-compose up -d drupal chrome
docker-compose exec -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y
docker compose up -d drupal chrome
docker compose exec -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" -y

# You may be interesed by reseting the admin passowrd of your Docker and install the module using those cmd.
docker-compose exec drupal drush user:password admin admin
docker-compose exec drupal drush en nbsp
docker compose exec drupal drush user:password admin admin
docker compose exec drupal drush en nbsp

## 🚔 Build Javascript

Expand All @@ -52,7 +52,7 @@ We use the [Docker for Drupal Contrib images](https://hub.docker.com/r/wengerk/d

Run testing by stopping at first failure using the following command:

docker-compose exec -u www-data drupal phpunit --group=nbsp --no-coverage --stop-on-failure --configuration=/var/www/html/phpunit.xml
docker compose exec -u www-data drupal phpunit --group=nbsp --no-coverage --stop-on-failure --configuration=/var/www/html/phpunit.xml

## 🚔 Check Javascript best practices

Expand Down Expand Up @@ -82,7 +82,7 @@ The following Analyzer will be downloaded & installed as PHAR:

./scripts/hooks/post-commit
# or run command on the container itself
docker-compose exec drupal bash
docker compose exec drupal bash

#### Running Code Sniffer Drupal & DrupalPractice

Expand All @@ -94,13 +94,13 @@ violations.
PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.

```
$ docker-compose exec drupal ./vendor/bin/phpcs ./web/modules/contrib/nbsp/
$ docker compose exec drupal ./vendor/bin/phpcs ./web/modules/contrib/nbsp/
```

Automatically fix coding standards

```
$ docker-compose exec drupal ./vendor/bin/phpcbf ./web/modules/contrib/nbsp/
$ docker compose exec drupal ./vendor/bin/phpcbf ./web/modules/contrib/nbsp/
```

#### Running PHP Mess Detector
Expand All @@ -110,7 +110,7 @@ https://github.com/phpmd/phpmd
Detect overcomplicated expressions & Unused parameters, methods, properties.

```
$ docker-compose exec drupal phpmd ./web/modules/contrib/nbsp/ text ./phpmd.xml \
$ docker compose exec drupal phpmd ./web/modules/contrib/nbsp/ text ./phpmd.xml \
--suffixes php,module,inc,install,test,profile,theme,css,info,txt --exclude *Test.php,*vendor/*,*node_modules/*
```

Expand All @@ -121,7 +121,7 @@ https://github.com/sebastianbergmann/phpcpd
`phpcpd` is a Copy/Paste Detector (CPD) for PHP code.

```
$ docker-compose exec drupal phpcpd ./web/modules/contrib/nbsp/src --suffix .php --suffix .module --suffix .inc --suffix .install --suffix .test --suffix .profile --suffix .theme --suffix .css --suffix .info --suffix .txt --exclude *.md --exclude *.info.yml --exclude tests --exclude vendor/ --exclude node_modules/
$ docker compose exec drupal phpcpd ./web/modules/contrib/nbsp/src --suffix .php --suffix .module --suffix .inc --suffix .install --suffix .test --suffix .profile --suffix .theme --suffix .css --suffix .info --suffix .txt --exclude *.md --exclude *.info.yml --exclude tests --exclude vendor/ --exclude node_modules/
```

#### Running PhpDeprecationDetector
Expand All @@ -131,7 +131,7 @@ https://github.com/wapmorgan/PhpDeprecationDetector
A scanner that checks compatibility of your code with PHP interpreter versions.

```
$ docker-compose exec drupal phpdd ./web/modules/contrib/nbsp/ \
$ docker compose exec drupal phpdd ./web/modules/contrib/nbsp/ \
--file-extensions php,module,inc,install,test,profile,theme,info --exclude vendor --exclude node_modules
```

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE_TAG=10.0
ARG BASE_IMAGE_TAG=10.1
FROM wengerk/drupal-for-contrib:${BASE_IMAGE_TAG}

# Disable deprecation notice as CKEditor4 module will throw an exception until we remove support of Drupal 9.
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,10 @@
"license": "GPL-2.0-or-later",
"require-dev": {
"drupal/coder": "^8.3.1"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
restart: always

db:
image: mariadb:10.3.7
image: mariadb:10.3.8
environment:
MYSQL_USER: drupal
MYSQL_PASSWORD: drupal
Expand Down

0 comments on commit fa3dd83

Please sign in to comment.