Skip to content

Commit 7e1075c

Browse files
committed
Refactor de l'indexation de planete PHP
1 parent 2798348 commit 7e1075c

29 files changed

+882
-2456
lines changed

.github/workflows/ci.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: composer install --no-scripts
3333

3434
- name: Tests - Unit
35-
run: ./bin/phpunit
35+
run: ./bin/phpunit --testsuite unit
3636

3737
lint:
3838
name: "Linter"
@@ -128,3 +128,27 @@ jobs:
128128
with:
129129
name: Functional tests - deprecated log - report
130130
path: var/logs/test.deprecations_grouped.log
131+
132+
integration:
133+
name: "Integration tests"
134+
runs-on: ubuntu-22.04
135+
136+
steps:
137+
- uses: actions/checkout@v4
138+
139+
- name: Cache Docker images.
140+
uses: ScribeMD/docker-cache@0.5.0
141+
with:
142+
key: |
143+
docker-${{ runner.os }}-${{ hashFiles(
144+
'compose.yml',
145+
'docker/dockerfiles/apachephp/Dockerfile',
146+
'docker/dockerfiles/mysql/Dockerfile',
147+
'docker/dockerfiles/mysqltest/Dockerfile'
148+
) }}
149+
150+
- name: Delete symfony cache
151+
run: rm -rf var/cache/test
152+
153+
- name: Tests - Integration
154+
run: make test-integration-ci

Makefile

+12-1
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,13 @@ console:
6565

6666
### (Dans Docker) Tests unitaires
6767
test:
68-
./bin/phpunit
68+
./bin/phpunit --testsuite unit
6969
./bin/php-cs-fixer fix --dry-run -vv
7070

71+
### (Dans Docker) Tests d'intégration
72+
test-integration:
73+
./bin/phpunit --testsuite integration
74+
7175
### (Dans Docker) Tests fonctionnels
7276
behat:
7377
./bin/behat
@@ -89,6 +93,13 @@ test-functional: data config htdocs/uploads tmp
8993
make var/logs/test.deprecations_grouped.log
9094
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) stop dbtest apachephptest mailcatcher
9195

96+
### Tests d'intégration avec start/stop des images docker
97+
test-integration-ci:
98+
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) stop dbtest apachephptest
99+
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) up -d dbtest apachephptest
100+
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm -u localUser apachephp ./bin/phpunit --testsuite integration
101+
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) stop dbtest apachephptest
102+
92103
### Analyse PHPStan
93104
phpstan:
94105
docker run -v $(shell pwd):/app --rm ghcr.io/phpstan/phpstan

app/config/services.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ services:
3131
autowire: true
3232
autoconfigure: true
3333

34+
AppBundle\Clock\NativeClock: ~
35+
Psr\Clock\ClockInterface: '@AppBundle\Clock\NativeClock'
36+
3437
AppBundle\Command\UpdateMailchimpMembersCommand:
3538
autoconfigure: true
3639
autowire: true
@@ -716,10 +719,6 @@ services:
716719
PlanetePHP\FeedArticleRepository:
717720
autowire: true
718721

719-
PlanetePHP\FeedCrawler:
720-
autowire: true
721-
public: true
722-
723722
AppBundle\Github\GithubClient:
724723
arguments:
725724
$githubClient: '@http_client.github'
@@ -728,3 +727,15 @@ services:
728727
arguments:
729728
$httpClient: '@http_client.meetup'
730729
$antennesCollection: '@AppBundle\Antennes\AntennesCollection'
730+
731+
PlanetePHP\SymfonyFeedClient:
732+
arguments:
733+
$httpClient: '@http_client'
734+
735+
PlanetePHP\FeedCrawler:
736+
arguments:
737+
$clock: '@Psr\Clock\ClockInterface'
738+
$httpClient: '@PlanetePHP\SymfonyFeedClient'
739+
$feedRepository: '@PlanetePHP\FeedRepository'
740+
$feedArticleRepository: '@PlanetePHP\FeedArticleRepository'
741+
$logger: '@logger'

clevercloud/cron.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
"0 * * * * $ROOT/clevercloud/scripts/deduplicate_cron.sh /usr/bin/php $ROOT/htdocs/robots/planete/explorateur.php",
2+
"0 * * * * $ROOT/clevercloud/scripts/deduplicate_cron.sh /usr/bin/php $ROOT/bin/console --env=prod indexing:planete",
33
"0 5 * * * $ROOT/clevercloud/scripts/deduplicate_cron.sh /usr/bin/php $ROOT/bin/console --env=prod subscription:reminder",
44
"0 23 * * * $ROOT/clevercloud/scripts/deduplicate_cron.sh /usr/bin/php $ROOT/bin/console --env=prod mailchimp:update-members",
55
"0 22 * * * $ROOT/clevercloud/scripts/deduplicate_cron.sh /usr/bin/php $ROOT/bin/console --env=prod indexing:meetups --run-scraping",

composer.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"ekino/newrelic-bundle": "^2.4",
2222
"erusev/parsedown": "^1.6",
2323
"excelwebzone/recaptcha-bundle": "^1.5",
24-
"ezyang/htmlpurifier": "^4.10",
2524
"friendsofpear/pear_exception": "0.0.*",
2625
"j7mbo/twitter-api-php": "^1.0",
2726
"jms/serializer-bundle": "5.*",
2827
"knpuniversity/oauth2-client-bundle": "^1.4",
28+
"laminas/laminas-feed": "^2.18",
2929
"league/iso3166": "^4.0",
3030
"league/oauth2-github": "^0.2.1",
3131
"nojimage/twitter-text-php": "1.1.*",
@@ -34,6 +34,7 @@
3434
"phpmailer/phpmailer": "^6.9",
3535
"phpoffice/phpspreadsheet": "^1.6",
3636
"presta/sitemap-bundle": "3.3.0",
37+
"psr/clock": "^1.0",
3738
"robmorgan/phinx": "^0.14.0",
3839
"sabre/vobject": "^4.1",
3940
"setasign/fpdf": "^1.8",
@@ -99,7 +100,9 @@
99100
"autoload-dev": {
100101
"psr-4": {
101102
"Afup\\Site\\Tests\\": "tests/unit/Afup/",
102-
"AppBundle\\Tests\\": "tests/unit/AppBundle/"
103+
"Afup\\Tests\\Support\\": "tests/support/",
104+
"AppBundle\\Tests\\": "tests/unit/AppBundle/",
105+
"PlanetePHP\\IntegrationTests\\": "tests/integration/PlanetePHP/"
103106
}
104107
},
105108
"license": "MIT",

0 commit comments

Comments
 (0)