Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit a62f56d

Browse files
committed
v0.1 [moved from gitlab]
0 parents  commit a62f56d

File tree

81 files changed

+12005
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+12005
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.idea
2+
/vendor
3+
/tests/coverage
4+
/reports
5+
/.phpunit.result.cache

.gitlab-ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
variables:
2+
DOCKER_DRIVER: overlay2
3+
JOB_IMAGE: git.var-lab.com:5050/dev-tools/glubuntu-php:latest-php-8.1
4+
GIT_STRATEGY: clone
5+
6+
stages:
7+
- pre
8+
- test
9+
- build
10+
- deploy
11+
12+
#check_commits:
13+
# stage: pre
14+
# rules:
15+
# - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
16+
# - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
17+
# script:
18+
# - >
19+
# if echo "$CI_COMMIT_MESSAGE" | egrep '(^(#)[0-9]+\s)' >/dev/null ; then
20+
# echo "Commit message is valid."
21+
# else
22+
# echo "Commit message is invalid. The first line has to contain a ticket/issue id like #123."
23+
# exit 1
24+
# fi
25+
# - >
26+
# if [[ "$CI_MERGE_REQUEST_TITLE" ]]; then
27+
# Replacement=""
28+
# CLEAR_TITLE="${CI_MERGE_REQUEST_TITLE/Draft: /${Replacement}}"
29+
# if echo "$CLEAR_TITLE" | egrep '(^(#)[0-9]+\s)' >/dev/null ; then
30+
# echo "Merge request title is valid."
31+
# else
32+
# echo "Merge request title is invalid. It has to contain a ticket/issue id like #123 or Draft: #123."
33+
# exit 1
34+
# fi
35+
# fi
36+
37+
tests_unit:
38+
rules:
39+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
40+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
41+
image:
42+
name: $JOB_IMAGE
43+
stage:
44+
test
45+
# services:
46+
# - name: mysql:8.0.28
47+
# alias: database
48+
# variables:
49+
# MYSQL_DATABASE_NAME: symfony
50+
# MYSQL_ROOT_PASSWORD: root
51+
# MYSQL_USER: symfony
52+
# MYSQL_PASSWORD: symfony
53+
# MYSQL_DATABASE: symfony
54+
script:
55+
# - mysql -h database -u root -proot <<< "SET GLOBAL sql_mode = '';"
56+
- composer install
57+
- composer run tests:unit
58+
59+
tests_integration:
60+
rules:
61+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
62+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
63+
image:
64+
name: $JOB_IMAGE
65+
stage:
66+
test
67+
# services:
68+
# - name: mysql:8.0.28
69+
# alias: database
70+
# variables:
71+
# MYSQL_DATABASE_NAME: symfony
72+
# MYSQL_ROOT_PASSWORD: root
73+
# MYSQL_USER: symfony
74+
# MYSQL_PASSWORD: symfony
75+
# MYSQL_DATABASE: symfony
76+
script:
77+
# - mysql -h database -u root -proot <<< "SET GLOBAL sql_mode = '';"
78+
- composer install
79+
- composer run tests:integration
80+
81+
checks:
82+
rules:
83+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
84+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH)
85+
image:
86+
name: $JOB_IMAGE
87+
stage:
88+
test
89+
script:
90+
- composer install
91+
- composer normalize --dry-run
92+
- composer run lint:php
93+
- composer run phpstan

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Contributing
2+
3+
To contribute, [create a free account](https://git.var-lab.com/users/sign_up) on this GitLab instance for bug report submissions.
4+
5+
If you're keen to contribute, follow these steps:
6+
7+
## Reporting a Bug
8+
9+
Before submitting a bug:
10+
11+
- Review the project documentation.
12+
- Familiarize yourself with the Lexoffice public API documentation.
13+
- If you're sure it's a bug, use the official bug tracker and adhere to these guidelines:
14+
15+
1. Use a clear title to describe the issue.
16+
2. Provide concise steps to reproduce the bug, ideally with code examples or a failing unit test.
17+
3. For complex issues or multi-layered impacts, include a reproducer.
18+
4. Furnish comprehensive details about your environment (OS, PHP version, Symfony version, enabled extensions, etc.).
19+
5. If an exception occurred, supply the stack trace. For HTML pages, provide the plain text version at the bottom of the page. Avoid screenshots for indexing purposes. Similarly, for terminal errors, avoid screenshots and opt for copy/pasting the contents. If the stack trace is extensive, consider enclosing it in a "Details" section.
20+
6. Optionally, attach a patch.
21+
22+
## Coding Standards
23+
24+
We using PHP-Codesniffer to ensure coding styles and standards. The rules are defined in our [coding-standard composer package](https://git.var-lab.com/var-lab.com/coding-standard-php).
25+
26+
### Check the code
27+
28+
```
29+
composer run lint:php
30+
```
31+
32+
### Run the fixer
33+
34+
```
35+
composer run lint:php:fix
36+
```
37+
38+
## Running tests
39+
40+
```
41+
composer run tests
42+
composer run tests:unit
43+
composer run tests:integration
44+
```

Dockerfile

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# the different stages of this Dockerfile are meant to be built into separate images
2+
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
3+
# https://docs.docker.com/compose/compose-file/#target
4+
5+
# -------------
6+
# generic php base image
7+
# -------------
8+
FROM php:8.1-fpm-alpine AS base
9+
10+
RUN apk update
11+
RUN apk add --no-cache \
12+
git \
13+
fcgi
14+
15+
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \
16+
&& docker-php-ext-install -j$(nproc) \
17+
sockets \
18+
posix \
19+
pcntl \
20+
&& rm -rf /tmp/pear \
21+
&& apk del .build-deps
22+
23+
#RUN docker-php-ext-enable apcu
24+
COPY --from=composer:2.5.1 /usr/bin/composer /usr/local/bin/composer
25+
26+
VOLUME /var/run/php
27+
28+
COPY docker/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf
29+
30+
COPY docker/php-entrypoint.sh /usr/local/bin/docker-entrypoint
31+
RUN chmod +x /usr/local/bin/docker-entrypoint
32+
33+
COPY docker/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
34+
RUN chmod +x /usr/local/bin/docker-healthcheck
35+
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
36+
37+
ENTRYPOINT ["docker-entrypoint"]
38+
CMD ["php-fpm"]
39+
40+
# -------------
41+
# generic build
42+
# -------------
43+
FROM base AS build_generic
44+
45+
#ARG CI_JOB_TOKEN=
46+
ARG COMPOSER_AUTH=
47+
48+
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
49+
ENV COMPOSER_ALLOW_SUPERUSER=1
50+
ENV COMPOSER_AUTH=${COMPOSER_AUTH}
51+
52+
WORKDIR /srv/php
53+
54+
# prevent the reinstallation of vendors at every changes in the source code
55+
COPY composer.json .
56+
# composer.lock symfony.lock ./
57+
58+
# copy only specifically what we need
59+
COPY config config/
60+
COPY src src/
61+
62+
RUN mkdir -p var/log
63+
64+
VOLUME /srv/php/var
65+
66+
# ---------
67+
# prod build
68+
# ---------
69+
FROM build_generic AS build_prod
70+
71+
WORKDIR /srv/php
72+
73+
RUN composer install --prefer-dist --no-dev --no-scripts --no-progress -v && \
74+
composer clear-cache
75+
76+
ENV APP_ENV=prod
77+
78+
RUN composer dump-autoload --classmap-authoritative --no-dev && \
79+
composer run-script --no-dev post-install-cmd && \
80+
chmod +x bin/console && \
81+
sync
82+
83+
# ---------
84+
# dev build
85+
# ---------
86+
FROM build_generic AS build_dev
87+
88+
COPY tests tests/
89+
COPY phpunit.xml.dist phpstan.neon ./
90+
91+
RUN composer install --prefer-dist --no-scripts --no-progress && \
92+
composer clear-cache
93+
94+
RUN composer dump-autoload && \
95+
composer run-script post-install-cmd || \
96+
chmod +x bin/console && \
97+
sync
98+
99+
# --------------
100+
# php prod image
101+
# --------------
102+
FROM base AS php
103+
104+
WORKDIR /srv/php
105+
106+
RUN ln -sf $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
107+
108+
# Modify memory limit
109+
RUN echo 'memory_limit = 512M' >> $PHP_INI_DIR/conf.d/memory_limit_php.ini
110+
111+
COPY --from=build_prod /srv/php /srv/php
112+
RUN chown -R www-data var
113+
114+
# -------------
115+
# php dev image
116+
# -------------
117+
FROM base AS php_dev
118+
119+
WORKDIR /srv/php
120+
121+
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \
122+
&& pecl install xdebug-3.2.0 \
123+
&& docker-php-ext-enable xdebug \
124+
&& apk del .build-deps
125+
126+
ARG COMPOSER_AUTH=
127+
128+
RUN wget -O /usr/local/bin/local-php-security-checker https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64 \
129+
&& chmod +x /usr/local/bin/local-php-security-checker
130+
131+
COPY phpunit.xml.dist phpstan.neon ./
132+
COPY --from=build_dev /srv/php /srv/php
133+
RUN chown -R www-data var
134+
135+
RUN ln -sf $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini
136+
137+
# Modify memory limit
138+
RUN echo 'memory_limit = 1024M' >> $PHP_INI_DIR/conf.d/memory_limit_php.ini
139+
140+
RUN apk add --no-cache nodejs npm && \
141+
npm install -g json-server
142+
143+
ENV COMPOSER_ALLOW_SUPERUSER=1
144+
ENV COMPOSER_AUTH=${COMPOSER_AUTH}

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2024-present var-lab IT GmbH / Anton Dachauer
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sh:
2+
@echo "Start shell in php container"
3+
make up && docker-compose exec -it php sh
4+
5+
up:
6+
@echo "Start docker"
7+
docker-compose up -d
8+
9+
ps:
10+
@echo "Show running docker containers"
11+
docker-compose ps
12+
13+
build:
14+
@echo "Build docker container"
15+
docker-compose build -d

0 commit comments

Comments
 (0)