Skip to content

Commit 4a52d52

Browse files
committed
.
1 parent c7745d9 commit 4a52d52

39 files changed

+4088
-2796
lines changed

.env

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1-
APP_ENV=local
2-
APP_SECRET=mrUNGjJoBIWWDoHLuX9KDpYsAduxugyPtX4STBT2
3-
APP_DEBUG=true
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
# https://symfony.com/doc/current/configuration/secrets.html
13+
#
14+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
15+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
16+
17+
###> symfony/framework-bundle ###
18+
APP_ENV=dev
19+
APP_SECRET=dc28c31dee8b8db3059cdbbf8337b102
20+
###< symfony/framework-bundle ###

.env.local.dist

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
14
# For debugging with xdebug and vscode
25
#
36
# XDEBUG_MODE=develop,debug
@@ -12,7 +15,7 @@
1215
# "type": "php",
1316
# "request": "launch",
1417
# "port": 5902,
15-
# "hostname": "localhost",
18+
# "hostname": "0.0.0.0",
1619
# "pathMappings": {
1720
# "/app/": "${workspaceRoot}"
1821
# }

.env.test

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='PBaszak\ExtendedApiDocBundle\Tests\Kernel'
3+
APP_SECRET='$ecretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999
5+
PANTHER_APP_ENV=panther
6+
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

.github/workflows/ci.yml

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
name: CI
1+
name: Symfony Application Check
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
6-
build-test:
7-
runs-on: ubuntu-latest
6+
build-and-test:
7+
runs-on: ubuntu-latest
88

9-
steps:
10-
- uses: actions/checkout@v3
9+
steps:
10+
- name: Checkout Repository
11+
uses: actions/checkout@v3
1112

12-
- uses: php-actions/composer@v6
13+
- name: Running start.sh Script
14+
run: bash start.sh
1315

14-
- name: PHPUnit Tests
15-
uses: php-actions/phpunit@master
16-
with:
17-
configuration: phpunit.xml.dist
18-
exclude_group: integration, performance
16+
- name: Application Verification
17+
run: docker exec php composer cache:clear
18+
19+
- name: Running PHPStan
20+
run: docker exec php composer code:analyse
21+
22+
- name: Running PHP-CS-Fixer
23+
run: docker exec php composer code:fix -- --dry-run --diff -vvv
24+
25+
- name: Running PHPUnit
26+
run: docker exec php composer test:cc

.gitignore

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# directories
2+
.vscode
3+
node_modules
4+
vendor
5+
app
6+
7+
# files
8+
.dockerfile_checksum
9+
.env.local
110

211
###> symfony/framework-bundle ###
312
/.env.local
@@ -9,22 +18,12 @@
918
/vendor/
1019
###< symfony/framework-bundle ###
1120

12-
/.vscode
13-
/node_modules/
14-
/.dockerfile_checksum
15-
1621
###> friendsofphp/php-cs-fixer ###
1722
/.php-cs-fixer.php
1823
/.php-cs-fixer.cache
1924
###< friendsofphp/php-cs-fixer ###
2025

21-
###> symfony/phpunit-bridge ###
22-
.phpunit.result.cache
23-
/phpunit.xml
24-
###< symfony/phpunit-bridge ###
25-
2626
###> phpunit/phpunit ###
2727
/phpunit.xml
2828
.phpunit.result.cache
29-
/.phpunit.cache/
3029
###< phpunit/phpunit ###

.gitlab-ci.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
stages:
2+
- compile
3+
- test
4+
# - deploy
5+
6+
compile:
7+
stage: compile
8+
image: composer:latest
9+
script:
10+
- composer install
11+
artifacts:
12+
when: always
13+
paths:
14+
- vendor/
15+
- var/cache/
16+
expire_in: 10 minutes
17+
only:
18+
- merge_requests
19+
- master
20+
tags:
21+
- docker
22+
23+
code:analyse:
24+
stage: test
25+
image: php:latest
26+
script:
27+
- vendor/bin/phpstan analyse src -c tools/phpstan/fpm-config.neon
28+
only:
29+
- merge_requests
30+
- master
31+
tags:
32+
- docker
33+
needs:
34+
- job: compile
35+
artifacts: true
36+
37+
code:cs-fixer:
38+
stage: test
39+
image: php:latest
40+
script:
41+
- vendor/bin/php-cs-fixer fix --dry-run --diff -vvv
42+
only:
43+
- merge_requests
44+
- master
45+
tags:
46+
- docker
47+
needs:
48+
- job: compile
49+
artifacts: true
50+
51+
code:test:
52+
stage: test
53+
image: php:latest
54+
before_script:
55+
- pecl install xdebug
56+
- docker-php-ext-enable xdebug
57+
- echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
58+
script:
59+
- vendor/bin/phpunit --do-not-cache-result --log-junit var/coverage/phpunit-report.xml --coverage-cobertura var/coverage/phpunit-coverage.xml --coverage-text --colors=never
60+
only:
61+
- merge_requests
62+
- master
63+
tags:
64+
- docker
65+
needs:
66+
- job: compile
67+
artifacts: true
68+
artifacts:
69+
when: always
70+
reports:
71+
junit: var/coverage/phpunit-report.xml
72+
coverage_report:
73+
coverage_format: cobertura
74+
path: var/coverage/phpunit-coverage.xml
75+
coverage: '/^\s*Lines:\s*\d+.\d+\%/'
76+
77+
# deploy:
78+
# stage: deploy
79+
# image: alpine
80+
# script:
81+
# - apk add curl
82+
# - 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
83+
# only:
84+
# - tags
85+
# tags:
86+
# - docker

Dockerfile

+35-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,43 @@ FROM php:latest
22

33
RUN apt update \
44
&& apt-get update \
5-
&& apt install -y git unzip
5+
&& apt install -y git jq unzip
66

7-
# install xdebug
7+
## install xdebug extension
88
RUN pecl install xdebug \
99
&& docker-php-ext-enable xdebug
1010

11-
# install composer
11+
## install opcache extension
12+
# RUN pecl install opcache \
13+
# && docker-php-ext-enable opcache
14+
15+
## install amqp extension
16+
# RUN apt-get install -y librabbitmq-dev \
17+
# && pecl install amqp \
18+
# && docker-php-ext-enable amqp
19+
20+
## install redis extension
21+
# RUN pecl install redis \
22+
# && docker-php-ext-enable redis
23+
24+
## install composer
1225
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
26+
RUN mkdir -p /.composer && chmod -R 777 /.composer
27+
28+
### Setup environment variables
29+
COPY package.json composer.json .gi[t] /tmp/
30+
WORKDIR /tmp
31+
## define app version and store it in environment variable
32+
RUN echo "APP_VERSION=$(jq -r '.version' '/tmp/package.json')" >> /etc/environment
33+
RUN rm -rf /tmp/package.json
34+
## define app commit sha and store it in environment variable
35+
RUN echo "APP_COMMIT_SHA=$(git rev-parse HEAD)" >> /etc/environment
36+
RUN echo "APP_COMMIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> /etc/environment
37+
RUN rm -rf .git
38+
## define app name and store it in environment variable
39+
RUN echo "APP_NAME=$(jq -r '.name' '/tmp/composer.json')" >> /etc/environment
40+
RUN echo "APP_DESCRIPTION=\"$(jq -r '.description' '/tmp/composer.json')\"" >> /etc/environment
41+
RUN echo "APP_TITLE=\"$(jq -r '.title' '/tmp/composer.json')\"" >> /etc/environment
42+
RUN rm -rf /tmp/composer.json
43+
WORKDIR /app
44+
### End of environment variables setup

LICENSE

-21
This file was deleted.

0 commit comments

Comments
 (0)