Skip to content

Commit 41913bb

Browse files
committed
refacto: Move some file to match with comment
1 parent b1af0b6 commit 41913bb

File tree

34 files changed

+108
-164
lines changed

34 files changed

+108
-164
lines changed

.docker/php/conf.d/20-app.prod.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
data/
1+
data/

.editorconfig

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
composer-options: "--no-scripts"
6363

6464
- name: PHPStan
65-
run: make phpstan
65+
run: ./bin/phpstan --memory-limit=-1
6666

6767
functional:
6868
name: "Functional tests"
@@ -77,16 +77,15 @@ jobs:
7777
key: |
7878
docker-${{ runner.os }}-${{ hashFiles(
7979
'compose.yml',
80-
'docker/dockerfiles/apachephp/Dockerfile',
81-
'docker/dockerfiles/mysql/Dockerfile',
82-
'docker/dockerfiles/mysqltest/Dockerfile'
80+
'docker/apachephp/Dockerfile',
81+
'docker/mysql/dev/Dockerfile',
82+
'docker/mysql/test/Dockerfile'
8383
) }}
8484
8585
- name: Tests - Functional
8686
run: |
87-
cp docker.env docker.env.local
88-
cp .env.dist .env
89-
mkdir -p ./htdocs/uploads -p ./tmp
87+
make init-file
88+
make init-folder
9089
docker compose up -d
9190
docker compose exec --user localUser apachephp composer install --no-scripts
9291
docker compose run --rm node bash -c "npm install --legacy-peer-deps && npm run build"
@@ -119,18 +118,15 @@ jobs:
119118
key: |
120119
docker-${{ runner.os }}-${{ hashFiles(
121120
'compose.yml',
122-
'Dockerfile',
123-
'docker/dockerfiles/mysql/Dockerfile',
124-
'docker/dockerfiles/mysqltest/Dockerfile'
121+
'docker/apachephp/Dockerfile',
122+
'docker/mysql/dev/Dockerfile',
123+
'docker/mysql/test/Dockerfile'
125124
) }}
126125
127126
- name: Tests - Integration
128127
run: |
129-
cp docker.env docker.env.local
130-
cp -n .env.dist .env
131-
docker compose up -d
132-
docker compose exec --user localUser apachephp composer install --no-scripts
133-
docker compose exec -u localUser apachephp ./bin/phpunit --testsuite integration
128+
make init-file
129+
make test-integration-ci
134130
135131
rector:
136132
name: "Rector"
@@ -149,4 +145,4 @@ jobs:
149145
composer-options: "--no-scripts"
150146

151147
- name: Rector
152-
run: make rector
148+
run: ./bin/rector --dry-run

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
###> docker file ###
55
docker.env.local
6-
.docker/data/history
6+
docker/data/history
77

88
deps.lock
99
.idea

Dockerfile

Lines changed: 0 additions & 104 deletions
This file was deleted.

Makefile

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
default: help
22

33
# Variables
4-
CURRENT_UID ?= $(shell id -u)
5-
DOCKER_UP_OPTIONS ?=
64
DOCKER_COMPOSE_BIN ?= docker compose
75

86
# Colors
@@ -13,9 +11,8 @@ TEXT_BOLD = \033[1m
1311

1412
##@ Setup 📜
1513
### Installer le projet from scratch
16-
install:
17-
cp -n .env.dist .env && cp -n docker.env docker.env.local && cp -n ./docker/data/history.dist ./docker/data/history && cp -n compose.override.yml-dist compose.override.yml
18-
mkdir -p ./htdocs/uploads -p ./tmp
14+
install: init-file init-folder
15+
cp -n ./docker/data/history.dist ./docker/data/history && cp -n compose.override.yml-dist compose.override.yml
1916

2017
$(DOCKER_COMPOSE_BIN) up -d --build
2118

@@ -26,7 +23,7 @@ install:
2623
$(MAKE) --no-print-directory build-assets
2724

2825
# Reset la base de donnée
29-
cat ./.docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
26+
cat ./docker/mysql/reset-db.sql | $(DOCKER_COMPOSE_BIN) run -T --rm db /opt/mysql_no_db
3027

3128
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx migrate
3229
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp php bin/phinx seed:run
@@ -35,7 +32,7 @@ install:
3532
reset:
3633
$(DOCKER_COMPOSE_BIN) down --remove-orphans -v
3734
rm -f ./.env -f ./docker.env.local -f ./docker/data/history -f compose.override.yml
38-
sudo rm -rf ./var ./vendor ./node_modules ./htdocs/bundles ./htdocs/docs ./htdocs/uploads ./htdocs/assets ./tmp
35+
sudo rm -rf ./var/cache/dev ./var/cache/prod ./var/cache/test ./var/logs/*.log ./vendor ./node_modules ./htdocs/bundles ./htdocs/docs ./htdocs/uploads ./htdocs/assets ./tmp
3936

4037
### Reinstalle le projet from scratch
4138
reinstall: reset install
@@ -54,24 +51,20 @@ watch-assets:
5451
$(DOCKER_COMPOSE_BIN) run --rm node npm run watch
5552

5653
##@ Quality ✨
57-
### Installe l'environment de test
58-
install-test:
59-
mkdir -p ./htdocs/uploads -p ./tmp
60-
6154
### Lance toute la suite de tests
6255
tests: cs-lint unit-test test-integration behat
6356

6457
### Lance les tests unitaire
6558
unit-test:
66-
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephptest ./bin/phpunit --testsuite unit
59+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/phpunit --testsuite unit
6760

6861
### Tests d'intégration
6962
test-integration: # not work
70-
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephptest ./bin/phpunit --testsuite integration
63+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/phpunit --testsuite integration
7164

7265
### Tests fonctionnels
7366
behat:
74-
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephptest ./bin/behat
67+
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp ./bin/behat
7568

7669
### PHP CS Fixer (dry run)
7770
cs-lint:
@@ -108,7 +101,7 @@ test-integration-ci:
108101

109102
### Analyse PHPStan
110103
phpstan:
111-
docker run -v $(shell pwd):/app --rm ghcr.io/phpstan/phpstan
104+
$(DOCKER_COMPOSE_BIN) exec -u localUser apachephp ./bin/phpstan --memory-limit=-1
112105

113106
##@ Docker 🐳
114107
### Démarrer un bash dans le container PHP
@@ -139,9 +132,12 @@ help:
139132
.PHONY: install tests hooks console phpstan help
140133
.SILENT: help
141134

135+
## Target only used by other make command
136+
# Used by "rector" target
142137
var/cache/dev/AppKernelDevDebugContainer.xml:
143138
$(DOCKER_COMPOSE_BIN) exec --user localUser apachephp bin/console cache:warmup --env=dev
144139

140+
# Used by "hooks" target
145141
pre-commit:
146142
echo "#!/bin/sh" > .git/hooks/pre-commit
147143
echo "docker compose run --rm -u localUser apachephp make test" >> .git/hooks/pre-commit
@@ -151,3 +147,11 @@ post-checkout:
151147
echo "#!/bin/sh" > .git/hooks/post-checkout
152148
echo "docker compose run --rm -u localUser apachephp composer install --no-scripts" >> .git/hooks/post-checkout
153149
chmod +x .git/hooks/post-checkout
150+
151+
# Used by CI and "install" target
152+
init-file:
153+
cp -n .env.dist .env && cp -n docker.env docker.env.local
154+
155+
# Used by CI and "install" target
156+
init-folder:
157+
mkdir -p ./htdocs/uploads -p ./tmp

compose.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
apachephp:
33
build:
4-
context: .
4+
context: ./docker/apachephp
55
target: afup_web_dev
66
container_name: afup-web-apachephp
77
environment:
@@ -13,15 +13,15 @@ services:
1313
volumes:
1414
- ./:/var/www/html
1515
# Permet d'avoir un bash history ainsi que des alias bash quand on est dans le container
16-
- ./.docker/config/bashrc:/home/localUser/.bashrc
17-
- ./.docker/config/bash_aliases:/home/localUser/.bash_aliases
18-
- ./.docker/data/history:/home/localUser/.bash_history
16+
- ./docker/config/bashrc:/home/localUser/.bashrc
17+
- ./docker/config/bash_aliases:/home/localUser/.bash_aliases
18+
- ./docker/data/history:/home/localUser/.bash_history
1919
depends_on:
2020
- db
2121
- mailcatcher
2222

2323
db:
24-
build: ./docker/dockerfiles/mysql
24+
build: ./docker/mysql/dev
2525
container_name: afup-web-db
2626
environment:
2727
MYSQL_ROOT_PASSWORD: root
@@ -44,7 +44,7 @@ services:
4444
profiles: [front] # Avec ce paramètre node n'est pas lancé quand on docker compose up
4545

4646
dbtest:
47-
build: ./docker/dockerfiles/mysqltest
47+
build: ./docker/mysql/test
4848
container_name: afup-web-db-test
4949
environment:
5050
MYSQL_ROOT_PASSWORD: root
@@ -60,7 +60,7 @@ services:
6060

6161
apachephptest:
6262
build:
63-
context: .
63+
context: ./docker/apachephp
6464
target: afup_web_dev
6565
container_name: afup-web-apachephp-test
6666
environment:
@@ -74,9 +74,9 @@ services:
7474
volumes:
7575
- ./:/var/www/html
7676
# Permet d'avoir un bash history ainsi que des alias bash quand on est dans le container
77-
- ./.docker/config/bashrc:/localUser/.bashrc
78-
- ./.docker/config/bash_aliases:/localUser/.bash_aliases
79-
- ./.docker/data/history:/localUser/.bash_history
77+
- ./docker/config/bashrc:/localUser/.bashrc
78+
- ./docker/config/bash_aliases:/localUser/.bash_aliases
79+
- ./docker/data/history:/localUser/.bash_history
8080
healthcheck:
8181
test: [ "CMD", "curl", "-f", "https://apachephptest:80" ]
8282
interval: 30s
@@ -92,4 +92,4 @@ services:
9292
image: nginx:1.25.4
9393
container_name: afup-web-static
9494
volumes:
95-
- ./.docker/data/test/static-resources:/usr/share/nginx/html:ro
95+
- ./docker/data/test/static-resources:/usr/share/nginx/html:ro

doc/dev-setup.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Il faut se connecter au container via `make console` puis :
9999
./bin/behat
100100
```
101101

102+
ou
103+
104+
```bash
105+
make behat
106+
```
107+
102108
> [!TIP]
103109
> Il est possible de spécifier un test dans la ligne de commande :
104110
> ```bash
@@ -119,15 +125,15 @@ Si par la suite, vous souhaitez lancer un test, il faut bien penser à les allum
119125
Les tests unitaires sont écrits via PHPUnit.
120126

121127
```bash
122-
bash unit-test
128+
make unit-test
123129
```
124130

125131
### Tests d'intégration
126132

127133
Ces tests sont écrits via PHPUnit et utilisent le kernel de Symfony : https://symfony.com/doc/current/testing.html#integration-tests
128134

129135
```bash
130-
bash test-integration
136+
make test-integration
131137
```
132138

133139
Une alternative est d'utiliser la commande `make test-integration`, attention cette commande arrête les containeurs de

0 commit comments

Comments
 (0)