-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add snapshot tests for a basic Drupal project
- Loading branch information
Showing
18 changed files
with
572 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/.direnv | ||
/dist/* | ||
!/dist/.keep | ||
.ignored/ | ||
|
||
###> symfony/framework-bundle ### | ||
/.env.local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: drupal | ||
language: php | ||
type: drupal | ||
|
||
web: | ||
type: nginx | ||
|
||
database: | ||
type: mariadb | ||
version: 10 | ||
|
||
php: | ||
version: 8.1-fpm-bullseye | ||
phpcs: | ||
paths: | ||
- web/modules/custom | ||
standards: | ||
- Drupal | ||
- DrupalPractice | ||
phpstan: | ||
level: max | ||
paths: | ||
- web/modules/custom | ||
|
||
drupal: | ||
docroot: web | ||
|
||
docker-compose: | ||
services: | ||
- database | ||
- php | ||
- web | ||
|
||
dockerfile: | ||
stages: | ||
build: | ||
commands: | ||
- composer validate | ||
- composer install | ||
|
||
experimental: | ||
createGitHubActionsConfiguration: true | ||
runGitHooksBeforePush: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/README.md | ||
/.github/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
export DOCKER_UID=1000 | ||
|
||
export COMPOSE_PROJECT_NAME=drupal | ||
export COMPOSE_PROFILES=web,php,database | ||
|
||
export DOCKER_WEB_VOLUME=.:/app | ||
|
||
export MYSQL_DATABASE=app | ||
export MYSQL_PASSWORD=app | ||
export MYSQL_USER=app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
set -o errexit | ||
|
||
export TTY="-T" | ||
|
||
./run test:commit |
27 changes: 27 additions & 0 deletions
27
tests/snapshots/output/drupal/.githooks/prepare-commit-msg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
# Load the issue ID from an `.issue-id` file within the project and replace the | ||
# `ISSUE_ID` placeholder within a Git commit message. | ||
# | ||
# For example, running `echo "OD-123" > .issue-id` will add `Refs: OD-123` to | ||
# the commit message. | ||
# | ||
# This also works with multiple issue IDs in the same string, e.g. | ||
# "OD-123 OD-456", or IDs on multiple lines. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
PROJECT_DIR=$(git rev-parse --show-toplevel) | ||
ISSUE_FILE="$PROJECT_DIR/.issue-id" | ||
|
||
if [ -f "${ISSUE_FILE}" ]; then | ||
ISSUE_IDS=$(cat "${ISSUE_FILE}" | tr '\n' ',' | tr ' ' ',' | sed 's/,$//' | sed 's/,/, /g') | ||
|
||
if [ -n "${ISSUE_IDS}" ]; then | ||
sed -i.bak "s/# Refs:/Refs: $ISSUE_IDS/" "$1" | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
|
||
env: | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_UID: 1001 | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and test | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 | ||
|
||
- name: Build and test | ||
run: | | ||
./run ci:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
.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 | ||
|
||
# Docker. | ||
.env | ||
docker-compose.override.yaml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ignore: | ||
- DL3059 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
FROM php:8.1-fpm-bullseye AS base | ||
|
||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer | ||
RUN which composer && composer -V | ||
|
||
ARG DOCKER_UID=1000 | ||
ENV DOCKER_UID="${DOCKER_UID}" | ||
|
||
WORKDIR /app | ||
|
||
RUN adduser --disabled-password --uid "${DOCKER_UID}" app \ | ||
&& chown app:app -R /app | ||
|
||
USER app | ||
|
||
ENV PATH="${PATH}:/app/bin:/app/vendor/bin" | ||
|
||
COPY --chown=app:app composer.* ./ | ||
|
||
################################################################################ | ||
|
||
FROM base AS build | ||
|
||
USER root | ||
|
||
|
||
RUN apt-get update -yqq \ | ||
&& apt-get install -yqq --no-install-recommends \ | ||
git libpng-dev libjpeg-dev libzip-dev mariadb-client unzip \ | ||
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \ | ||
&& apt-get clean | ||
|
||
RUN docker-php-ext-configure gd --with-jpeg | ||
|
||
RUN docker-php-ext-install gd pdo_mysql zip | ||
|
||
COPY --chown=app:app phpunit.xml* ./ | ||
|
||
|
||
|
||
USER app | ||
|
||
RUN composer validate | ||
RUN composer install | ||
|
||
COPY --chown=app:app tools/docker/images/php/root / | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-php"] | ||
CMD ["php-fpm"] | ||
|
||
|
||
|
||
|
||
################################################################################ | ||
|
||
FROM nginx:1 as web | ||
|
||
EXPOSE 8080 | ||
|
||
WORKDIR /app | ||
|
||
COPY tools/docker/images/web/root / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs. | ||
|
||
x-proxy: &default-proxy | ||
networks: | ||
- default | ||
- web | ||
labels: | ||
- "traefik.docker.network=traefik_proxy" | ||
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host( | ||
`${COMPOSE_PROJECT_NAME}.localhost`, | ||
)" | ||
|
||
x-app: &default-app | ||
volumes: | ||
- "${DOCKER_WEB_VOLUME:-./web:/app/web}" | ||
env_file: | ||
- .env | ||
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}" | ||
networks: | ||
- default | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "${DOCKER_MYSQL_CPUS:-0}" | ||
memory: "${DOCKER_MYSQL_MEMORY:-0}" | ||
labels: | ||
- "traefik.enabled=false" | ||
tty: true | ||
|
||
services: | ||
web: | ||
<<: [*default-proxy, *default-app] | ||
build: | ||
context: . | ||
target: web | ||
depends_on: | ||
- php | ||
profiles: [web] | ||
|
||
php: | ||
<<: [*default-app] | ||
build: | ||
context: . | ||
target: build | ||
args: | ||
- "DOCKER_UID=${DOCKER_UID:-1000}" | ||
volumes: | ||
- .:/app | ||
depends_on: | ||
- database | ||
profiles: [php] | ||
|
||
database: | ||
image: mariadb:10 | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "${DOCKER_MYSQL_CPUS:-0}" | ||
memory: "${DOCKER_MYSQL_MEMORY:-0}" | ||
volumes: | ||
- db-data:/var/lib/mysql | ||
|
||
env_file: | ||
- .env | ||
labels: | ||
- "traefik.enabled=false" | ||
environment: | ||
MYSQL_RANDOM_ROOT_PASSWORD: true | ||
profiles: [database] | ||
|
||
volumes: | ||
db-data: {} | ||
|
||
networks: | ||
web: | ||
external: true | ||
name: traefik_proxy |
Oops, something went wrong.