Skip to content

Commit

Permalink
Ensure the DevShop Control Project template installs the latest alpha…
Browse files Browse the repository at this point in the history
… 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.

#629
  • Loading branch information
jonpugh authored Nov 12, 2020
1 parent d2afe55 commit 2a3146a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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.
11 changes: 11 additions & 0 deletions .github/workflows/devshop-container-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/DevShop/Component/DevShopControlTemplate/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -150,5 +150,6 @@
"web/profiles"
]
},
"minimum-stability": "alpha",
"prefer-stable": true
}

0 comments on commit 2a3146a

Please sign in to comment.