diff --git a/.github/workflows/drupal-contrib-integration-test.yml b/.github/workflows/drupal-contrib-integration-test.yml index a64fbea..ab61cf7 100644 --- a/.github/workflows/drupal-contrib-integration-test.yml +++ b/.github/workflows/drupal-contrib-integration-test.yml @@ -58,6 +58,8 @@ jobs: drupal_version: "11" - project: pathauto drupal_version: "11" + - project: skipto + drupal_version: "12" fail-fast: false defaults: run: @@ -395,6 +397,8 @@ jobs: drupal_version: "11" - project: pathauto drupal_version: "11" + - project: skipto + drupal_version: "12" fail-fast: false defaults: run: diff --git a/drupal-contrib/template.tf b/drupal-contrib/template.tf index dbf0ce1..c0a7407 100644 --- a/drupal-contrib/template.tf +++ b/drupal-contrib/template.tf @@ -118,14 +118,14 @@ data "coder_parameter" "drupal_version" { default = "11" mutable = true order = 4 - option { - name = "11.x (stable)" - value = "11" - } option { name = "12.x (main branch)" value = "12" } + option { + name = "11.x (stable)" + value = "11" + } option { name = "10.x (stable)" value = "10" @@ -492,6 +492,19 @@ STATUS_HEADER cd "$PROJ_DIR" || { log_setup "✗ Cannot cd to $PROJ_DIR"; SETUP_FAILED=true; } + # Hide Coder-specific DDEV files from git status. + # .git/info/exclude is never committed and acts like a per-clone .gitignore. + # We only exclude files we generate — not web/, vendor/, etc. which are the + # module's own concern and may already be in its .gitignore. + mkdir -p .git/info + cat > .git/info/exclude << 'GIT_EXCLUDE_EOF' +# Generated by coder-ddev workspace startup — do not edit. +.ddev/.env.web +.ddev/config.coder.yaml +.ddev/docker-compose.coder-describe.yaml +.ddev/config.local.yaml +GIT_EXCLUDE_EOF + # ========================================== # Phase 3: Issue fork checkout (if requested) # ========================================== @@ -632,6 +645,11 @@ COMPOSE_EOF update_status "⚠ ddev-drupal-contrib addon: Warning" fi + # Set DRUPAL_CORE so ddev-drupal-contrib's expand-composer-json / ddev poser + # installs the selected major version instead of defaulting to ^11. + ddev dotenv set .ddev/.env.web --drupal-core "^$DRUPAL_VERSION" + log_setup "✓ DRUPAL_CORE set to ^$DRUPAL_VERSION" + # Start DDEV ddev poweroff 2>&1 | tee -a "$SETUP_LOG" || true log_setup "Starting DDEV environment..." @@ -663,11 +681,11 @@ COMPOSE_EOF fi if [ "$DRUPAL_INSTALLED" = "false" ]; then - # Add drush as require-dev so expand-composer-json includes it in composer.contrib.json - # --no-update avoids triggering plugin checks before Drupal is installed + # Add drush as require-dev so expand-composer-json includes it in composer.contrib.json. + # Direct JSON edit (not `composer require`) per ddev-drupal-contrib README. log_setup "Adding drush to require-dev..." update_status "⏳ drush: Adding to composer.json..." - ddev exec composer require --dev drush/drush --no-update --no-interaction >> "$SETUP_LOG" 2>&1 || true + jq '.["require-dev"]["drush/drush"] = "*"' composer.json > composer.json.tmp && mv composer.json.tmp composer.json # Run ddev poser: expands composer.json → composer.contrib.json (includes require-dev), # then runs composer install (installs Drupal + drush together), then removes composer.contrib.json @@ -677,6 +695,10 @@ COMPOSE_EOF if ddev poser >> "$SETUP_LOG" 2>&1; then log_setup "✓ ddev poser complete ($((SECONDS - _t))s)" update_status "✓ ddev poser: Success" + # Hide the drush require-dev line from git status without touching the + # file — git checkout would remove drush from composer.json and break + # ddev restart (which rebuilds vendor/ from the restored file). + git update-index --skip-worktree composer.json >> "$SETUP_LOG" 2>&1 || true else log_setup "✗ ddev poser failed ($((SECONDS - _t))s)" update_status "✗ ddev poser: Failed"