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

Commit 0a21bf6

Browse files
Merge pull request #94 from alexislefebvre/add-Makefile
Add Makefile
2 parents f5fc192 + 481d884 commit 0a21bf6

7 files changed

Lines changed: 115 additions & 41 deletions

File tree

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ jobs:
77
steps:
88
- checkout
99
- run: echo 'memory_limit = -1' | sudo tee -a /usr/local/etc/php/conf.d/docker-php-memlimit.ini
10-
- run: composer require symfony/config:^4.4 symfony/form:^4.4 symfony/framework-bundle:^4.4 symfony/templating:^4.4 symfony/security-csrf:^4.4 symfony/var-dumper:^4.4 --no-update
10+
- run: SYMFONY_VERSION="^4.4" make composer-require-symfony-version
1111
- restore_cache:
1212
keys:
1313
- composer-v1-{{ .Branch }}
1414
# fallback to using the latest cache if no exact match is found
1515
- composer-v1-
16-
- run: composer install --no-interaction --profile --no-progress
17-
- run: php ./vendor/bin/phpspec run --format=pretty
16+
- run: make composer-install
17+
- run: make phpspec
1818
- run: mkdir -p ~/phpunit
1919
- run: php ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml tests
20-
- run: php ./vendor/bin/behat --colors --strict --format=progress -vv
20+
- run: make behat
2121
- store_test_results:
2222
path: ~/phpunit
2323
- store_artifacts:

.github/workflows/tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ jobs:
3737
restore-keys: ${{ runner.os }}-composer-
3838

3939
- name: Install Composer dependencies
40-
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-progress --no-suggest
40+
run: make composer-install
4141

42-
- name: Run a multi-line script
43-
run: |
44-
php ./vendor/bin/phpspec run --format=pretty
45-
php ./vendor/bin/phpunit $PHPUNIT_FLAGS
46-
php ./vendor/bin/behat --colors --strict --format=progress -vv
42+
- name: Run tests
43+
run: make tests

.scrutinizer.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ filter:
1212
build:
1313
environment:
1414
php:
15-
version: 7.1
15+
version: 7.2
1616
dependencies:
1717
override:
1818
-
19-
command: 'composer require symfony/config:^4.4 symfony/form:^4.4 symfony/framework-bundle:^4.4 symfony/templating:^4.4 symfony/security-csrf:^4.4 symfony/var-dumper:^4.4 --no-update'
19+
command: 'SYMFONY_VERSION="^4.4" make composer-require-symfony-version'
2020
-
21-
command: 'composer install --no-interaction -vv --profile --no-progress'
21+
command: 'make composer-install'
2222
idle_timeout: 900
2323
tests:
2424
override:
2525
-
26-
command: './vendor/bin/phpspec run --format=pretty'
26+
command: 'make phpspec'
2727
-
2828
command: './vendor/bin/phpunit --coverage-clover=coverage-clover'
2929
coverage:
3030
file: 'coverage-clover'
3131
format: 'php-clover'
3232
-
33-
command: './vendor/bin/behat --colors --strict --format=progress -vv'
33+
command: 'make behat'

.travis.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,53 +26,74 @@ jobs:
2626
- stage: analysis
2727
name: "php-cs-fixer"
2828
before_install:
29-
- docker pull jakzal/phpqa:1.25-php7.2-alpine
29+
- make pull-docker-image
3030
script:
31-
- docker run --volume $PWD:/app --workdir /app jakzal/phpqa:1.25-php7.2-alpine php-cs-fixer fix src/ --dry-run
31+
- make php-cs-fixer
3232
- name: "phpstan"
3333
before_install:
34+
- make pull-docker-image
3435
- echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3536
install:
36-
- composer install --no-interaction --profile --no-progress
37+
- make composer-install
3738
script:
38-
- docker run --volume $PWD:/app --workdir /app jakzal/phpqa:1.25-php7.2-alpine phpstan analyse --level 6 src/ --no-progress
39+
- make phpstan
3940

4041
- stage: test
4142
name: "PHP 7.2 / Symfony 3.4"
4243
php: 7.2
4344
env:
44-
- SYMFONY_VERSION="3.4.*"
45+
- SYMFONY_VERSION="^3.4"
4546
before_install:
4647
- phpenv config-rm xdebug.ini
4748
- echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
4849

4950
install:
50-
- composer require symfony/config:${SYMFONY_VERSION} symfony/form:${SYMFONY_VERSION} symfony/framework-bundle:${SYMFONY_VERSION} symfony/templating:${SYMFONY_VERSION} symfony/security-csrf:${SYMFONY_VERSION} symfony/var-dumper:${SYMFONY_VERSION} --no-update
51-
- composer install --no-interaction --profile --no-progress
51+
- make composer-require-symfony-version
52+
- make composer-install
5253

5354
script:
54-
- php ./vendor/bin/phpspec run --format=pretty
55-
- php ./vendor/bin/phpunit $PHPUNIT_FLAGS
56-
- php ./vendor/bin/behat --colors --strict --format=progress -vv
55+
- make tests
56+
5757
- name: "PHP 7.3 / Symfony 4.4 / Code coverage"
5858
php: 7.3
5959
env:
60-
- SYMFONY_VERSION="4.4.*"
60+
- SYMFONY_VERSION="^4.4"
6161
# Only send code coverage to Code Climate for the current versions of PHP and Symfony LTS
6262
# https://github.com/doctrine/doctrine2/blob/3570f4a49afc7e98fed71e0596dded6a39d4fd7b/.travis.yml#L16
6363
before_install:
6464
- echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
6565
- DEPENDENCY="codeclimate/php-test-reporter:~0.3 satooshi/php-coveralls:~1.0"
6666

6767
install:
68-
- composer require symfony/config:${SYMFONY_VERSION} symfony/form:${SYMFONY_VERSION} symfony/framework-bundle:${SYMFONY_VERSION} symfony/templating:${SYMFONY_VERSION} symfony/security-csrf:${SYMFONY_VERSION} symfony/var-dumper:${SYMFONY_VERSION} $DEPENDENCY --no-update
69-
- composer install --no-interaction --profile --no-progress
68+
- make composer-require-symfony-version
69+
- make composer-install
7070

7171
script:
72-
- php ./vendor/bin/phpspec run --format=pretty
72+
- make phpspec
7373
- php ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
74-
- php ./vendor/bin/behat --colors --strict --format=progress -vv
74+
- make behat
7575

7676
after_success:
7777
- php ./vendor/bin/test-reporter
7878
- travis_retry php vendor/bin/coveralls -v --config .coveralls.yml
79+
80+
- name: "PHP 7.4 / Symfony 5.1"
81+
php: 7.4
82+
env:
83+
- SYMFONY_VERSION="^5.1"
84+
before_install:
85+
- phpenv config-rm xdebug.ini
86+
- echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
87+
88+
install:
89+
- make composer-require-symfony-version
90+
- make composer-install
91+
92+
script:
93+
- make phpspec
94+
- php ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
95+
- make behat
96+
97+
allow_failures:
98+
- php: 7.4
99+
env: SYMFONY_VERSION=^5.1

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
PHP = php
2+
3+
DOCKER_RUN = docker run --volume $(PWD):/app --workdir /app jakzal/phpqa:1.25-php7.2-alpine
4+
5+
##
6+
## Dependencies
7+
## -----
8+
##
9+
10+
composer-require-symfony-version: ## Require specific version of Symfony
11+
composer require symfony/config:$(SYMFONY_VERSION) symfony/form:$(SYMFONY_VERSION) symfony/framework-bundle:$(SYMFONY_VERSION) symfony/templating:$(SYMFONY_VERSION) symfony/security-csrf:$(SYMFONY_VERSION) symfony/var-dumper:$(SYMFONY_VERSION) --no-update
12+
13+
composer-install: ## Install Composer dependencies
14+
composer install --no-progress --prefer-dist --optimize-autoloader --no-progress --no-suggest
15+
16+
pull-docker-image: ## Pull Docker image for QA
17+
docker pull jakzal/phpqa:1.25-php7.2-alpine
18+
19+
##
20+
## Tests
21+
## -----
22+
##
23+
24+
phpspec: ## phpspec
25+
$(PHP) ./vendor/bin/phpspec run --format=pretty
26+
27+
phpunit: ## PHPUnit
28+
$(PHP) ./vendor/bin/phpunit
29+
30+
behat: ## Behat
31+
$(PHP) ./vendor/bin/behat --colors --strict --format=progress -vv
32+
33+
tests: phpspec phpunit behat ## Run all tests
34+
35+
##
36+
## QA
37+
## --
38+
##
39+
40+
php-cs-fixer: ## PHP-CS-Fixer
41+
$(DOCKER_RUN) php-cs-fixer fix src/ --dry-run
42+
43+
phpstan: ## PHPStan
44+
$(DOCKER_RUN) phpstan analyse --level 6 src/ --no-progress
45+
46+
qa: php-cs-fixer phpstan ## Run all QA tasks
47+
48+
.PHONY: php-cs-fixer phpstan
49+
50+
.DEFAULT_GOAL := help
51+
help:
52+
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
53+
.PHONY: help

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ This bundle is also used to test several CI (Continuous Integration) services.
9090
- [abraham/twitteroauth][twitteroauth] (^0.6.0)
9191
- [twitter/bootstrap][Twitter Bootstrap] (use [Bootswatch 3.3.2][Bootstrap CDN])
9292

93-
9493
### Tests:
9594

96-
php vendor/bin/phpunit
95+
make tests
96+
97+
### Quality Assurance:
98+
99+
make qa
97100

98101
[Packagist]: https://packagist.org/packages/alexislefebvre/async-tweets-bundle
99102
[Packagist Stable Image]: https://poser.pugx.org/alexislefebvre/async-tweets-bundle/v/stable.svg

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
"type" : "symfony-bundle",
44
"description" : "Symfony bundle providing a Twitter reader for asynchronous reading",
55
"keywords" : ["symfony", "twitter", "reader", "bundle"],
6-
"homepage": "https://asynctweets.alexislefebvre.com/",
6+
"homepage": "http://asynctweets.alexislefebvre.com/",
77
"license" : "MIT",
88
"authors" : [{
99
"name" : "Alexis Lefebvre",
1010
"email" : "alexislefebvre@gmail.com",
11-
"homepage": "https://alexislefebvre.com/",
11+
"homepage": "http://alexislefebvre.com/",
1212
"role": "Developer"
1313
}],
1414
"require" : {
1515
"php": ">=7.2",
1616
"ext-mbstring": "*",
17-
"symfony/config": "^3.4|^4.2",
18-
"symfony/form": "^3.4|^4.2",
19-
"symfony/framework-bundle": "^3.4|^4.2",
20-
"symfony/security-csrf": "^3.4|^4.2",
21-
"symfony/templating": "^3.4|^4.2",
22-
"symfony/twig-bundle": "^3.4|^4.2",
23-
"symfony/var-dumper": "^3.4|^4.2",
17+
"symfony/config": "^3.4|^4.4",
18+
"symfony/form": "^3.4|^4.4",
19+
"symfony/framework-bundle": "^3.4|^4.4",
20+
"symfony/security-csrf": "^3.4|^4.4",
21+
"symfony/templating": "^3.4|^4.4",
22+
"symfony/twig-bundle": "^3.4|^4.4",
23+
"symfony/var-dumper": "^3.4|^4.4",
2424
"doctrine/orm": "^2.4.8",
2525
"abraham/twitteroauth": "~0.6"
2626
},

0 commit comments

Comments
 (0)