From 2a3146aed4996083e4cf73c4469101ca44740be8 Mon Sep 17 00:00:00 2001 From: Jon Pugh Date: Thu, 12 Nov 2020 15:49:07 -0500 Subject: [PATCH] Ensure the DevShop Control Project template installs the latest alpha of `devshop/devmaster`. (#629) * Ensure devmaster is at least 1.7 * Run component tests twice a day just like the main tests. * Run composer reinstall to keep CI consistent with developer commands. * Use "^1.7@alpha" or "1.x-dev". * Checkout a local 1.x branch from the current SHA to trick composer into thinking it's on 1.x-dev. * Use minimum-stability alpha so we can just use ^1.7 without the @alpha tag. https://github.com/opendevshop/devshop/pull/629 --- .github/workflows/components.yml | 7 +++++-- .github/workflows/devshop-container-prep.sh | 11 +++++++++++ .../Component/DevShopControlTemplate/composer.json | 5 +++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/components.yml b/.github/workflows/components.yml index 97f7548052..688ea199f3 100644 --- a/.github/workflows/components.yml +++ b/.github/workflows/components.yml @@ -5,10 +5,11 @@ on: branches: 1.x pull_request: types: [opened, synchronize] - + workflow_dispatch: schedule: # Once per day. https://crontab.guru/#*_0_*_*_* - cron: "* 0 * * *" + - cron: "0 12 * * *" env: GITHUB_TOKEN: ${{ secrets.INPUT_GITHUB_TOKEN }} @@ -269,7 +270,7 @@ jobs: # If installing without a lockfile, composer suggests using "update" command instead. - name: Install dependencies - run: composer update --prefer-dist --no-progress + run: composer reinstall working-directory: ${{env.working-directory}} - name: Test Project Creation @@ -278,3 +279,5 @@ jobs: working-directory: ./src/DevShop/Component/ run: | composer create-project devshop/control-template:@dev temp --repository='{"type":"path","url":"DevShopControlTemplate"}' + + # @TODO: Launch a devshop test container around this devshop-control code. diff --git a/.github/workflows/devshop-container-prep.sh b/.github/workflows/devshop-container-prep.sh index 3fb5c51125..58fbb44cf9 100755 --- a/.github/workflows/devshop-container-prep.sh +++ b/.github/workflows/devshop-container-prep.sh @@ -5,6 +5,17 @@ PATH="$DEVSHOP_PATH/bin:$PATH" GIT_REF=${GITHUB_HEAD_REF:-"1.x"} devshop-logo "Preparing DevShop Control for CI Tests" +devshop-log "Creating local branch from the checked out commit with the expected name..." + +# Create a local branch in the "path" repo so that composer doesn't get all confused. When the path is a SHA, composer reads the version as `devshop/devmaster[dev-8207dc45845c7cc0e4e8271d9c097fcb108a5773]` +# Assumption: Having a local branch will make composer detect the devshop/devmaster repo as being at version `devshop/devmaster[1.x-dev]`. +# I discovered this is happening by noticing that local composer install fails had a different error message: +# In GitHub Actions: https://github.com/opendevshop/devshop/pull/629/checks?check_run_id=1392567826#step:4:227 +# - Root composer.json requires devshop/devmaster ^1.7@alpha||1.x-dev, it is satisfiable by devshop/devmaster[1.7.0-alpha1, 1.7.0-alpha2, 1.7.0-alpha3, 1.x-dev] from composer repo (https://repo.packagist.org) but devshop/devmaster[dev-8207dc45845c7cc0e4e8271d9c097fcb108a5773] from path repo (/usr/share/devshop/devmaster) has higher repository priority. +# Locally, it says `devshop/devmaster[1.x-dev]` instead, because my local path repo is on a branch. + +cd "$DEVSHOP_PATH" +git checkout -b 1.x devshop-log "Adding repos to composer global config." set -x diff --git a/src/DevShop/Component/DevShopControlTemplate/composer.json b/src/DevShop/Component/DevShopControlTemplate/composer.json index 41864fe9c4..32868607a4 100644 --- a/src/DevShop/Component/DevShopControlTemplate/composer.json +++ b/src/DevShop/Component/DevShopControlTemplate/composer.json @@ -34,11 +34,11 @@ "composer/installers": "^1.2", "composer/semver": "^1.4", "cweagans/composer-patches": "dev-master#a18d1ca", - "devshop/devmaster": "@dev", + "devshop/devmaster": "^1.7||1.x-dev", "drupal-composer/preserve-paths": "dev-composer2", "drupal/admin_menu": "@rc", "drupal/adminrole": "^1.1", - "drupal/aegir_config": "@beta", + "drupal/aegir_config": "@beta", "drupal/aegir_ssh": "^1.0", "drupal/betterlogin": "^1.5", "drupal/bootstrap": "^3.26", @@ -150,5 +150,6 @@ "web/profiles" ] }, + "minimum-stability": "alpha", "prefer-stable": true }