diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-11-21 15:12:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-21 15:12:48 +0100 |
commit | d3d0defabc8224172b59c85db66c2d4e6bc3f06b (patch) | |
tree | a69dcb337eac10969ea5ace6f950a920faf2a142 | |
parent | 95b7d92ea5f92078c2e1fed0b346a9722de762c4 (diff) | |
parent | 8bde7de1ee4b6944e3f3d3024ed619ac5980be27 (diff) | |
download | wallabag-d3d0defabc8224172b59c85db66c2d4e6bc3f06b.tar.gz wallabag-d3d0defabc8224172b59c85db66c2d4e6bc3f06b.tar.zst wallabag-d3d0defabc8224172b59c85db66c2d4e6bc3f06b.zip |
Merge pull request #3398 from wallabag/issue-1735
Replace ant with Makefile
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | Makefile | 36 | ||||
-rw-r--r-- | build.xml | 136 |
3 files changed, 28 insertions, 146 deletions
diff --git a/.travis.yml b/.travis.yml index 6b279ed6..42fbb966 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -70,7 +70,7 @@ before_install: | |||
70 | 70 | ||
71 | script: | 71 | script: |
72 | - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist | 72 | - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist |
73 | - ant prepare-$DB | 73 | - make prepare DB=$DB |
74 | 74 | ||
75 | - echo "travis_fold:start:migrations" | 75 | - echo "travis_fold:start:migrations" |
76 | - php bin/console doctrine:migrations:migrate --no-interaction --env=test | 76 | - php bin/console doctrine:migrations:migrate --no-interaction --env=test |
@@ -1,15 +1,13 @@ | |||
1 | TMP_FOLDER=/tmp | 1 | TMP_FOLDER=/tmp |
2 | RELEASE_FOLDER=wllbg-release | 2 | RELEASE_FOLDER=wllbg-release |
3 | 3 | ||
4 | ifndef ENV | 4 | ENV ?= prod |
5 | ENV=prod | ||
6 | endif | ||
7 | 5 | ||
8 | help: ## Display this help menu | 6 | help: ## Display this help menu |
9 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | 7 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
10 | 8 | ||
11 | clean: ## Clear the application cache | 9 | clean: ## Clear the application cache |
12 | @rm -rf var/cache/* | 10 | rm -rf var/cache/* |
13 | 11 | ||
14 | install: ## Install wallabag with the latest version | 12 | install: ## Install wallabag with the latest version |
15 | @sh scripts/install.sh $(ENV) | 13 | @sh scripts/install.sh $(ENV) |
@@ -26,8 +24,30 @@ run: ## Run the wallabag built-in server | |||
26 | build: ## Run webpack | 24 | build: ## Run webpack |
27 | @npm run build:$(ENV) | 25 | @npm run build:$(ENV) |
28 | 26 | ||
29 | test: ## Launch wallabag testsuite | 27 | prepare: clean ## Prepare database for testsuite |
30 | @ant prepare && bin/simple-phpunit -v | 28 | ifdef DB |
29 | cp app/config/tests/parameters_test.$(DB).yml app/config/parameters_test.yml | ||
30 | endif | ||
31 | -php bin/console doctrine:database:drop --force --env=test | ||
32 | php bin/console doctrine:database:create --env=test | ||
33 | ifndef DB ## make test does not define DB | ||
34 | php bin/console doctrine:schema:create --env=test | ||
35 | endif | ||
36 | ifeq ($(DB), sqlite) | ||
37 | php bin/console doctrine:schema:create --env=test | ||
38 | endif | ||
39 | ifeq ($(DB), mysql) | ||
40 | php bin/console doctrine:database:import data/sql/mysql_base.sql --env=test | ||
41 | endif | ||
42 | ifeq ($(DB), pgsql) | ||
43 | psql -h localhost -d wallabag_test -U travis -f data/sql/pgsql_base.sql | ||
44 | endif | ||
45 | |||
46 | fixtures: ## Load fixtures into database | ||
47 | php bin/console doctrine:fixtures:load --no-interaction --env=test | ||
48 | |||
49 | test: prepare fixtures ## Launch wallabag testsuite | ||
50 | bin/simple-phpunit -v | ||
31 | 51 | ||
32 | release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`). | 52 | release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`). |
33 | ifndef VERSION | 53 | ifndef VERSION |
@@ -35,11 +55,9 @@ ifndef VERSION | |||
35 | endif | 55 | endif |
36 | @sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV) | 56 | @sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV) |
37 | 57 | ||
38 | travis: ## Make some stuff for Travis-CI | ||
39 | |||
40 | deploy: ## Deploy wallabag | 58 | deploy: ## Deploy wallabag |
41 | @bundle exec cap staging deploy | 59 | @bundle exec cap staging deploy |
42 | 60 | ||
43 | .PHONY: help clean install update build test release travis deploy run dev | 61 | .PHONY: help clean prepare install fixtures update build test release deploy run dev |
44 | 62 | ||
45 | .DEFAULT_GOAL := install | 63 | .DEFAULT_GOAL := install |
diff --git a/build.xml b/build.xml deleted file mode 100644 index b9fe6136..00000000 --- a/build.xml +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <project name="wallabag" default="build"> | ||
3 | <target name="build" depends="clean,prepare,phpunit"/> | ||
4 | <target name="prepare-mysql" depends="clean,prepare_mysql"/> | ||
5 | <target name="prepare-sqlite" depends="clean,prepare_sqlite"/> | ||
6 | <target name="prepare-pgsql" depends="clean,prepare_pgsql"/> | ||
7 | |||
8 | <target name="clean" description="Cleanup build artifacts"> | ||
9 | <delete dir="${basedir}/var/cache"/> | ||
10 | </target> | ||
11 | |||
12 | <target name="prepare" description="Prepare for build"> | ||
13 | <exec executable="php"> | ||
14 | <arg value="${basedir}/bin/console"/> | ||
15 | <arg value="doctrine:database:drop"/> | ||
16 | <arg value="--force"/> | ||
17 | <arg value="--env=test"/> | ||
18 | </exec> | ||
19 | <exec executable="php"> | ||
20 | <arg value="${basedir}/bin/console"/> | ||
21 | <arg value="doctrine:database:create"/> | ||
22 | <arg value="--env=test"/> | ||
23 | </exec> | ||
24 | <exec executable="php"> | ||
25 | <arg value="${basedir}/bin/console"/> | ||
26 | <arg value="doctrine:schema:create"/> | ||
27 | <arg value="--env=test"/> | ||
28 | </exec> | ||
29 | <exec executable="php"> | ||
30 | <arg value="${basedir}/bin/console"/> | ||
31 | <arg value="doctrine:fixtures:load"/> | ||
32 | <arg value="--no-interaction"/> | ||
33 | <arg value="--env=test"/> | ||
34 | </exec> | ||
35 | </target> | ||
36 | |||
37 | <target name="prepare_mysql" description="Run test for MySQL"> | ||
38 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
39 | <exec executable="cp"> | ||
40 | <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/> | ||
41 | <arg value="${basedir}/app/config/parameters_test.yml"/> | ||
42 | </exec> | ||
43 | <exec executable="php"> | ||
44 | <arg value="${basedir}/bin/console"/> | ||
45 | <arg value="cache:clear"/> | ||
46 | <arg value="--env=test"/> | ||
47 | </exec> | ||
48 | <exec executable="php"> | ||
49 | <arg value="${basedir}/bin/console"/> | ||
50 | <arg value="doctrine:database:drop"/> | ||
51 | <arg value="--force"/> | ||
52 | <arg value="--env=test"/> | ||
53 | </exec> | ||
54 | <exec executable="php"> | ||
55 | <arg value="${basedir}/bin/console"/> | ||
56 | <arg value="doctrine:database:create"/> | ||
57 | <arg value="--env=test"/> | ||
58 | </exec> | ||
59 | <exec executable="php"> | ||
60 | <arg value="${basedir}/bin/console"/> | ||
61 | <arg value="doctrine:database:import"/> | ||
62 | <arg value="data/sql/mysql_base.sql"/> | ||
63 | <arg value="--env=test"/> | ||
64 | </exec> | ||
65 | </target> | ||
66 | |||
67 | <target name="prepare_sqlite" description="Run test for SQLite"> | ||
68 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
69 | <exec executable="cp"> | ||
70 | <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/> | ||
71 | <arg value="${basedir}/app/config/parameters_test.yml"/> | ||
72 | </exec> | ||
73 | <exec executable="php"> | ||
74 | <arg value="${basedir}/bin/console"/> | ||
75 | <arg value="cache:clear"/> | ||
76 | <arg value="--env=test"/> | ||
77 | </exec> | ||
78 | <exec executable="php"> | ||
79 | <arg value="${basedir}/bin/console"/> | ||
80 | <arg value="doctrine:database:drop"/> | ||
81 | <arg value="--force"/> | ||
82 | <arg value="--env=test"/> | ||
83 | </exec> | ||
84 | <exec executable="php"> | ||
85 | <arg value="${basedir}/bin/console"/> | ||
86 | <arg value="doctrine:database:create"/> | ||
87 | <arg value="--env=test"/> | ||
88 | </exec> | ||
89 | <exec executable="php"> | ||
90 | <arg value="${basedir}/bin/console"/> | ||
91 | <arg value="doctrine:schema:create"/> | ||
92 | <arg value="--env=test"/> | ||
93 | </exec> | ||
94 | </target> | ||
95 | |||
96 | <target name="prepare_pgsql" description="Run test for PostgreSQL"> | ||
97 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
98 | <exec executable="cp"> | ||
99 | <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/> | ||
100 | <arg value="${basedir}/app/config/parameters_test.yml"/> | ||
101 | </exec> | ||
102 | <exec executable="php"> | ||
103 | <arg value="${basedir}/bin/console"/> | ||
104 | <arg value="cache:clear"/> | ||
105 | <arg value="--env=test"/> | ||
106 | </exec> | ||
107 | <exec executable="php"> | ||
108 | <arg value="${basedir}/bin/console"/> | ||
109 | <arg value="doctrine:database:drop"/> | ||
110 | <arg value="--force"/> | ||
111 | <arg value="--env=test"/> | ||
112 | </exec> | ||
113 | <exec executable="php"> | ||
114 | <arg value="${basedir}/bin/console"/> | ||
115 | <arg value="doctrine:database:create"/> | ||
116 | <arg value="--env=test"/> | ||
117 | </exec> | ||
118 | <exec executable="psql"> | ||
119 | <arg value="-h"/> | ||
120 | <arg value="localhost"/> | ||
121 | <arg value="-d"/> | ||
122 | <arg value="wallabag_test"/> | ||
123 | <arg value="-U"/> | ||
124 | <arg value="travis"/> | ||
125 | <arg value="-f"/> | ||
126 | <arg value="data/sql/pgsql_base.sql"/> | ||
127 | </exec> | ||
128 | </target> | ||
129 | |||
130 | <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> | ||
131 | <exec executable="phpunit" failonerror="true"> | ||
132 | <arg value="--coverage-html"/> | ||
133 | <arg value="build/coverage"/> | ||
134 | </exec> | ||
135 | </target> | ||
136 | </project> | ||