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,
|
||||
# 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.
|
||||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
# Ignore core when managing all of a project's dependencies with Composer
|
||||
# including Drupal core.
|
||||
/web/
|
||||
!/web/modules/custom/
|
||||
.editorconfig
|
||||
.env
|
||||
.gitattributes
|
||||
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.
|
||||
/web/*/settings*.php
|
||||
/web/*/services*.yml
|
||||
.dir-env/
|
||||
|
||||
# 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
|
||||
|
||||
# Based on https://github.com/opdavies/dotfiles/blob/main/bin/t.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
|
@ -9,21 +7,21 @@ session_name="${1:-atdc}"
|
|||
session_path="${2:-$(pwd)}"
|
||||
|
||||
if tmux has-session -t="${session_name}" 2> /dev/null; then
|
||||
tmux attach -t "${session_name}"
|
||||
exit
|
||||
tmux attach -t "${session_name}" ||
|
||||
tmux switch-client -t "${session_name}"
|
||||
fi
|
||||
|
||||
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 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 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
|
||||
tmux send-keys -t "${session_name}:vim.right" "./run start" Enter
|
||||
|
||||
# 2. General shell use.
|
||||
tmux new-window -t "${session_name}" -c "${session_path}"
|
||||
|
||||
tmux switch-client -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": {
|
||||
"locked": {
|
||||
"lastModified": 1703200384,
|
||||
"narHash": "sha256-q5j06XOsy0qHOarsYPfZYJPWbTbc8sryRxianlEPJN0=",
|
||||
"lastModified": 1706371002,
|
||||
"narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0b3d618173114c64ab666f557504d6982665d328",
|
||||
"rev": "c002c6aa977ad22c60398daaa9be52f2203d0006",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
{
|
||||
inputs = {
|
||||
devshell.url = "github:numtide/devshell";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, ... }:
|
||||
|
@ -12,7 +14,10 @@
|
|||
|
||||
perSystem = { config, self', inputs', pkgs, system, ... }: {
|
||||
devshells.default = {
|
||||
packages = with pkgs; [ "php82" "php82Packages.composer" ];
|
||||
packages = with pkgs; [
|
||||
"php82"
|
||||
"php82Packages.composer"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
<?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">
|
||||
<description>PHPCS configuration file for atdc.</description>
|
||||
|
||||
<file>web/modules/custom</file>
|
||||
|
||||
<arg value="np"/>
|
||||
|
||||
<rule ref="DrupalPractice"/>
|
||||
|
||||
<rule ref="Drupal">
|
||||
<rule ref="Drupal">
|
||||
<exclude name="Drupal.Commenting.ClassComment.Missing"/>
|
||||
<exclude name="Drupal.Commenting.DataTypeNamespace.DataTypeNamespace"/>
|
||||
<exclude name="Drupal.Commenting.Deprecated"/>
|
||||
|
@ -26,5 +28,4 @@
|
|||
<exclude name="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"/>
|
||||
<exclude name="DrupalPractice.Objects.StrictSchemaDisabled.StrictConfigSchema"/>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
</ruleset>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
parameters:
|
||||
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
|
||||
path: web/modules/custom/example/src/Controller/BlogPageController.php
|
||||
path: web/modules/custom/atdc/src/Controller/BlogPageController.php
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
parameters:
|
||||
level: 5
|
||||
paths:
|
||||
- web/modules/custom/example
|
||||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
parameters:
|
||||
level:
|
||||
excludePaths:
|
||||
- *Test.php
|
||||
- *TestBase.php
|
||||
paths:
|
||||
|
||||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
|
|
@ -1,14 +1,37 @@
|
|||
<?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>
|
||||
<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"/>
|
||||
|
||||
<ini name="error_reporting" value="32767"/>
|
||||
<ini name="memory_limit" value="-1"/>
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Example tests">
|
||||
<directory suffix="Test.php">./web/modules/**</directory>
|
||||
<testsuite name="functional">
|
||||
<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>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
|
|
123
run
123
run
|
@ -1,9 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
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.
|
||||
function help {
|
||||
|
@ -14,10 +68,67 @@ function help {
|
|||
printf "\nExtended help:\n Each task has comments for general usage\n"
|
||||
}
|
||||
|
||||
# Run PHPUnit tests.
|
||||
function test {
|
||||
paratest --group lessons "${@}"
|
||||
# Install Drupal.
|
||||
function install {
|
||||
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'
|
||||
time "${@:-help}"
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
Loading…
Reference in a new issue