Skip to content

Commit bf41ca1

Browse files
Merge pull request #358 from emulsify-ds/codex-add-attributes-helper-cleanup
feat: refine git actions tests
2 parents e7ce064 + 87aa4b3 commit bf41ca1

4 files changed

Lines changed: 48 additions & 104 deletions

File tree

.github/scripts/release-check.cjs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ function runStaticChecks() {
202202
ensure(extractYamlDependencyConstraint(emulsifyInfo, 'emulsify_tools') === composer.require['drupal/emulsify_tools'], 'emulsify.info.yml must match the composer emulsify_tools constraint.');
203203
ensure(extractYamlDependencyConstraint(whiskInfo, 'emulsify_tools') === composer.require['drupal/emulsify_tools'], 'whisk.info.yml must match the composer emulsify_tools constraint.');
204204
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(`- '${minCoreVersion}.*'`), 'theme-readiness.yml should smoke test the supported Drupal patch line.');
206-
ensure(themeReadinessWorkflow.includes(`- '^${minCoreVersion}'`), 'theme-readiness.yml should smoke test the supported Drupal constraint.');
207-
return `Root theme metadata and CI matrix align to Drupal ${minCoreVersion}.`;
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.');
207+
return `Root theme metadata and CI readiness checks align to Drupal ${minCoreVersion} on PHP 8.4.`;
208208
});
209209

210210
runStaticCheck('Package metadata', () => {
@@ -274,19 +274,18 @@ function runStaticChecks() {
274274
function runSmokeChecks() {
275275
if (options.skipSmoke) {
276276
addResult('SKIP', 'Stable9 template parity', 'Skipped with --skip-smoke.');
277+
addResult('SKIP', 'Base theme render smoke', 'Skipped with --skip-smoke.');
277278
addResult('SKIP', 'Generated theme smoke test', 'Skipped with --skip-smoke.');
278-
addResult('SKIP', 'No-Stable9 smoke result', 'Skipped with --skip-smoke.');
279279
addResult('SKIP', 'Favicon generation', 'Skipped with --skip-smoke.');
280280
return;
281281
}
282282

283283
const smokeRoot = options.workDir;
284284
const baseFixture = path.join(smokeRoot, 'base-fixture');
285285
const generatedThemeFixture = path.join(smokeRoot, 'generated-theme-fixture');
286-
const noStable9Fixture = path.join(smokeRoot, 'no-stable9-fixture');
287286
const faviconFixture = path.join(smokeRoot, 'favicon-fixture');
287+
const baseThemeOutput = path.join(smokeRoot, 'base-theme-output');
288288
const generatedThemeOutput = path.join(smokeRoot, 'generated-theme-output');
289-
const noStable9Output = path.join(smokeRoot, 'no-stable9-output');
290289

291290
fs.rmSync(smokeRoot, { force: true, recursive: true });
292291
fs.mkdirSync(smokeRoot, { recursive: true });
@@ -304,8 +303,8 @@ function runSmokeChecks() {
304303

305304
if (setupResult.status !== 0) {
306305
addResult('FAIL', 'Stable9 template parity', 'Unable to build the Drupal fixture site for template parity checks.');
306+
addResult('FAIL', 'Base theme render smoke', 'Unable to build the Drupal fixture site for smoke testing.');
307307
addResult('FAIL', 'Generated theme smoke test', 'Unable to build the Drupal fixture site for smoke testing.');
308-
addResult('FAIL', 'No-Stable9 smoke result', 'Unable to build the Drupal fixture site for smoke testing.');
309308
addResult('FAIL', 'Favicon generation', 'Unable to build the Drupal fixture site for smoke testing.');
310309
return;
311310
}
@@ -318,25 +317,21 @@ function runSmokeChecks() {
318317
{ passMessage: 'Verified that Emulsify ships every stable9 template path without inheriting from stable9.' },
319318
);
320319

321-
copyDirectory(baseFixture, generatedThemeFixture);
322320
runSmokeCheck(
323-
'Generated theme smoke test',
321+
'Base theme render smoke',
324322
'bash',
325-
[path.join(repoRoot, '.github/scripts/starterkit-smoke.sh'), generatedThemeFixture, generatedThemeOutput],
323+
[path.join(repoRoot, '.github/scripts/render-reference-pages.sh'), baseFixture, baseThemeOutput],
326324
repoRoot,
327-
{ passMessage: `Starterkit generation and generated theme smoke passed on Drupal ${options.drupalVersion}.` },
325+
{ passMessage: 'Base theme pages rendered successfully on the fixture site.' },
328326
);
329327

330-
copyDirectory(baseFixture, noStable9Fixture);
328+
copyDirectory(baseFixture, generatedThemeFixture);
331329
runSmokeCheck(
332-
'No-Stable9 smoke result',
330+
'Generated theme smoke test',
333331
'bash',
334-
[path.join(repoRoot, '.github/scripts/smoke-without-stable9.sh'), noStable9Fixture, noStable9Output],
332+
[path.join(repoRoot, '.github/scripts/starterkit-smoke.sh'), generatedThemeFixture, generatedThemeOutput],
335333
repoRoot,
336-
{
337-
passMessage: 'Smoke test passed without any stable9 base theme dependency.',
338-
failMessage: 'Smoke test failed without the stable9 base theme dependency.',
339-
},
334+
{ passMessage: `Starterkit generation and generated theme smoke passed on Drupal ${options.drupalVersion}.` },
340335
);
341336

342337
copyDirectory(baseFixture, faviconFixture);

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ drupal_version="$1"
1111
fixture_dir="$2"
1212
theme_source_dir="${3:-$(pwd)}"
1313
composer_bin="${COMPOSER_BIN:-composer}"
14+
emulsify_tools_repo="${EMULSIFY_TOOLS_REPOSITORY:-https://github.com/emulsify-ds/emulsify_tools.git}"
15+
emulsify_tools_ref="${EMULSIFY_TOOLS_REF:-release-2}"
16+
theme_dir="${fixture_dir}/web/themes/contrib/emulsify"
17+
emulsify_tools_dir="${fixture_dir}/web/modules/contrib/emulsify_tools"
1418

1519
export COMPOSER_MEMORY_LIMIT=-1
1620

@@ -22,8 +26,20 @@ rm -rf "$fixture_dir"
2226

2327
cd "$fixture_dir"
2428

25-
"$composer_bin" config repositories.emulsify "{\"type\":\"path\",\"url\":\"${theme_source_dir}\",\"options\":{\"symlink\":false}}"
26-
"$composer_bin" require --no-interaction drush/drush:^13 emulsify-ds/emulsify-drupal:@dev
29+
mkdir -p "$(dirname "$theme_dir")" "$(dirname "$emulsify_tools_dir")"
30+
rsync -a \
31+
--exclude '.git/' \
32+
--exclude '.github/' \
33+
--exclude 'node_modules/' \
34+
--exclude 'vendor/' \
35+
"${theme_source_dir}/" "${theme_dir}/"
36+
37+
# Readiness checks should exercise the local theme code and the in-flight
38+
# Emulsify Tools 2.x branch instead of depending on a published package.
39+
git clone --depth 1 --branch "$emulsify_tools_ref" "$emulsify_tools_repo" "$emulsify_tools_dir"
40+
rm -rf "${emulsify_tools_dir}/.git"
41+
42+
"$composer_bin" require --no-interaction drush/drush:^13
2743

2844
./vendor/bin/drush site:install standard \
2945
--db-url=sqlite://sites/default/files/.ht.sqlite \

.github/scripts/smoke-without-stable9.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/theme-readiness.yml

Lines changed: 17 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,78 +8,40 @@ on:
88
- 6.x
99
workflow_dispatch:
1010

11+
concurrency:
12+
group: theme-readiness-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
DRUPAL_VERSION: '11.3.*'
17+
PHP_VERSION: '8.4'
18+
1119
jobs:
12-
template-parity:
13-
name: Template Parity (${{ matrix.drupal-version }})
20+
theme-readiness:
21+
name: Theme Readiness
1422
runs-on: ubuntu-latest
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
drupal-version:
19-
- '11.3.*'
20-
- '^11.3'
2123
steps:
2224
- name: Checkout
2325
uses: actions/checkout@v4
2426

2527
- name: Setup PHP
2628
uses: shivammathur/setup-php@v2
2729
with:
28-
php-version: '8.3'
30+
php-version: ${{ env.PHP_VERSION }}
2931
tools: composer:v2
32+
extensions: gd, imagick
3033

3134
- name: Build fixture site
32-
run: bash .github/scripts/setup-fixture-site.sh "${{ matrix.drupal-version }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
35+
run: bash .github/scripts/setup-fixture-site.sh "${{ env.DRUPAL_VERSION }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
3336

3437
- name: Verify Emulsify ships the full stable9 template surface
3538
run: bash .github/scripts/template-parity.sh /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
3639

37-
no-stable9-readiness:
38-
name: No Stable9 Readiness (${{ matrix.drupal-version }})
39-
runs-on: ubuntu-latest
40-
strategy:
41-
fail-fast: false
42-
matrix:
43-
drupal-version:
44-
- '11.3.*'
45-
- '^11.3'
46-
steps:
47-
- name: Checkout
48-
uses: actions/checkout@v4
49-
50-
- name: Setup PHP
51-
uses: shivammathur/setup-php@v2
52-
with:
53-
php-version: '8.3'
54-
tools: composer:v2
55-
56-
- name: Build fixture site
57-
run: bash .github/scripts/setup-fixture-site.sh "${{ matrix.drupal-version }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
40+
- name: Smoke test base theme page rendering
41+
run: bash .github/scripts/render-reference-pages.sh /tmp/emulsify-fixture /tmp/emulsify-base-theme
5842

59-
- name: Smoke test without stable9 fallback
60-
run: bash .github/scripts/smoke-without-stable9.sh /tmp/emulsify-fixture /tmp/emulsify-no-stable9
61-
62-
starterkit-generation:
63-
name: Starterkit Smoke (${{ matrix.drupal-version }})
64-
runs-on: ubuntu-latest
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
drupal-version:
69-
- '11.3.*'
70-
- '^11.3'
71-
steps:
72-
- name: Checkout
73-
uses: actions/checkout@v4
74-
75-
- name: Setup PHP
76-
uses: shivammathur/setup-php@v2
77-
with:
78-
php-version: '8.3'
79-
tools: composer:v2
80-
81-
- name: Build fixture site
82-
run: bash .github/scripts/setup-fixture-site.sh "${{ matrix.drupal-version }}" /tmp/emulsify-fixture "$GITHUB_WORKSPACE"
43+
- name: Smoke test generated favicon package
44+
run: bash .github/scripts/favicon-smoke.sh /tmp/emulsify-fixture emulsify
8345

8446
- name: Generate and enable a Whisk-derived theme
8547
run: bash .github/scripts/starterkit-smoke.sh /tmp/emulsify-fixture /tmp/emulsify-generated-theme

0 commit comments

Comments
 (0)