Skip to content

Commit

Permalink
Update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Abban committed Sep 25, 2020
1 parent c9ccaf7 commit be359e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- docker

install:
- travis_retry make composer install
- travis_retry make setup

script:
- make ci
Expand Down
44 changes: 20 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
# If the first argument is "composer"...
ifeq (composer, $(firstword $(MAKECMDGOALS)))
# use the rest as arguments for "composer"
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(RUN_ARGS):;@:)
endif
current_user := $(shell id -u)
current_group := $(shell id -g)
BUILD_DIR := $(PWD)
DOCKER_FLAGS := --interactive --tty
DOCKER_IMAGE := wikimediade/fundraising-frontend

.PHONY: ci test phpunit cs stan covers composer validate-composerfile
install-php:
docker run --rm $(DOCKER_FLAGS) --volume $(BUILD_DIR):/app -w /app --volume ~/.composer:/composer --user $(current_user):$(current_group) $(DOCKER_IMAGE):composer composer install $(COMPOSER_FLAGS)

ci: test cs validate-composerfile
update-php:
docker run --rm $(DOCKER_FLAGS) --volume $(BUILD_DIR):/app -w /app --volume ~/.composer:/composer --user $(current_user):$(current_group) $(DOCKER_IMAGE):composer composer update $(COMPOSER_FLAGS)

test: covers phpunit
ci: covers phpunit cs stan

cs: phpcs stan
test: covers phpunit

fix-cs:
docker-compose run --rm --no-deps app ./vendor/bin/phpcbf
covers:
docker-compose run --rm app ./vendor/bin/covers-validator

phpunit:
docker-compose run --rm app ./vendor/bin/phpunit

phpcs:
cs:
docker-compose run --rm app ./vendor/bin/phpcs

stan:
docker-compose run --rm app ./vendor/bin/phpstan analyse --level=5 --no-progress src/ tests/
fix-cs:
docker-compose run --rm app ./vendor/bin/phpcbf

covers:
docker-compose run --rm app ./vendor/bin/covers-validator
stan:
docker-compose run --rm app ./vendor/bin/phpstan analyse --level=1 --no-progress src/ tests/

validate-composerfile:
docker run --rm --interactive --tty --volume $(shell pwd):/app -w /app\
--volume ~/.composer:/composer --user $(shell id -u):$(shell id -g) wikimediade/fundraising-frontend:composer composer validate --no-interaction
setup: install-php

composer:
docker run --rm --interactive --tty --volume $(shell pwd):/app -w /app\
--volume ~/.composer:/composer --user $(shell id -u):$(shell id -g) wikimediade/fundraising-frontend:composer composer --no-scripts $(filter-out $@,$(MAKECMDGOALS))
.PHONY: install-php update-php ci test covers phpunit cs fix-cs stan setup

0 comments on commit be359e4

Please sign in to comment.