From 9a4d24719986d69c72f263b9a8203790e48b6c1c Mon Sep 17 00:00:00 2001 From: Petr Kessler Date: Sun, 12 Feb 2023 09:46:00 +0100 Subject: [PATCH] WIP --- .github/workflows/ci.yml | 7 +++--- Makefile | 24 +++++++++++++++++++ composer.json | 8 ------- tests/{FractionTest.php => FractionTest.phpt} | 0 tests/{HelpersTest.php => HelpersTest.phpt} | 0 tests/{SolverTest.php => SolverTest.phpt} | 0 tests/{TableTest.php => TableTest.phpt} | 0 tests/{TaskTest.php => TaskTest.phpt} | 0 8 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 Makefile rename tests/{FractionTest.php => FractionTest.phpt} (100%) rename tests/{HelpersTest.php => HelpersTest.phpt} (100%) rename tests/{SolverTest.php => SolverTest.phpt} (100%) rename tests/{TableTest.php => TableTest.phpt} (100%) rename tests/{TaskTest.php => TaskTest.phpt} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 075f852..f13070e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: "CI suite" +name: "Tests" on: [push, pull_request] @@ -19,7 +19,8 @@ jobs: with: php-version: ${{ matrix.php }} extensions: bcmath + ini-values: bcmath.scale=0 coverage: none - - run: composer install - - run: composer ci + - run: make install + - run: make ci diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..71ffd29 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +.DEFAULT_GOAL := help + +help: + @printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n" + @grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}' + +.PHONY: install +install: vendor ## Installs all project dependencies + +vendor: composer.json $(wildcard composer.lock) + @composer install + +.PHONY: ci +ci: phplint tester ## Runs complete CI suite + +.PHONY: phplint +phplint: + @php vendor/bin/parallel-lint Simplex/ tests/ example.php --colors + +.PHONY: tester +tester: + @cat /usr/local/php/5.3/etc/conf.d/20-bcmath.ini + @php vendor/bin/tester tests -C --colors \ + || php vendor/bin/tester tests/ -p php -c $(shell php -r 'echo php_ini_loaded_file();') --colors diff --git a/composer.json b/composer.json index 9ff6fc8..c7b3b45 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,5 @@ }, "autoload": { "classmap": ["Simplex/"] - }, - "scripts": { - "ci": [ - "@phplint", - "@tester" - ], - "phplint": "parallel-lint Simplex/ tests/ example.php --colors", - "tester": "tester tests/ --colors" } } diff --git a/tests/FractionTest.php b/tests/FractionTest.phpt similarity index 100% rename from tests/FractionTest.php rename to tests/FractionTest.phpt diff --git a/tests/HelpersTest.php b/tests/HelpersTest.phpt similarity index 100% rename from tests/HelpersTest.php rename to tests/HelpersTest.phpt diff --git a/tests/SolverTest.php b/tests/SolverTest.phpt similarity index 100% rename from tests/SolverTest.php rename to tests/SolverTest.phpt diff --git a/tests/TableTest.php b/tests/TableTest.phpt similarity index 100% rename from tests/TableTest.php rename to tests/TableTest.phpt diff --git a/tests/TaskTest.php b/tests/TaskTest.phpt similarity index 100% rename from tests/TaskTest.php rename to tests/TaskTest.phpt