Skip to content

Commit

Permalink
Merge branch 'main' into composer-lock-diff-sticky-pr-comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdavidburns authored Jul 16, 2024
2 parents fbfe18d + 90c919b commit d436532
Show file tree
Hide file tree
Showing 23 changed files with 2,865 additions and 2,687 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/TestStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Verify files were created
run: |
test -f phpcs.xml
test -f phpcs.xml.dist
- name: Fix settings.php
run: |
Expand Down
1,912 changes: 1,027 additions & 885 deletions .pnp.cjs

Large diffs are not rendered by default.

42 changes: 38 additions & 4 deletions .pnp.loader.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .tugboat/steps/1-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ nodejs -v | grep -q v$NODE_MAJOR
shopt -s dotglob
mkdir ../drainpipe-tmp
mv * ../drainpipe-tmp/
composer create-project drupal/recommended-project .
composer create-project drupal/recommended-project:~10.2.7 .
mv ../drainpipe-tmp drainpipe
composer config extra.drupal-scaffold.gitignore true
composer config --json extra.drupal-scaffold.allowed-packages \[\"lullabot/drainpipe\"]
Expand Down
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.2.1.cjs

This file was deleted.

894 changes: 894 additions & 0 deletions .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarnPath: .yarn/releases/yarn-4.2.1.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
75 changes: 11 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,6 @@ for a Drupal site, including:
- Integration with DDEV
- CI integration

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Installation](#installation)
- [Binaries](#binaries)
- [Database Updates](#database-updates)
- [.env support](#env-support)
- [SASS Compilation](#sass-compilation)
- [Setup](#setup)
- [JavaScript Compilation](#javascript-compilation)
- [Setup](#setup-1)
- [Testing](#testing)
- [Static Tests](#static-tests)
- [Excluding Files from PHP_CodeSniffer](#excluding-files-from-php_codesniffer)
- [Functional Tests](#functional-tests)
- [PHPUnit](#phpunit)
- [Nightwatch](#nightwatch)
- [Autofix](#autofix)
- [Hosting Provider Integration](#hosting-provider-integration)
- [Generic](#generic)
- [Importing/Exporting Databases](#importingexporting-databases)
- [Snapshots](#snapshots)
- [Pantheon](#pantheon)
- [GitHub Actions Integration](#github-actions-integration)
- [Composer Lock Diff](#composer-lock-diff)
- [Pantheon](#pantheon-1)
- [GitLab CI Integration](#gitlab-ci-integration)
- [Composer Lock Diff](#composer-lock-diff-1)
- [Pantheon](#pantheon-2)
- [Tugboat](#tugboat)
- [Contributor Docs](#contributor-docs)
- [Peer Review Guidelines for Automated Updates](#peer-review-guidelines-for-automated-updates)
- [Handling Version Ranges](#handling-version-ranges)
- [Handling Test Failures](#handling-test-failures)
- [Conducting the Peer Review](#conducting-the-peer-review)
- [Releases](#releases)
- [drainpipe and drainpipe-dev release process](#drainpipe-and-drainpipe-dev-release-process)
- [NPM package release process](#npm-package-release-process)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

```sh
Expand Down Expand Up @@ -228,34 +186,18 @@ All the below static code analysis tests can be run with `task test:static`
| PHPCS | task test:phpcs | Runs PHPCS with Drupal coding standards provided by [Coder module](https://www.drupal.org/project/coder |


#### Excluding Files from PHP_CodeSniffer

`phpcs.xml` can be altered using Drupal's
[composer scaffold](https://www.drupal.org/docs/develop/using-composer/using-drupals-composer-scaffold#toc_4).
#### Altering PHP_CodeSniffer Configuration

- Create `phpcs.xml` to override the `phpcs.xml.dist` file with overrides being done in:
```
<rule ref="phpcs.xml.dist">
</rule>
```
- Edit `phpcs.xml` in the root of your project, e.g. to add an exclude pattern:
```
<!-- Custom excludes -->
<exclude-pattern>web/sites/sites.php</exclude-pattern>
```
- Create a patch file
```
diff -urN vendor/lullabot/drainpipe-dev/scaffold/phpcs.xml phpcs.xml > patches/custom/phpcs.xml.patch
```
- Add the patch to `composer.json`
```
"scripts": {
"pre-drupal-scaffold-cmd": [
"if [ -f \"phpcs.xml\" ]; then rm phpcs.xml; fi"
],
"post-drupal-scaffold-cmd": [
"if [ -f \"phpcs.xml\" ]; then patch phpcs.xml < patches/custom/phpcs.xml.patch; fi"
]
},
```
The pre hook is needed otherwise the composer scaffold attempts to re-patch a file it no longer has control over when running `composer install --no-dev`
- Delete the `vendor` directory and `phpcs.xml` and then run `composer install`
to verify everything works as expected

### Functional Tests

Expand Down Expand Up @@ -397,6 +339,7 @@ includes:
| | |
|--------------------------|-----------------------------------------------------------------------------|
| `task pantheon:fetch-db` | Fetches a database from Pantheon. Set `PANTHEON_SITE_ID` in Taskfile `vars` |
| | and optionally `ENVIRONMENT` to override the default value of `live` |

See below for CI specific integrations for hosting providers.

Expand Down Expand Up @@ -681,6 +624,10 @@ Peer Reviewing by looking at PR code changes is nice.

Testing PR code changes on real sites is extra beneficial.

### Local Development

In order to test local changes follow the instructions for the [test script](./docs/test-script.md).

### Peer Review Guidelines for Automated Updates

These are guidelines for conducting peer reviews on automated dependency update pull requests created by Renovate.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"vlucas/phpdotenv": "^4|^5"
},
"require-dev": {
"composer/composer": "^2.7.6",
"phpunit/phpunit": "^9.6.19"
"composer/composer": "^2.7.7",
"phpunit/phpunit": "^9.6.20"
},
"extra": {
"class": [
Expand Down
2 changes: 1 addition & 1 deletion docs/test-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A test script is available in `tests/local-test.sh` to setup a Drupal site
with Drainpipe packages installed from your local checkout.

Go to the directory above `drainpipe` and run the `tests/local-hest.sh` script
Go to the directory above `drainpipe` and run the `tests/local-test.sh` script
to setup a new test site e.g.
```
❯ pwd
Expand Down
12 changes: 6 additions & 6 deletions drainpipe-dev/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
"php": "^8.1",
"ext-json": "*",
"composer-plugin-api": "^2.0",
"phpunit/phpunit": "^9.6.19",
"phpunit/phpunit": "^9.6.20",
"sserbin/twig-linter": "^3.1.0",
"mikey179/vfsstream": "^1.6.11",
"mockery/mockery": "^1.6.11",
"mockery/mockery": "^1.6.12",
"behat/mink": "^1.11.0",
"symfony/phpunit-bridge": "^6|^7",
"lullabot/drainpipe": "*",
"mglaman/phpstan-drupal": "^1.2.10",
"mglaman/phpstan-drupal": "^1.2.11",
"symfony/yaml": "^6|^7",
"drupal/coder": "^8.3.24",
"behat/mink-browserkit-driver": "^2.2.0",
"tijsverkoyen/convert-to-junit-xml": "^1.11.0",
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/phpstan-deprecation-rules": "^1.2.0",
"phpspec/prophecy-phpunit": "^2"
},
"require-dev": {
"composer/composer": "^2.7.6"
"composer/composer": "^2.7.7"
},
"bin": [
"bin/drainpipe-twig-linter",
Expand All @@ -48,7 +48,7 @@
"[web-root]/sites/sites.php": "scaffold/nightwatch/sites.php",
"[project-root]/.ddev/docker-compose.selenium.yaml": "scaffold/nightwatch/docker-compose.selenium.yaml",
"[project-root]/test/nightwatch/example.nightwatch.js": "scaffold/nightwatch/example.nightwatch.js",
"[project-root]/phpcs.xml": "scaffold/phpcs.xml"
"[project-root]/phpcs.xml.dist": "scaffold/phpcs.xml.dist"
}
}
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion metapackages/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.15",
"chokidar": "^3.6.0",
"esbuild": "^0.20.2",
"esbuild": "^0.21.5",
"yargs": "^17.7.2"
},
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions metapackages/sass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"bin": "./gulp.js",
"dependencies": {
"autoprefixer": "^10.4.19",
"cssnano": "^7.0.1",
"cssnano": "^7.0.4",
"gulp": "^5.0.0",
"gulp-postcss": "^10.0.0",
"gulp-sass": "^5.1.0",
"gulp-sass-glob": "^1.1.0",
"gulp-sourcemaps": "^3.0.0",
"modern-normalize": "^2.0.0",
"postcss": "^8.4.38",
"sass": "^1.76.0",
"postcss": "^8.4.39",
"sass": "^1.77.6",
"yargs": "^17.7.2"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@lullabot/drainpipe",
"packageManager": "yarn@4.2.1",
"packageManager": "yarn@4.3.1",
"workspaces": [
"metapackages/*"
],
"devDependencies": {
"lerna": "^8.1.2"
"lerna": "^8.1.6"
}
}
2 changes: 1 addition & 1 deletion scaffold/github/actions/pantheon/review/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ runs:
drainpipe_exec "terminus aliases --only ${{ inputs.site-name }} --yes"
if [ "${{ inputs.run-installer }}" == "true" ]; then
drainpipe_exec "./vendor/bin/drush @${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER --yes site:install --existing-config"
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: ')"; then
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: '"; then
drainpipe_exec "./vendor/bin/task update site=@${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER"
else
drainpipe_exec "./vendor/bin/task drupal:update site=@${{ inputs.site-name }}.pr-$DRAINPIPE_PR_NUMBER"
Expand Down
2 changes: 1 addition & 1 deletion scaffold/github/actions/pantheon/update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ runs:
drainpipe_exec "terminus aliases --only ${{ inputs.site-name }} --yes"
if [ "${{ inputs.run-installer }}" == "true" ]; then
drainpipe_exec "./vendor/bin/drush @${{ inputs.site-name }}.${{ inputs.environment }} --yes site:install --existing-config"
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: ')"; then
elif drainpipe_exec "./vendor/bin/task -l | grep '* update: '"; then
drainpipe_exec "./vendor/bin/task update site=@${{ inputs.site-name }}.${{ inputs.environment }}"
else
drainpipe_exec "./vendor/bin/task drupal:update site=@${{ inputs.site-name }}.${{ inputs.environment }}"
Expand Down
2 changes: 2 additions & 0 deletions scaffold/tugboat/scripts/install-mysql-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
mkdir -p /etc/apt/keyrings
cd /etc/apt/keyrings

# The following GPG key should match the latest RPM-GPG-KEY-mysql-YYYY file
# from https://repo.mysql.com/
cat > mysql.txt << EOD
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.6
Expand Down
14 changes: 14 additions & 0 deletions src/BinaryInstallerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ class BinaryInstallerPlugin extends BinaryInstaller
'hashalgo' => 'sha256',
'version' => '3.28.0',
],
'action-validator' => [
'releases' => [
'linux' => [
'amd64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_linux_amd64', 'sha' => 'fa61521913ee4cf5de7e4d5b803741b2c60ebde447ee38e2b71abbd213d3354a'],
'arm64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_linux_arm64', 'sha' => '38a582690ab7e64ba33b4c29eaf16979ed116d4daf40fde39ec18992c475c0b1'],
],
'darwin' => [
'amd64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_darwin_amd64', 'sha' => '10f453ad4ed011eb3866bd35c25311bd2fe1fbf353cbe64793115de2348f8ddb'],
'arm64' => ['url' => 'https://github.com/mpalmer/action-validator/releases/download/v0.6.0/action-validator_darwin_arm64', 'sha' => '68e09e0793cf958daf0aebe69fb2bf858232fb9c4f74f913dab02db67d32224d'],
],
],
'hashalgo' => 'sha256',
'version' => '0.6.0',
],
];

/**
Expand Down
10 changes: 8 additions & 2 deletions tasks/github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ tasks:
- |
directories=".github/workflows .github/actions"
if [ "{{ .directories }}" != "" ]; then directories="{{ .directories }}"; fi
find $directories -type f \( -iname '*.yaml' -o -iname '*.yml' \) | xargs -n1 npx @action-validator/cli
if [ -f ./vendor/bin/action-validator ]; then
find $directories -type f \( -iname '*.yaml' -o -iname '*.yml' \) | xargs -n1 ./vendor/bin/action-validator
# Fallback for architectures that don't have a release e.g. Windows
else
find $directories -type f \( -iname '*.yaml' -o -iname '*.yml' \) | xargs -n1 npx @action-validator/cli
fi
composer-lock-diff:
desc: Runs composer-lock-diff on a pull request description and produces a new description
Expand Down Expand Up @@ -42,5 +48,5 @@ tasks:
$DIFF
<!--/Composer Lock Diff-->"
fi
DESCRIPTION=$(echo "$DESCRIPTION" | sed -z 's/\n/\\n/g' | sed -z 's/"/\\"/g' | sed -z 's/\r//g')
DESCRIPTION=$(echo "$DESCRIPTION" | sed -z 's/\\/\\\\/g' | sed -z 's/\n/\\n/g' | sed -z 's/"/\\"/g' | sed -z 's/\r//g')
echo "{\"body\": \"$(echo "$DESCRIPTION")\"}" > {{ .json_file }}
3 changes: 2 additions & 1 deletion tasks/pantheon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ tasks:
desc: "Fetches a database from Pantheon"
env:
DB_DIR: '{{default "/var/www/html/files/db" .DB_DIR}}'
ENVIRONMENT: '{{default "live" .ENVIRONMENT}}'
cmds:
- rm -f $DB_DIR/db.sql.gz $DB_DIR/db.sql
- if [ -z "$PANTHEON_TOKEN" ]; then echo "PANTHEON_TOKEN is empty, please add it to your .env file"; exit 1; fi
- echo "⚡ Authorising with Pantheon"
- terminus auth:login --machine-token="${PANTHEON_TOKEN}"
- echo "⚡ Fetching database from Pantheon"
- terminus backup:get {{.PANTHEON_SITE_ID}}.live --element=db --to=$DB_DIR/db.sql.gz
- terminus backup:get {{.PANTHEON_SITE_ID}}.$ENVIRONMENT --element=db --to=$DB_DIR/db.sql.gz
3 changes: 1 addition & 2 deletions tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ tasks:
desc: Runs PHPCS with Drupal Coding Standards
summary: |
Check your code against Drupal's coding standards. To override the default
ruleset, copy vendor/lullabot/drainpipe/scaffold/phpcs.xml to phpcs.xml
in the root of your project and edit as needed.
ruleset, create a phpcs.xml file and extend phpcs.xml.dist
cmds:
- |
{{ .FUNC_ENSURE_DIRS }}
Expand Down
Loading

0 comments on commit d436532

Please sign in to comment.