Use Build Configs for configuration files
This commit is contained in:
parent
568451806e
commit
4c1c13e0e5
82
.gitignore
vendored
82
.gitignore
vendored
|
@ -1,50 +1,40 @@
|
||||||
# This file contains default .gitignore rules. To use it, copy it to .gitignore,
|
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||||
# and it will cause files like your settings.php and user-uploaded files to be
|
|
||||||
# excluded from Git version control. This is a common strategy to avoid
|
|
||||||
# accidentally including private information in public repositories and patch
|
|
||||||
# files.
|
|
||||||
#
|
|
||||||
# Because .gitignore can be specific to your site, this file has a different
|
|
||||||
# name; updating Drupal core will not override your custom .gitignore file.
|
|
||||||
|
|
||||||
# Ignore core when managing all of a project's dependencies with Composer
|
.editorconfig
|
||||||
# including Drupal core.
|
.env
|
||||||
/web/
|
.gitattributes
|
||||||
!/web/modules/custom/
|
vendor/
|
||||||
|
web/.csslintrc
|
||||||
|
web/.eslintignore
|
||||||
|
web/.eslintrc.json
|
||||||
|
web/.ht.router.php
|
||||||
|
web/.htaccess
|
||||||
|
web/INSTALL.txt
|
||||||
|
web/README.md
|
||||||
|
web/autoload.php
|
||||||
|
web/core/
|
||||||
|
web/example.gitignore
|
||||||
|
web/index.php
|
||||||
|
web/modules/README.txt
|
||||||
|
web/modules/contrib/
|
||||||
|
web/profiles/README.txt
|
||||||
|
web/robots.txt
|
||||||
|
web/sites/*/files/
|
||||||
|
web/sites/*/private/
|
||||||
|
web/sites/*/services*.yml
|
||||||
|
web/sites/*/settings*.php
|
||||||
|
web/sites/README.txt
|
||||||
|
web/sites/default/default.services.yml
|
||||||
|
web/sites/default/default.settings.php
|
||||||
|
web/sites/development.services.yml
|
||||||
|
web/sites/example.settings.local.php
|
||||||
|
web/sites/example.sites.php
|
||||||
|
web/sites/simpletest/
|
||||||
|
web/themes/README.txt
|
||||||
|
web/themes/contrib/
|
||||||
|
web/update.php
|
||||||
|
web/web.config
|
||||||
|
|
||||||
# Ignore dependencies that are managed with Composer.
|
|
||||||
# Generally you should only ignore the root vendor directory. It's important
|
|
||||||
# that core/assets/vendor and any other vendor directories within contrib or
|
|
||||||
# custom module, theme, etc., are not ignored unless you purposely do so.
|
|
||||||
/vendor/
|
|
||||||
|
|
||||||
# Ignore configuration files that may contain sensitive information.
|
.dir-env/
|
||||||
/web/*/settings*.php
|
|
||||||
/web/*/services*.yml
|
|
||||||
|
|
||||||
# Ignore paths that contain user-generated content.
|
|
||||||
/web/*/files
|
|
||||||
/web/*/private
|
|
||||||
|
|
||||||
# Ignore multi-site test environment.
|
|
||||||
/web/simpletest
|
|
||||||
|
|
||||||
# If you prefer to store your .gitignore file in the sites/ folder, comment
|
|
||||||
# or delete the previous settings and uncomment the following ones, instead.
|
|
||||||
|
|
||||||
# Ignore configuration files that may contain sensitive information.
|
|
||||||
# */settings*.php
|
|
||||||
|
|
||||||
# Ignore paths that contain user-generated content.
|
|
||||||
# */files
|
|
||||||
# */private
|
|
||||||
|
|
||||||
# Ignore multi-site test environment.
|
|
||||||
# simpletest
|
|
||||||
|
|
||||||
# Nix.
|
|
||||||
/.direnv/
|
|
||||||
|
|
||||||
/.editorconfig
|
|
||||||
/.gitattributes
|
|
||||||
/.phpunit.result.cache
|
|
||||||
|
|
14
.tmux
14
.tmux
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Based on https://github.com/opdavies/dotfiles/blob/main/bin/t.
|
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
|
@ -9,21 +7,21 @@ session_name="${1:-atdc}"
|
||||||
session_path="${2:-$(pwd)}"
|
session_path="${2:-$(pwd)}"
|
||||||
|
|
||||||
if tmux has-session -t="${session_name}" 2> /dev/null; then
|
if tmux has-session -t="${session_name}" 2> /dev/null; then
|
||||||
tmux attach -t "${session_name}"
|
tmux attach -t "${session_name}" ||
|
||||||
exit
|
tmux switch-client -t "${session_name}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux new-session -d -s "${session_name}" -n vim -c "${session_path}"
|
tmux new-session -d -s "${session_name}" -n vim -c "${session_path}"
|
||||||
|
|
||||||
# 1. Main window: Vim, server, shell
|
# 1. Main window: Vim.
|
||||||
tmux send-keys -t "${session_name}:vim" "nvim" Enter
|
tmux send-keys -t "${session_name}:vim" "nvim" Enter
|
||||||
tmux split-pane -t "${session_name}:vim" -h -c "${session_path}" -p 40
|
tmux split-pane -t "${session_name}:vim" -h -c "${session_path}" -p 40
|
||||||
tmux send-keys -t "${session_name}:vim.right" "php -S 0.0.0.0:9000 -t web" Enter
|
tmux send-keys -t "${session_name}:vim.right" "./run start" Enter
|
||||||
tmux split-pane -t "${session_name}:vim" -c "${session_path}" -v
|
|
||||||
tmux send-keys -t "${session_name}:vim.bottom-right" "./run test && watch-changes web/modules/custom ./run test" Enter
|
|
||||||
|
|
||||||
# 2. General shell use.
|
# 2. General shell use.
|
||||||
tmux new-window -t "${session_name}" -c "${session_path}"
|
tmux new-window -t "${session_name}" -c "${session_path}"
|
||||||
|
|
||||||
tmux switch-client -t "${session_name}:vim.left" ||
|
tmux switch-client -t "${session_name}:vim.left" ||
|
||||||
tmux attach -t "${session_name}:vim.left"
|
tmux attach -t "${session_name}:vim.left"
|
||||||
|
|
||||||
|
# vim: ft=bash
|
||||||
|
|
12
build.yaml
Normal file
12
build.yaml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
name: atdc
|
||||||
|
type: drupal
|
||||||
|
language: php
|
||||||
|
|
||||||
|
flake:
|
||||||
|
devshell:
|
||||||
|
packages:
|
||||||
|
- php82
|
||||||
|
- php82Packages.composer
|
||||||
|
|
||||||
|
experimental:
|
||||||
|
createTmuxStartupFile: true
|
|
@ -72,16 +72,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703200384,
|
"lastModified": 1706371002,
|
||||||
"narHash": "sha256-q5j06XOsy0qHOarsYPfZYJPWbTbc8sryRxianlEPJN0=",
|
"narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0b3d618173114c64ab666f557504d6982665d328",
|
"rev": "c002c6aa977ad22c60398daaa9be52f2203d0006",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-23.11",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||||
|
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
devshell.url = "github:numtide/devshell";
|
devshell.url = "github:numtide/devshell";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ flake-parts, ... }:
|
outputs = inputs@{ flake-parts, ... }:
|
||||||
|
@ -12,7 +14,10 @@
|
||||||
|
|
||||||
perSystem = { config, self', inputs', pkgs, system, ... }: {
|
perSystem = { config, self', inputs', pkgs, system, ... }: {
|
||||||
devshells.default = {
|
devshells.default = {
|
||||||
packages = with pkgs; [ "php82" "php82Packages.composer" ];
|
packages = with pkgs; [
|
||||||
|
"php82"
|
||||||
|
"php82Packages.composer"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
<!-- Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. -->
|
||||||
|
|
||||||
<ruleset name="atdc coding standards">
|
<ruleset name="atdc coding standards">
|
||||||
<description>PHPCS configuration file for atdc.</description>
|
<description>PHPCS configuration file for atdc.</description>
|
||||||
|
|
||||||
<file>web/modules/custom</file>
|
|
||||||
|
|
||||||
<arg value="np"/>
|
<arg value="np"/>
|
||||||
|
|
||||||
|
<rule ref="DrupalPractice"/>
|
||||||
<rule ref="Drupal">
|
|
||||||
|
<rule ref="Drupal">
|
||||||
<exclude name="Drupal.Commenting.ClassComment.Missing"/>
|
<exclude name="Drupal.Commenting.ClassComment.Missing"/>
|
||||||
<exclude name="Drupal.Commenting.DataTypeNamespace.DataTypeNamespace"/>
|
<exclude name="Drupal.Commenting.DataTypeNamespace.DataTypeNamespace"/>
|
||||||
<exclude name="Drupal.Commenting.Deprecated"/>
|
<exclude name="Drupal.Commenting.Deprecated"/>
|
||||||
|
@ -26,5 +28,4 @@
|
||||||
<exclude name="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
|
<exclude name="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
|
||||||
<exclude name="DrupalPractice.Objects.StrictSchemaDisabled.StrictConfigSchema"/>
|
<exclude name="DrupalPractice.Objects.StrictSchemaDisabled.StrictConfigSchema"/>
|
||||||
</rule>
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
parameters:
|
parameters:
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
-
|
-
|
||||||
message: "#^Method Drupal\\\\example\\\\Controller\\\\BlogPageController\\:\\:create\\(\\) should return static\\(Drupal\\\\example\\\\Controller\\\\BlogPageController\\) but returns Drupal\\\\example\\\\Controller\\\\BlogPageController\\.$#"
|
message: "#^Method Drupal\\\\atdc\\\\Controller\\\\BlogPageController\\:\\:create\\(\\) should return static\\(Drupal\\\\atdc\\\\Controller\\\\BlogPageController\\) but returns Drupal\\\\atdc\\\\Controller\\\\BlogPageController\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: web/modules/custom/example/src/Controller/BlogPageController.php
|
path: web/modules/custom/atdc/src/Controller/BlogPageController.php
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
parameters:
|
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||||
level: 5
|
|
||||||
paths:
|
|
||||||
- web/modules/custom/example
|
|
||||||
|
|
||||||
includes:
|
parameters:
|
||||||
- phpstan-baseline.neon
|
level:
|
||||||
|
excludePaths:
|
||||||
|
- *Test.php
|
||||||
|
- *TestBase.php
|
||||||
|
paths:
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,37 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit bootstrap="web/core/tests/bootstrap.php" colors="true">
|
<!-- Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. -->
|
||||||
|
<phpunit
|
||||||
|
beStrictAboutChangesToGlobalState="true"
|
||||||
|
beStrictAboutOutputDuringTests="false"
|
||||||
|
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||||
|
bootstrap="web/core/tests/bootstrap.php"
|
||||||
|
cacheResult="false"
|
||||||
|
colors="true"
|
||||||
|
failOnWarning="true"
|
||||||
|
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter"
|
||||||
|
>
|
||||||
<php>
|
<php>
|
||||||
<env name="SIMPLETEST_BASE_URL" value="http://localhost:9000"/>
|
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
|
||||||
|
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
|
||||||
|
<env name="MINK_DRIVER_ARGS" value=''/>
|
||||||
|
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value=''/>
|
||||||
|
<env name="MINK_DRIVER_CLASS" value=''/>
|
||||||
|
<env name="SIMPLETEST_BASE_URL" value="http://web"/>
|
||||||
<env name="SIMPLETEST_DB" value="sqlite://localhost//dev/shm/test.sqlite"/>
|
<env name="SIMPLETEST_DB" value="sqlite://localhost//dev/shm/test.sqlite"/>
|
||||||
|
|
||||||
<ini name="error_reporting" value="32767"/>
|
<ini name="error_reporting" value="32767"/>
|
||||||
<ini name="memory_limit" value="-1"/>
|
<ini name="memory_limit" value="-1"/>
|
||||||
</php>
|
</php>
|
||||||
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Example tests">
|
<testsuite name="functional">
|
||||||
<directory suffix="Test.php">./web/modules/**</directory>
|
<directory>./web/modules/custom/**/tests/**/Functional</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="kernel">
|
||||||
|
<directory>./web/modules/custom/**/tests/**/Kernel</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="unit">
|
||||||
|
<directory>./web/modules/custom/**/tests/**/Unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
123
run
123
run
|
@ -1,9 +1,63 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o errexit
|
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||||
set -o nounset
|
|
||||||
|
|
||||||
PATH=${PATH}:./vendor/bin
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
# If we're running in CI we need to disable TTY allocation for docker compose
|
||||||
|
# commands that enable it by default, such as exec and run.
|
||||||
|
TTY="${TTY:-}"
|
||||||
|
if [[ ! -t 1 ]]; then
|
||||||
|
TTY="-T"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run automated tests as part of the Continuous Integration (CI) pipeline.
|
||||||
|
function ci:test {
|
||||||
|
lint:dockerfile
|
||||||
|
|
||||||
|
docker compose version
|
||||||
|
|
||||||
|
docker network create traefik_proxy
|
||||||
|
|
||||||
|
cp --no-clobber .env.example .env
|
||||||
|
|
||||||
|
docker compose build --progress plain
|
||||||
|
|
||||||
|
docker compose up --detach
|
||||||
|
docker compose logs
|
||||||
|
|
||||||
|
composer install --quiet --no-progress
|
||||||
|
|
||||||
|
test --testdox
|
||||||
|
|
||||||
|
quality
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run a command within the php container.
|
||||||
|
function cmd {
|
||||||
|
docker compose exec php "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function coding-standards {
|
||||||
|
cmd phpcs "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function composer {
|
||||||
|
_exec php composer "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function drush {
|
||||||
|
_exec php drush "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git-hooks:off {
|
||||||
|
git config --unset core.hooksPath
|
||||||
|
}
|
||||||
|
|
||||||
|
function git-hooks:on {
|
||||||
|
git config core.hooksPath .githooks
|
||||||
|
}
|
||||||
|
|
||||||
# Display a list of all available commands.
|
# Display a list of all available commands.
|
||||||
function help {
|
function help {
|
||||||
|
@ -14,10 +68,67 @@ function help {
|
||||||
printf "\nExtended help:\n Each task has comments for general usage\n"
|
printf "\nExtended help:\n Each task has comments for general usage\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run PHPUnit tests.
|
# Install Drupal.
|
||||||
function test {
|
function install {
|
||||||
paratest --group lessons "${@}"
|
drush site:install -y "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lint:dockerfile {
|
||||||
|
docker container run --rm -i \
|
||||||
|
hadolint/hadolint hadolint --ignore DL3008 --ignore DL3059 -t style "${@}" - < Dockerfile
|
||||||
|
}
|
||||||
|
|
||||||
|
function quality {
|
||||||
|
coding-standards
|
||||||
|
static-analysis
|
||||||
|
}
|
||||||
|
|
||||||
|
function start {
|
||||||
|
cp -v --no-clobber .env.example .env || true
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
}
|
||||||
|
|
||||||
|
function static-analysis {
|
||||||
|
cmd phpstan --memory-limit=-1 --no-progress "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function stop {
|
||||||
|
docker compose down
|
||||||
|
}
|
||||||
|
|
||||||
|
function test {
|
||||||
|
_exec php phpunit --colors=always "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function test:commit {
|
||||||
|
test --testdox --testsuite functional
|
||||||
|
test --testdox --testsuite kernel
|
||||||
|
test --testdox --testsuite unit
|
||||||
|
|
||||||
|
quality
|
||||||
|
}
|
||||||
|
|
||||||
|
function _exec {
|
||||||
|
docker compose exec ${TTY} "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function _run {
|
||||||
|
local service="${1}"
|
||||||
|
local command="${2}"
|
||||||
|
|
||||||
|
docker compose run \
|
||||||
|
--entrypoint "${command}" \
|
||||||
|
--no-deps \
|
||||||
|
--rm \
|
||||||
|
${TTY} \
|
||||||
|
"${service}" "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Include any local tasks.
|
||||||
|
[[ -e run.local ]] && source run.local
|
||||||
|
|
||||||
TIMEFORMAT=$'\nTask completed in %3lR'
|
TIMEFORMAT=$'\nTask completed in %3lR'
|
||||||
time "${@:-help}"
|
time "${@:-help}"
|
||||||
|
|
||||||
|
# vim: ft=bash
|
||||||
|
|
Loading…
Reference in a new issue