Merge pull request #3398 from wallabag/issue-1735

Replace ant with Makefile
This commit is contained in:
Nicolas Lœuillet 2017-11-21 15:12:48 +01:00 committed by GitHub
commit d3d0defabc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 146 deletions

View file

@ -70,7 +70,7 @@ before_install:
script: script:
- travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist
- ant prepare-$DB - make prepare DB=$DB
- echo "travis_fold:start:migrations" - echo "travis_fold:start:migrations"
- php bin/console doctrine:migrations:migrate --no-interaction --env=test - php bin/console doctrine:migrations:migrate --no-interaction --env=test

View file

@ -1,15 +1,13 @@
TMP_FOLDER=/tmp TMP_FOLDER=/tmp
RELEASE_FOLDER=wllbg-release RELEASE_FOLDER=wllbg-release
ifndef ENV ENV ?= prod
ENV=prod
endif
help: ## Display this help menu help: ## Display this help menu
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clean: ## Clear the application cache clean: ## Clear the application cache
@rm -rf var/cache/* rm -rf var/cache/*
install: ## Install wallabag with the latest version install: ## Install wallabag with the latest version
@sh scripts/install.sh $(ENV) @sh scripts/install.sh $(ENV)
@ -26,8 +24,30 @@ run: ## Run the wallabag built-in server
build: ## Run webpack build: ## Run webpack
@npm run build:$(ENV) @npm run build:$(ENV)
test: ## Launch wallabag testsuite prepare: clean ## Prepare database for testsuite
@ant prepare && bin/simple-phpunit -v ifdef DB
cp app/config/tests/parameters_test.$(DB).yml app/config/parameters_test.yml
endif
-php bin/console doctrine:database:drop --force --env=test
php bin/console doctrine:database:create --env=test
ifndef DB ## make test does not define DB
php bin/console doctrine:schema:create --env=test
endif
ifeq ($(DB), sqlite)
php bin/console doctrine:schema:create --env=test
endif
ifeq ($(DB), mysql)
php bin/console doctrine:database:import data/sql/mysql_base.sql --env=test
endif
ifeq ($(DB), pgsql)
psql -h localhost -d wallabag_test -U travis -f data/sql/pgsql_base.sql
endif
fixtures: ## Load fixtures into database
php bin/console doctrine:fixtures:load --no-interaction --env=test
test: prepare fixtures ## Launch wallabag testsuite
bin/simple-phpunit -v
release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`). release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`).
ifndef VERSION ifndef VERSION
@ -35,11 +55,9 @@ ifndef VERSION
endif endif
@sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV) @sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV)
travis: ## Make some stuff for Travis-CI
deploy: ## Deploy wallabag deploy: ## Deploy wallabag
@bundle exec cap staging deploy @bundle exec cap staging deploy
.PHONY: help clean install update build test release travis deploy run dev .PHONY: help clean prepare install fixtures update build test release deploy run dev
.DEFAULT_GOAL := install .DEFAULT_GOAL := install

136
build.xml
View file

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="wallabag" default="build">
<target name="build" depends="clean,prepare,phpunit"/>
<target name="prepare-mysql" depends="clean,prepare_mysql"/>
<target name="prepare-sqlite" depends="clean,prepare_sqlite"/>
<target name="prepare-pgsql" depends="clean,prepare_pgsql"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/var/cache"/>
</target>
<target name="prepare" description="Prepare for build">
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:drop"/>
<arg value="--force"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:create"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:schema:create"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:fixtures:load"/>
<arg value="--no-interaction"/>
<arg value="--env=test"/>
</exec>
</target>
<target name="prepare_mysql" description="Run test for MySQL">
<delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/>
<arg value="${basedir}/app/config/parameters_test.yml"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="cache:clear"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:drop"/>
<arg value="--force"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:create"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:import"/>
<arg value="data/sql/mysql_base.sql"/>
<arg value="--env=test"/>
</exec>
</target>
<target name="prepare_sqlite" description="Run test for SQLite">
<delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/>
<arg value="${basedir}/app/config/parameters_test.yml"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="cache:clear"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:drop"/>
<arg value="--force"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:create"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:schema:create"/>
<arg value="--env=test"/>
</exec>
</target>
<target name="prepare_pgsql" description="Run test for PostgreSQL">
<delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/>
<arg value="${basedir}/app/config/parameters_test.yml"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="cache:clear"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:drop"/>
<arg value="--force"/>
<arg value="--env=test"/>
</exec>
<exec executable="php">
<arg value="${basedir}/bin/console"/>
<arg value="doctrine:database:create"/>
<arg value="--env=test"/>
</exec>
<exec executable="psql">
<arg value="-h"/>
<arg value="localhost"/>
<arg value="-d"/>
<arg value="wallabag_test"/>
<arg value="-U"/>
<arg value="travis"/>
<arg value="-f"/>
<arg value="data/sql/pgsql_base.sql"/>
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage">
<exec executable="phpunit" failonerror="true">
<arg value="--coverage-html"/>
<arg value="build/coverage"/>
</exec>
</target>
</project>