Skip to content

Commit a2345ab

Browse files
author
Callin Mullaney
committed
ci: add Drupal 12 dev readiness coverage
1 parent 76295ed commit a2345ab

3 files changed

Lines changed: 70 additions & 16 deletions

File tree

.github/scripts/release-check.cjs

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const { spawnSync } = require('child_process');
88
const repoRoot = path.resolve(__dirname, '../..');
99
const args = new Set(process.argv.slice(2));
1010
const options = {
11-
drupalVersion: process.env.RELEASE_CHECK_DRUPAL_VERSION || '11.3.*',
11+
drupalVersion: process.env.RELEASE_CHECK_DRUPAL_VERSION || null,
1212
skipSmoke: args.has('--skip-smoke'),
13-
workDir: process.env.RELEASE_CHECK_WORKDIR || path.join(os.tmpdir(), 'emulsify-release-check'),
13+
workDir: process.env.RELEASE_CHECK_WORKDIR || fs.mkdtempSync(path.join(os.tmpdir(), 'emulsify-release-check-')),
1414
};
1515

1616
const results = [];
@@ -38,6 +38,33 @@ function normalizeConstraintVersion(constraint) {
3838
return match ? match[1] : String(constraint).trim();
3939
}
4040

41+
function extractSupportedDrupalTestLines(constraint) {
42+
const lines = String(constraint)
43+
.split('||')
44+
.map((segment) => segment.trim())
45+
.map((segment) => {
46+
const match = segment.match(/\^(\d+)(?:\.(\d+))?/);
47+
if (!match) {
48+
return null;
49+
}
50+
51+
return match[2] ? `${match[1]}.${match[2]}.*` : `${match[1]}.*`;
52+
})
53+
.filter(Boolean);
54+
55+
return [...new Set(lines)];
56+
}
57+
58+
function mapDrupalLineToSmokeTarget(line) {
59+
if (line === '12.*') {
60+
// Drupal 12 currently ships from recommended-project's dev-main branch
61+
// until the first stable 12.0.0 tag is published.
62+
return 'dev-main';
63+
}
64+
65+
return line;
66+
}
67+
4168
function semver(value) {
4269
return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(String(value));
4370
}
@@ -193,21 +220,33 @@ function runStaticChecks() {
193220
const themeReadinessWorkflow = readFile('.github/workflows/theme-readiness.yml');
194221
const coreConstraint = composer.require['drupal/core'];
195222
const minCoreVersion = normalizeConstraintVersion(coreConstraint);
223+
const supportedDrupalLines = extractSupportedDrupalTestLines(coreConstraint);
224+
const supportedDrupalSmokeTargets = supportedDrupalLines.map(mapDrupalLineToSmokeTarget);
225+
226+
if (!options.drupalVersion) {
227+
options.drupalVersion = supportedDrupalSmokeTargets[supportedDrupalSmokeTargets.length - 1] || `${minCoreVersion}.*`;
228+
}
196229

197230
runStaticCheck('Composer constraints', () => {
198231
ensure(coreConstraint, 'composer.json must declare drupal/core.');
232+
ensure(supportedDrupalLines.length > 0, 'composer.json must expose at least one supported Drupal core test line.');
199233
ensure(composer.require['drupal/emulsify_tools'], 'composer.json must declare drupal/emulsify_tools.');
200234
ensure(extractYamlValue(emulsifyInfo, 'core_version_requirement') === coreConstraint, 'emulsify.info.yml must match composer drupal/core.');
201235
ensure(extractYamlValue(whiskInfo, 'core_version_requirement') === coreConstraint, 'whisk.info.yml must match composer drupal/core.');
202236
ensure(extractYamlDependencyConstraint(emulsifyInfo, 'emulsify_tools') === composer.require['drupal/emulsify_tools'], 'emulsify.info.yml must match the composer emulsify_tools constraint.');
203237
ensure(extractYamlDependencyConstraint(whiskInfo, 'emulsify_tools') === composer.require['drupal/emulsify_tools'], 'whisk.info.yml must match the composer emulsify_tools constraint.');
204238
ensure(extractYamlDependencyConstraint(whiskInfoStarter, 'emulsify_tools') === composer.require['drupal/emulsify_tools'], 'whisk.info.emulsify.yml must match the composer emulsify_tools constraint.');
205-
ensure(themeReadinessWorkflow.includes(`DRUPAL_VERSION: '${minCoreVersion}.*'`), 'theme-readiness.yml should smoke test the supported Drupal patch line.');
206-
ensure(themeReadinessWorkflow.includes("PHP_VERSION: '8.4'"), 'theme-readiness.yml should run readiness smoke checks on PHP 8.4.');
239+
for (const drupalTarget of supportedDrupalSmokeTargets) {
240+
ensure(themeReadinessWorkflow.includes(`'${drupalTarget}'`), `theme-readiness.yml should smoke test Drupal ${drupalTarget}.`);
241+
}
242+
ensure(themeReadinessWorkflow.includes("'8.4'"), 'theme-readiness.yml should run readiness smoke checks on PHP 8.4.');
243+
if (supportedDrupalSmokeTargets.includes('dev-main')) {
244+
ensure(themeReadinessWorkflow.includes("'8.5'"), 'theme-readiness.yml should run Drupal 12 readiness smoke checks on PHP 8.5.');
245+
}
207246
ensure(themeReadinessWorkflow.includes('- 7.x'), 'theme-readiness.yml should run on pushes to 7.x.');
208247
ensure(themeReadinessWorkflow.includes('- release-7'), 'theme-readiness.yml should run on pushes to release-7.');
209248
ensure(!themeReadinessWorkflow.includes('- 6.x'), 'theme-readiness.yml should not keep the retired 6.x release branch trigger.');
210-
return `Root theme metadata and CI readiness checks align to Drupal ${minCoreVersion} on PHP 8.4.`;
249+
return `Root theme metadata and CI readiness checks align to Drupal ${supportedDrupalLines.join(', ')} via ${supportedDrupalSmokeTargets.join(', ')} smoke targets.`;
211250
});
212251

213252
runStaticCheck('Package metadata', () => {
@@ -240,9 +279,12 @@ function runStaticChecks() {
240279
});
241280

242281
runStaticCheck('README version references', () => {
243-
ensure(readme.includes(`Drupal ${minCoreVersion}+`), `README.md should mention Drupal ${minCoreVersion}+.`);
282+
ensure(readme.includes(`Drupal ${minCoreVersion}`), `README.md should mention Drupal ${minCoreVersion}.`);
283+
if (supportedDrupalLines.some((line) => line.startsWith('12'))) {
284+
ensure(readme.includes('Drupal 12'), 'README.md should mention Drupal 12 support.');
285+
}
244286
ensure(readme.includes(`${rootPackage.version.split('.')[0]}.x series`), `README.md should mention the ${rootPackage.version.split('.')[0]}.x series.`);
245-
return `README.md matches Drupal ${minCoreVersion}+ and the current major release line.`;
287+
return `README.md matches the supported Drupal ${supportedDrupalLines.join(', ')} window and the current major release line.`;
246288
});
247289

248290
runStaticCheck('Base theme independence', () => {

.github/scripts/setup-fixture-site.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ emulsify_tools_repo="${EMULSIFY_TOOLS_REPOSITORY:-https://github.com/emulsify-ds
1515
emulsify_tools_ref="${EMULSIFY_TOOLS_REF:-release-2}"
1616
theme_dir="${fixture_dir}/web/themes/contrib/emulsify"
1717
emulsify_tools_dir="${fixture_dir}/web/modules/contrib/emulsify_tools"
18+
drush_constraint="^13"
19+
20+
if [ "$drupal_version" = "dev-main" ]; then
21+
drush_constraint="^14"
22+
fi
1823

1924
export COMPOSER_MEMORY_LIMIT=-1
2025

@@ -39,7 +44,7 @@ rsync -a \
3944
git clone --depth 1 --branch "$emulsify_tools_ref" "$emulsify_tools_repo" "$emulsify_tools_dir"
4045
rm -rf "${emulsify_tools_dir}/.git"
4146

42-
"$composer_bin" require --no-interaction drush/drush:^13
47+
"$composer_bin" require --no-interaction --with-all-dependencies "drush/drush:${drush_constraint}"
4348

4449
./vendor/bin/drush site:install standard \
4550
--db-url=sqlite://sites/default/files/.ht.sqlite \
@@ -50,7 +55,10 @@ rm -rf "${emulsify_tools_dir}/.git"
5055
./vendor/bin/drush en emulsify_tools -y
5156
./vendor/bin/drush theme:enable emulsify -y
5257
./vendor/bin/drush config:set system.theme default emulsify -y
53-
./vendor/bin/drush en contact -y
58+
59+
if [ -d "${fixture_dir}/web/core/modules/contact" ]; then
60+
./vendor/bin/drush en contact -y
61+
fi
5462

5563
./vendor/bin/drush php:eval '
5664
use Drupal\node\Entity\Node;

.github/workflows/theme-readiness.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,31 @@ concurrency:
1313
group: theme-readiness-${{ github.event.pull_request.number || github.ref }}
1414
cancel-in-progress: true
1515

16-
env:
17-
DRUPAL_VERSION: '11.3.*'
18-
PHP_VERSION: '8.4'
19-
2016
jobs:
2117
theme-readiness:
22-
name: Theme Readiness
18+
name: Theme Readiness (Drupal ${{ matrix.drupal-version }} / PHP ${{ matrix.php-version }})
2319
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- drupal-version: '11.3.*'
25+
php-version: '8.4'
26+
- drupal-version: 'dev-main'
27+
php-version: '8.5'
2428
steps:
2529
- name: Checkout
2630
uses: actions/checkout@v4
2731

2832
- name: Setup PHP
2933
uses: shivammathur/setup-php@v2
3034
with:
31-
php-version: ${{ env.PHP_VERSION }}
35+
php-version: ${{ matrix.php-version }}
3236
tools: composer:v2
3337
extensions: gd, imagick
3438

3539
- name: Build fixture site
36-
run: bash .github/scripts/setup-fixture-site.sh "${{ env.DRUPAL_VERSION }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
40+
run: bash .github/scripts/setup-fixture-site.sh "${{ matrix.drupal-version }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
3741

3842
- name: Verify Emulsify ships the full stable9 template surface
3943
run: bash .github/scripts/template-parity.sh /tmp/emulsify-fixture "$GITHUB_WORKSPACE" "$RUNNER_TEMP/emulsify-template-parity.md"

0 commit comments

Comments
 (0)