diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..4ad8159 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: tests + +on: + push: + pull_request: + schedule: + # @todo Refactor workflow execution and introduce a generic workflow dispatching + # scheduled workflow, so nighlies can be ensured over branches (for the future). + - cron: "15 6 * * *" + +jobs: + lint: + name: Linting + runs-on: ubuntu-latest + strategy: + matrix: + php: + - '7.4' + - '8.0' + - '8.1' + - '8.2' + - '8.3' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Lint PHP + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint + + code-quality: + name: Code quality + runs-on: ubuntu-latest + strategy: + matrix: + php: + - '7.4' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install testing system + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerUpdate + + - name: Composer validate + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerValidate + + - name: Composer normalize + run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerNormalize -n + + - name: CGL + run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s cgl + + - name: phpstan + run: Build/Scripts/runTests.sh -n -p ${{ matrix.php }} -s phpstan \ No newline at end of file diff --git a/.gitignore b/.gitignore index fce285b..fe14d21 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /Documentation-GENERATED-temp/ /.Build/ /composer.lock +/composer.json.testing diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index c807b41..5df15a1 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -202,9 +202,12 @@ Options: - 15 maintained until 2027-11-11 - 16 maintained until 2028-11-09 - -p <8.2|8.3> + -p <7.4|8.0|8.1|8.2|8.3> Specifies the PHP minor version to be used - - 8.2: (default) use PHP 8.2 + - 7.4: (default) use PHP 7.4 + - 8.0: use PHP 8.0 + - 8.1: use PHP 8.1 + - 8.2: use PHP 8.2 - 8.3: use PHP 8.3 -x @@ -253,7 +256,7 @@ TEST_SUITE="cgl" DATABASE_DRIVER="" DBMS="sqlite" DBMS_VERSION="" -PHP_VERSION="8.2" +PHP_VERSION="7.4" PHP_XDEBUG_ON=0 PHP_XDEBUG_PORT=9003 CGLCHECK_DRY_RUN=0 @@ -290,7 +293,7 @@ while getopts "a:b:d:i:s:p:xy:nhu" OPT; do ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(7.4|8.0|8.1|8.2|8.3)$ ]]; then INVALID_OPTIONS+=("p ${OPTARG}") fi ;; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 011dc35..26a8911 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,6 +10,32 @@ You can render the documentation locally by calling: The result is displayed in folder Documentation-GENERATED-temp +## Run tests and apply coding guidelines + +Install the requirements: + +``` + make install +``` + +Apply automatic coding guideline fixes: + +``` + make fix-cgl +``` + +Run tests: + +``` + make test +``` + +If you have not `make` installed or which for finer control, you can run the tests directly: + +``` + Build/Scripts/runTests.sh -s h +``` + # General TYPO3 Support If you have some general TYPO3 support questions or need help with TYPO3, please see https://typo3.org/help. diff --git a/Makefile b/Makefile index 94a37d8..ded0fa6 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,19 @@ test-docs: ## Test the documentation rendering docker run --rm --pull always -v "$(shell pwd)":/project -t ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log -.PHONY: rector -rector: ## Run rector - Build/Scripts/runTests.sh -s rector +.PHONY: install +install: ## Run rector + Build/Scripts/runTests.sh -s composerUpdate -.PHONY: fix-cs -fix-cs: ## Fix PHP coding styles +.PHONY: fix-cgl +fix-cgl: ## Fix PHP coding styles + Build/Scripts/runTests.sh -s cgl + +.PHONY: fix +fix: fix-cgl## Run all fixes + +.PHONY: test-cgl +test-cgl: ## Fix PHP coding styles Build/Scripts/runTests.sh -s cgl .PHONY: phpstan @@ -31,3 +38,5 @@ phpstan: ## Run phpstan tests phpstan-baseline: ## Update the phpstan baseline Build/Scripts/runTests.sh -s phpstanBaseline +.PHONY: test +test: test-cgl phpstan test-docs## Run all tests