-
Notifications
You must be signed in to change notification settings - Fork 14
ISSUE-370: composer configuration checks #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
beto-aveiga
wants to merge
29
commits into
main
Choose a base branch
from
issue-370-add-validation-and-warnings-for-composer-patches-configuration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
531adbd
ISSUE-370: composer configuration checks
beto-aveiga 12d7325
ISSUE-370: final code style fixes
beto-aveiga 5ce7255
ISSUE-370: check for empty instead of negating the value
beto-aveiga b99340d
ISSUE-370: check empty before array check
beto-aveiga d8c956f
ISSUE-370: remove code for manual tests | typo
beto-aveiga a327d19
ISSUE-370: typo [skip ci]
beto-aveiga 43daf67
ISSUE-370: test composer checks
beto-aveiga 91a3580
Update src/ScaffoldInstallerPlugin.php
beto-aveiga 6826cc9
ISSUE-370: avoid prefixing private methods [skip ci]
beto-aveiga 151dac1
ISSUE-370: determine if json file for patches was parsed as expected …
beto-aveiga 85a82b5
ISSUE-370: improve string readability [skip ci]
beto-aveiga 2670c9a
ISSUE-370: create a separate class for composer checks [skip ci]
beto-aveiga 3fe841c
Merge branch 'issue-370-add-validation-and-warnings-for-composer-patc…
beto-aveiga fd93af6
ISSUE-370: renaming test [skip ci]
beto-aveiga b273d00
ISSUE-370: move logic to another file [skip ci]
beto-aveiga b9247ec
ISSUE-370: opt out options for composer checks [skip ci]
beto-aveiga c34bfef
ISSUE-370: typo [skip ci]
beto-aveiga 0f9280d
ISSUE-370: improve documentatio
beto-aveiga 92d3c4d
Merge branch 'main' of github.com:Lullabot/drainpipe into issue-370-a…
beto-aveiga 5e78a85
ISSUE-370: fixig path
beto-aveiga 87dc05a
ISSUE-370: debug
beto-aveiga 6b0e9a9
ISSUE-370: debug
beto-aveiga f17afc8
ISSUE-370: fixing path to run composer check scripts
beto-aveiga ef8e443
ISSUE-370: documetation
beto-aveiga 47be2d4
Merge branch 'main' into issue-370-add-validation-and-warnings-for-co…
mrdavidburns 04202dc
ISSUE-370: Add composer check plugin.
rene-ipiales-lullabot f477f78
ISSUE-370: Add composer composer-checks plugin for test.
rene-ipiales-lullabot 2f00c5d
ISSUE-370: Add composer composer-checks plugin for github actions.
rene-ipiales-lullabot f85b4d1
ISSUE-370: Add composer composer-checks plugin for github actions and…
rene-ipiales-lullabot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Test Scaffold Installer Plugin - Composer Checks | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Test-Scaffold-Installer-Plugin: | ||
runs-on: ubuntu-24.04 | ||
strategy: | ||
matrix: | ||
php-version: [ 8.3 ] | ||
steps: | ||
|
||
- name: Create a Drupal project | ||
run: composer create-project drupal/recommended-project${{ matrix.drupal-version }} . --ignore-platform-reqs | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
path: drainpipe | ||
|
||
- name: Setup drainpipe-dev | ||
run: mv drainpipe/drainpipe-dev . | ||
|
||
- uses: ./drainpipe/scaffold/github/actions/common/set-env | ||
|
||
- name: Install DDEV | ||
uses: ./drainpipe/scaffold/github/actions/common/ddev | ||
with: | ||
composer-cache-dir: composer-cache | ||
git-name: Drainpipe Bot | ||
git-email: no-reply@example.com | ||
|
||
- name: Setup Project | ||
run: | | ||
ddev config --auto | ||
ddev config --php-version ${{ matrix.php-version }} | ||
ddev start | ||
ddev composer config extra.drupal-scaffold.gitignore true | ||
ddev composer config --json extra.drupal-scaffold.allowed-packages '["lullabot/drainpipe-dev", "lullabot/drainpipe"]' | ||
ddev composer config --no-plugins allow-plugins.composer/installers true | ||
ddev composer config --no-plugins allow-plugins.drupal/core-composer-scaffold true | ||
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe true | ||
ddev composer config --no-plugins allow-plugins.lullabot/drainpipe-dev true | ||
ddev composer config repositories.drainpipe --json '{"type": "path", "url": "drainpipe", "options": {"symlink": false}}' | ||
ddev composer config repositories.drainpipe-dev --json '{"type": "path", "url": "drainpipe-dev", "options": {"symlink": false}}' | ||
ddev composer config minimum-stability dev | ||
ddev composer require "lullabot/drainpipe @dev" --with-all-dependencies | ||
ddev composer require "lullabot/drainpipe-dev @dev" --dev --with-all-dependencies | ||
|
||
- name: Composer checks Tests | ||
run: | | ||
|
||
check_composer_install_contents() { | ||
local string_to_check="$1" | ||
local expected="$2" | ||
local file="composer-install-output.txt" | ||
|
||
ddev composer install > $file 2>&1 | ||
|
||
# Search for the string in the file | ||
if grep -q "$string_to_check" "$file"; then | ||
# String is found | ||
if [[ "$expected" -eq 0 ]]; then | ||
echo "Error: String '$string_to_check' found, but it was not expected." | ||
exit 1 | ||
fi | ||
else | ||
# String is not found | ||
if [[ "$expected" -eq 1 ]]; then | ||
echo "Error: String '$string_to_check' not found, but it was expected." | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
ddev composer config --unset extra.composer-exit-on-patch-failure | ||
check_composer_install_contents "Break Composer install if patches don't apply" 1 | ||
|
||
ddev composer config extra.composer-exit-on-patch-failure --json false | ||
check_composer_install_contents "Break Composer install if patches don't apply" 1 | ||
|
||
ddev composer config extra.composer-exit-on-patch-failure --json true | ||
check_composer_install_contents "Break Composer install if patches don't apply" 0 | ||
|
||
ddev composer config extra.patchLevel --json '{"drupal/core": "-p2"}' | ||
check_composer_install_contents "Configure Composer patches to use \`-p2\` as \`patchLevel\` for Drupal core" 0 | ||
|
||
ddev composer config --unset extra.patchLevel | ||
check_composer_install_contents "Configure Composer patches to use \`-p2\` as \`patchLevel\` for Drupal core" 1 | ||
|
||
ddev composer config extra.patches-file "composer.patches.json" | ||
check_composer_install_contents "Store Composer patches configuration in \`composer.json\`" 1 | ||
|
||
ddev composer config --unset extra.patches-file | ||
check_composer_install_contents "Store Composer patches configuration in \`composer.json\`" 0 | ||
|
||
ddev composer config extra.patches --json '{"drupal":{"issue-x":"http"}}' | ||
check_composer_install_contents "Use local copies of patch files." 1 | ||
|
||
ddev composer config extra.patches --json '{"drupal":{"issue-x":"local-path"}}' | ||
check_composer_install_contents "Use local copies of patch files." 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great addition that aligns with our ADR: Use local copies of patch files
I know we have completely updated all our projects to adhere to this, so having a check that will enforce this would be a nice addition.