2024-03-01 20:38:29 +00:00
|
|
|
_default:
|
|
|
|
just --list
|
2023-10-06 22:35:55 +00:00
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
build:
|
|
|
|
just clean
|
2023-10-06 22:35:55 +00:00
|
|
|
|
|
|
|
# Install dependencies.
|
|
|
|
composer validate
|
|
|
|
composer install --no-dev --prefer-dist --optimize-autoloader
|
|
|
|
composer install --prefer-dist --optimize-autoloader --working-dir ./vendor-bin/box
|
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
composer dump-env prod
|
2023-11-29 21:27:02 +00:00
|
|
|
|
2024-04-04 18:09:53 +00:00
|
|
|
./bin/build-configs cache:clear
|
|
|
|
./bin/build-configs cache:warmup
|
2023-11-29 21:27:02 +00:00
|
|
|
|
2023-10-06 22:35:55 +00:00
|
|
|
# Generate the phar file.
|
2024-04-04 18:10:12 +00:00
|
|
|
./vendor-bin/box/vendor/bin/box compile --config box.json.dist
|
2023-10-06 22:35:55 +00:00
|
|
|
|
2023-12-15 14:09:09 +00:00
|
|
|
rm -f .env.local .env.local.php
|
2023-11-29 09:59:49 +00:00
|
|
|
|
2023-11-29 09:25:21 +00:00
|
|
|
tree dist/
|
|
|
|
|
2023-10-06 22:35:55 +00:00
|
|
|
# TODO: build a Nix derivation and add it to the store.
|
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
clean:
|
|
|
|
rm -fr dist/* tmp vendor vendor-bin/box/vendor
|
|
|
|
touch dist/.keep var/.keep
|
|
|
|
|
|
|
|
ci-test:
|
2023-11-06 01:17:53 +00:00
|
|
|
nix develop --command composer install
|
2024-03-01 20:46:04 +00:00
|
|
|
nix develop --command just run-snapshots
|
|
|
|
nix develop --command vendor/bin/phpunit --testdox
|
2023-10-06 22:35:55 +00:00
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
test *args:
|
|
|
|
phpunit {{ args }}
|
2023-10-06 22:35:55 +00:00
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
create-snapshot config:
|
|
|
|
#!/usr/bin/env bash
|
2023-12-15 14:09:09 +00:00
|
|
|
set -o nounset
|
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
config_file="tests/snapshots/configs/{{ config }}.yaml"
|
|
|
|
output_path="tests/snapshots/output/{{ config }}"
|
2023-12-15 14:09:09 +00:00
|
|
|
|
|
|
|
cat "${config_file}"
|
|
|
|
|
|
|
|
rm -fr "${output_path}"
|
|
|
|
|
|
|
|
./bin/build-configs app:generate --config-file "${config_file}" --output-dir "${output_path}"
|
|
|
|
|
|
|
|
git status "${output_path}"
|
|
|
|
|
2024-03-01 20:38:29 +00:00
|
|
|
run-snapshots:
|
|
|
|
#!/usr/bin/env bash
|
2023-12-16 00:39:11 +00:00
|
|
|
rm -rf .ignored/snapshots
|
|
|
|
mkdir -p .ignored/snapshots
|
|
|
|
|
|
|
|
local configs=(
|
|
|
|
# TODO: add more configurations for different types and configurations.
|
|
|
|
drupal
|
|
|
|
drupal-commerce-kickstart
|
|
|
|
drupal-localgov
|
|
|
|
fractal
|
|
|
|
)
|
|
|
|
|
|
|
|
for config in "${configs[@]}"; do
|
|
|
|
config_file="tests/snapshots/configs/${config}.yaml"
|
|
|
|
input_path="tests/snapshots/output/${config}"
|
|
|
|
output_path=".ignored/snapshots/output/${config}"
|
|
|
|
|
|
|
|
cat "${config_file}"
|
|
|
|
|
|
|
|
./bin/build-configs app:generate --config-file "${config_file}" --output-dir "${output_path}"
|
|
|
|
|
|
|
|
find "${input_path}" -type f -print0 | while IFS= read -r -d '' original_file; do
|
|
|
|
generated_file="${output_path}/${original_file#"${input_path}"/}"
|
|
|
|
|
|
|
|
if cmp -s "${original_file}" "${generated_file}"; then
|
|
|
|
echo "Files match: ${original_file}"
|
|
|
|
else
|
|
|
|
# TODO: show the diff for all failed files. This will stop after the first failure.
|
|
|
|
echo "Files do not match: ${original_file}"
|
|
|
|
diff "${original_file}" "${generated_file}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|