Skip to content

Commit

Permalink
Merge pull request #9 from antistatique/11x/drupal-10.2
Browse files Browse the repository at this point in the history
drop tests support on Drupal <= 9.4 && add support of Drupal 10.2 & 11.0-dev
  • Loading branch information
WengerK authored Apr 4, 2024
2 parents 5bd272d + 49f4a48 commit 2e2e37d
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 86 deletions.
46 changes: 21 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,24 @@ jobs:

strategy:
matrix:
drupal_version: ['9.3', '9.4', '9.5', '10.0']
drupal_version: ['9.5', '10.0', '10.1', '10.2']
module: [ 'vercel_deploy' ]
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 persistant 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: 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
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

upgrade-status:
name: Upgrade Status
Expand All @@ -45,23 +41,23 @@ jobs:
module: ['vercel_deploy']

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: Disable incompatible module
run: docker-compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush pmu page_cache -y
run: docker compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush pmu page_cache -y
- name: Enable the module
run: docker-compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush en ${{ matrix.module }} -y
run: docker compose exec -T drupal wait-for-it db:3306 -- ./vendor/bin/drush en ${{ matrix.module }} -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 }}
26 changes: 13 additions & 13 deletions .github/workflows/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1
- uses: actions/checkout@master
tools: cs2pr, composer:v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/phpcs ./ --report=checkstyle | cs2pr

Expand All @@ -23,10 +23,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1, phpmd
- uses: actions/checkout@master
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 @@ -37,10 +37,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: cs2pr, composer:v1, phpcpd
- uses: actions/checkout@master
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/

Expand All @@ -49,8 +49,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- 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
- 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
- name: Run phpdd
run: docker-compose run drupal phpdd ./web/modules/contrib/vercel_deploy/ --file-extensions php,module,inc,install,test,profile,theme,info --exclude vendor
run: docker compose run drupal phpdd ./web/modules/contrib/vercel_deploy/ --file-extensions php,module,inc,install,test,profile,theme,info --exclude vendor
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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.2.x

### Removed
- drop tests support on Drupal <= 9.4

### Fixed
- fix phpcs use statements sorted alphabetically

## [1.1.0] - 2022-12-02
### Added
Expand Down
42 changes: 22 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ https://github.com/antistatique/drupal-vercel-deploy/pulls

## 📦 Repositories

Drupal repo

```
$ git remote add drupal [email protected]:project/vercel_deploy.git
```

Github repo
```
$ git remote add drupal [email protected]:project/vercel_deploy.git
```

Drupal repo
```
$ git remote add github [email protected]:antistatique/drupal-vercel-deploy.git
```
```
$ git remote add github [email protected]:antistatique/drupal-vercel-deploy.git
```

## 🔧 Prerequisites

Expand All @@ -25,31 +27,31 @@ globally on your environment:
* drush
* Latest dev release of Drupal 9.x/10.x.
* docker
* docker-compose
* docker compose

### Project bootstrap

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

docker-compose build --pull --build-arg BASE_IMAGE_TAG=9.3 drupal
docker compose build --pull --build-arg BASE_IMAGE_TAG=10.2 drupal
# (get a coffee, this will take some time...)
docker-compose up -d drupal
docker-compose exec -u www-data drupal drush site-install standard \
docker compose up -d drupal
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 vercel_deploy -y
docker compose exec drupal drush user:password admin admin
docker compose exec drupal drush en vercel_deploy -y

## 🏆 Tests

We use the [Docker for Drupal Contrib images](https://hub.docker.com/r/wengerk/drupal-for-contrib) to run testing on our project.

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

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

## 🚔 Check Drupal coding standards & Drupal best practices
Expand All @@ -70,7 +72,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 @@ -84,14 +86,14 @@ PHP_CodeSniffer is an essential development tool that ensures your code remains
clean and consistent.

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

Automatically fix coding standards

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

Expand All @@ -102,7 +104,7 @@ https://github.com/phpmd/phpmd
Detect overcomplicated expressions & Unused parameters, methods, properties.

```
$ docker-compose exec drupal phpmd ./web/modules/contrib/vercel_deploy/ text \
$ docker compose exec drupal phpmd ./web/modules/contrib/vercel_deploy/ text \
./phpmd.xml \
--suffixes php,module,inc,install,test,profile,theme,css,info,txt \
--exclude *Test.php,*vendor/*
Expand All @@ -115,7 +117,7 @@ https://github.com/sebastianbergmann/phpcpd
`phpcpd` is a Copy/Paste Detector (CPD) for PHP code.

```
$ docker-compose exec drupal phpcpd ./web/modules/contrib/vercel_deploy/src \
$ docker compose exec drupal phpcpd ./web/modules/contrib/vercel_deploy/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/
Expand All @@ -128,7 +130,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/vercel_deploy/ \
$ docker compose exec drupal phpdd ./web/modules/contrib/vercel_deploy/ \
--file-extensions php,module,inc,install,test,profile,theme,info \
--exclude vendor
```
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=9.3
ARG BASE_IMAGE_TAG=10.2
FROM wengerk/drupal-for-contrib:${BASE_IMAGE_TAG}

# Disable deprecation notice.
Expand Down
21 changes: 4 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,16 @@ This module works on both Drupal 8, Drupal 9 & Drupal 10 !
The Drupal 8, Drupal 9 & Drupal 10 version of this module requires nothing !
Feel free to use it.

## Supporting organizations

This project is sponsored by [Antistatique](https://www.antistatique.net), a Swiss Web Agency.
Visit us at [www.antistatique.net](https://www.antistatique.net) or
[Contact us](mailto:[email protected]).

## Getting Started

We highly recommend you to install the module using `composer`.

<h2>Getting Started</h2>


```bash
$ composer require drupal/vercel_deploy
```

You can also install it using the `drush` or `drupal console` cli.

```bash
$ drush dl vercel_deploy
```
## Supporting organizations

```bash
$ drupal module:install vercel_deploy
```
This project is sponsored by [Antistatique](https://www.antistatique.net), a Swiss Web Agency.
Visit us at [www.antistatique.net](https://www.antistatique.net) or
[Contact us](mailto:[email protected]).
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
8 changes: 4 additions & 4 deletions scripts/hooks/post-commit
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
echo "\n🚔 \033[0;32mRunning Code Sniffer Drupal & DrupalPractice for ./web/modules/contrib/vercel_deploy/ ...\033[0m"
docker-compose exec drupal ./vendor/bin/phpcs ./web/modules/contrib/vercel_deploy/
docker compose exec drupal ./vendor/bin/phpcs ./web/modules/contrib/vercel_deploy/

echo "\n💩 \033[0;32mRunning PHP Mess Detector ...\033[0m"
docker-compose exec drupal phpmd ./web/modules/contrib/vercel_deploy/ text ./phpmd.xml --suffixes php,module,inc,install,test,profile,theme,css,info,txt --exclude *Test.php,*vendor/*
docker compose exec drupal phpmd ./web/modules/contrib/vercel_deploy/ text ./phpmd.xml --suffixes php,module,inc,install,test,profile,theme,css,info,txt --exclude *Test.php,*vendor/*

echo "\n🛂 \033[0;32mRunning PHP Copy/Paste Detector ...\033[0m"
docker-compose exec drupal phpcpd ./web/modules/contrib/vercel_deploy/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/
docker compose exec drupal phpcpd ./web/modules/contrib/vercel_deploy/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/

echo "\n🍫 \033[0;32mRunning PhpDeprecationDetector ...\033[0m"
docker-compose exec drupal phpdd ./web/modules/contrib/vercel_deploy/ --file-extensions php,module,inc,install,test,profile,theme,info --exclude vendor
docker compose exec drupal phpdd ./web/modules/contrib/vercel_deploy/ --file-extensions php,module,inc,install,test,profile,theme,info --exclude vendor
6 changes: 3 additions & 3 deletions src/Form/DeployHooksForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Drupal\vercel_deploy\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Url;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Provides the Deploy Hooks confirmation form.
Expand Down
2 changes: 1 addition & 1 deletion src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\vercel_deploy\Form;

use Drupal\Component\Utility\Xss;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Xss;

/**
* Configure Vercel Deploy settings form.
Expand Down
2 changes: 1 addition & 1 deletion vercel_deploy.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Vercel Deploy
description: Allow Vercel Vercel deployments integration with the corresponding permission set.
package: Utility
type: module
core_version_requirement: ^9.3 || ^10
core_version_requirement: ^9.5 || ^10 || ^11

dependencies:
- drupal:toolbar
Expand Down

0 comments on commit 2e2e37d

Please sign in to comment.