mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-06 04:44:19 +01:00
Compare commits
2 Commits
554f28b788
...
ee1a15ee78
| Author | SHA1 | Date | |
|---|---|---|---|
|
ee1a15ee78
|
|||
|
253729abc0
|
59
.github/workflows/ci.yml
vendored
59
.github/workflows/ci.yml
vendored
@@ -13,6 +13,10 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
name: Tests
|
name: Tests
|
||||||
@@ -57,17 +61,62 @@ jobs:
|
|||||||
run: docker compose exec -T php vendor/bin/phpunit
|
run: docker compose exec -T php vendor/bin/phpunit
|
||||||
- name: Doctrine Schema Validator
|
- name: Doctrine Schema Validator
|
||||||
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
|
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
|
||||||
deploy:
|
|
||||||
name: Deploy
|
build-deploy:
|
||||||
|
name: Build and deploy to ${{ startsWith(github.ref, 'refs/tags/') && 'production' || (github.ref == 'refs/heads/main' && 'acceptance' || '') }}
|
||||||
environment:
|
environment:
|
||||||
name: ${{ startsWith(github.ref, 'refs/tags/') && 'production' || (github.ref == 'refs/heads/main' && 'acceptance' || '') }}
|
name: ${{ startsWith(github.ref, 'refs/tags/') && 'production' || (github.ref == 'refs/heads/main' && 'acceptance' || '') }}
|
||||||
url: ${{ vars.URL }}
|
url: ${{ vars.URL }}
|
||||||
needs: tests
|
needs: tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: (github.ref == 'refs/heads/main' && false) || startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- shell: bash
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
|
TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
{
|
||||||
|
echo "tag=$TAG"
|
||||||
|
echo "full_name=ghcr.io/${REPO_LOWER}:$TAG"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||||
|
{
|
||||||
|
echo "tag=$SHORT_SHA"
|
||||||
|
echo "full_name=ghcr.io/${REPO_LOWER}:$SHORT_SHA"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build and Push Docker images
|
||||||
|
uses: docker/bake-action@v5
|
||||||
|
with:
|
||||||
|
pull: true
|
||||||
|
push: true
|
||||||
|
files: |
|
||||||
|
compose.yaml
|
||||||
|
compose.build.yaml
|
||||||
|
set: |
|
||||||
|
*.cache-from=type=gha,scope=${{github.ref}}
|
||||||
|
*.cache-from=type=gha,scope=refs/heads/main
|
||||||
|
*.cache-to=type=gha,scope=${{github.ref}},mode=max
|
||||||
|
*.tags=${{ steps.meta.outputs.full_name }}
|
||||||
|
|
||||||
|
- name: Trigger Portainer Deployment
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
PORTAINER_WEBHOOK: ${{secrets.PORTAINER_WEBHOOK}}
|
PORTAINER_WEBHOOK: ${{secrets.PORTAINER_WEBHOOK}}
|
||||||
run: |
|
run: |
|
||||||
curl -v -X POST "$PORTAINER_WEBHOOK"
|
curl -v -X POST "$PORTAINER_WEBHOOK"?IMAGE_TAG=${{steps.meta.outputs.tag}} --fail-with-body
|
||||||
|
|||||||
14
Dockerfile
14
Dockerfile
@@ -22,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
file \
|
file \
|
||||||
gettext \
|
gettext \
|
||||||
git \
|
git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
install-php-extensions \
|
install-php-extensions \
|
||||||
@@ -32,7 +32,7 @@ RUN set -eux; \
|
|||||||
opcache \
|
opcache \
|
||||||
zip \
|
zip \
|
||||||
gd \
|
gd \
|
||||||
excimer-1.2.3 \
|
excimer \
|
||||||
;
|
;
|
||||||
|
|
||||||
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
|
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
|
||||||
@@ -60,6 +60,14 @@ FROM frankenphp_base AS frankenphp_dev
|
|||||||
|
|
||||||
ENV APP_ENV=dev XDEBUG_MODE=off
|
ENV APP_ENV=dev XDEBUG_MODE=off
|
||||||
|
|
||||||
|
# hadolint ignore=DL3008
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
bash-completion \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY --link frankenphp/console-complete.bash /usr/share/bash-completion/completions/console
|
||||||
|
COPY --link frankenphp/composer-complete.bash /usr/share/bash-completion/completions/composer
|
||||||
|
|
||||||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
|
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
@@ -76,6 +84,8 @@ CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]
|
|||||||
# Prod FrankenPHP image
|
# Prod FrankenPHP image
|
||||||
FROM frankenphp_base AS frankenphp_prod
|
FROM frankenphp_base AS frankenphp_prod
|
||||||
|
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
|
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
|
||||||
|
|
||||||
|
|||||||
5
compose.build.yaml
Normal file
5
compose.build.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
services:
|
||||||
|
php:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
target: frankenphp_prod
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
# Production environment override
|
# Production environment override
|
||||||
services:
|
services:
|
||||||
php:
|
php:
|
||||||
build:
|
image: ghcr.io/marijndoeve/tijdvoordetest:${IMAGE_TAG}
|
||||||
context: .
|
|
||||||
target: frankenphp_prod
|
|
||||||
environment:
|
environment:
|
||||||
APP_SECRET: ${APP_SECRET}
|
APP_SECRET: ${APP_SECRET}
|
||||||
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
|
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
|
||||||
|
|||||||
84
frankenphp/composer-complete.bash
Normal file
84
frankenphp/composer-complete.bash
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# This file is part of the Symfony package.
|
||||||
|
#
|
||||||
|
# (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
#
|
||||||
|
# For the full copyright and license information, please view
|
||||||
|
# https://symfony.com/doc/current/contributing/code/license.html
|
||||||
|
|
||||||
|
_sf_composer() {
|
||||||
|
# Use newline as only separator to allow space in completion values
|
||||||
|
local IFS=$'\n'
|
||||||
|
local sf_cmd="${COMP_WORDS[0]}"
|
||||||
|
|
||||||
|
# for an alias, get the real script behind it
|
||||||
|
sf_cmd_type=$(type -t $sf_cmd)
|
||||||
|
if [[ $sf_cmd_type == "alias" ]]; then
|
||||||
|
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
|
||||||
|
elif [[ $sf_cmd_type == "file" ]]; then
|
||||||
|
sf_cmd=$(type -p $sf_cmd)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cur prev words cword
|
||||||
|
_get_comp_words_by_ref -n := cur prev words cword
|
||||||
|
|
||||||
|
local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-S2.8.11")
|
||||||
|
for w in ${words[@]}; do
|
||||||
|
w=$(printf -- '%b' "$w")
|
||||||
|
# remove quotes from typed values
|
||||||
|
quote="${w:0:1}"
|
||||||
|
if [ "$quote" == \' ]; then
|
||||||
|
w="${w%\'}"
|
||||||
|
w="${w#\'}"
|
||||||
|
elif [ "$quote" == \" ]; then
|
||||||
|
w="${w%\"}"
|
||||||
|
w="${w#\"}"
|
||||||
|
fi
|
||||||
|
# empty values are ignored
|
||||||
|
if [ ! -z "$w" ]; then
|
||||||
|
completecmd+=("-i$w")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local sfcomplete
|
||||||
|
if sfcomplete=$(${completecmd[@]} 2>&1); then
|
||||||
|
local quote suggestions
|
||||||
|
quote=${cur:0:1}
|
||||||
|
|
||||||
|
# Use single quotes by default if suggestions contains backslash (FQCN)
|
||||||
|
if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
|
||||||
|
quote=\'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$quote" == \' ]; then
|
||||||
|
# single quotes: no additional escaping (does not accept ' in values)
|
||||||
|
suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
|
||||||
|
elif [ "$quote" == \" ]; then
|
||||||
|
# double quotes: double escaping for \ $ ` "
|
||||||
|
suggestions=$(for s in $sfcomplete; do
|
||||||
|
s=${s//\\/\\\\}
|
||||||
|
s=${s//\$/\\\$}
|
||||||
|
s=${s//\`/\\\`}
|
||||||
|
s=${s//\"/\\\"}
|
||||||
|
printf $'%q%q%q\n' "$quote" "$s" "$quote";
|
||||||
|
done)
|
||||||
|
else
|
||||||
|
# no quotes: double escaping
|
||||||
|
suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
|
||||||
|
fi
|
||||||
|
COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
|
||||||
|
__ltrim_colon_completions "$cur"
|
||||||
|
else
|
||||||
|
if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
|
||||||
|
>&2 echo
|
||||||
|
>&2 echo $sfcomplete
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _sf_composer composer
|
||||||
94
frankenphp/console-complete.bash
Normal file
94
frankenphp/console-complete.bash
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# This file is part of the Symfony package.
|
||||||
|
#
|
||||||
|
# (c) Fabien Potencier <fabien@symfony.com>
|
||||||
|
#
|
||||||
|
# For the full copyright and license information, please view
|
||||||
|
# https://symfony.com/doc/current/contributing/code/license.html
|
||||||
|
|
||||||
|
_sf_console() {
|
||||||
|
|
||||||
|
# Use the default completion for shell redirect operators.
|
||||||
|
for w in '>' '>>' '&>' '<'; do
|
||||||
|
if [[ $w = "${COMP_WORDS[COMP_CWORD-1]}" ]]; then
|
||||||
|
compopt -o filenames
|
||||||
|
COMPREPLY=($(compgen -f -- "${COMP_WORDS[COMP_CWORD]}"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Use newline as only separator to allow space in completion values
|
||||||
|
local IFS=$'\n'
|
||||||
|
local sf_cmd="${COMP_WORDS[0]}"
|
||||||
|
|
||||||
|
# for an alias, get the real script behind it
|
||||||
|
sf_cmd_type=$(type -t $sf_cmd)
|
||||||
|
if [[ $sf_cmd_type == "alias" ]]; then
|
||||||
|
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
|
||||||
|
elif [[ $sf_cmd_type == "file" ]]; then
|
||||||
|
sf_cmd=$(type -p $sf_cmd)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local cur prev words cword
|
||||||
|
_get_comp_words_by_ref -n := cur prev words cword
|
||||||
|
|
||||||
|
local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-a1")
|
||||||
|
for w in ${words[@]}; do
|
||||||
|
w="${w//\\\\/\\}"
|
||||||
|
# remove quotes from typed values
|
||||||
|
quote="${w:0:1}"
|
||||||
|
if [ "$quote" == \' ]; then
|
||||||
|
w="${w%\'}"
|
||||||
|
w="${w#\'}"
|
||||||
|
elif [ "$quote" == \" ]; then
|
||||||
|
w="${w%\"}"
|
||||||
|
w="${w#\"}"
|
||||||
|
fi
|
||||||
|
# empty values are ignored
|
||||||
|
if [ ! -z "$w" ]; then
|
||||||
|
completecmd+=("-i$w")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
local sfcomplete
|
||||||
|
if sfcomplete=$(${completecmd[@]} 2>&1); then
|
||||||
|
local quote suggestions
|
||||||
|
quote=${cur:0:1}
|
||||||
|
|
||||||
|
# Use single quotes by default if suggestions contains backslash (FQCN)
|
||||||
|
if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
|
||||||
|
quote=\'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$quote" == \' ]; then
|
||||||
|
# single quotes: no additional escaping (does not accept ' in values)
|
||||||
|
suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
|
||||||
|
elif [ "$quote" == \" ]; then
|
||||||
|
# double quotes: double escaping for \ $ ` "
|
||||||
|
suggestions=$(for s in $sfcomplete; do
|
||||||
|
s=${s//\\/\\\\}
|
||||||
|
s=${s//\$/\\\$}
|
||||||
|
s=${s//\`/\\\`}
|
||||||
|
s=${s//\"/\\\"}
|
||||||
|
printf $'%q%q%q\n' "$quote" "$s" "$quote";
|
||||||
|
done)
|
||||||
|
else
|
||||||
|
# no quotes: double escaping
|
||||||
|
suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
|
||||||
|
fi
|
||||||
|
COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
|
||||||
|
__ltrim_colon_completions "$cur"
|
||||||
|
else
|
||||||
|
if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
|
||||||
|
>&2 echo
|
||||||
|
>&2 echo $sfcomplete
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _sf_console console
|
||||||
Reference in New Issue
Block a user