Skip to content

Commit

Permalink
[TASK] Add automatic test runs and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
linawolf committed May 30, 2024
1 parent 1088044 commit a7d575e
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 9 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/Documentation-GENERATED-temp/
/.Build/
/composer.lock
/composer.json.testing
11 changes: 7 additions & 4 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
;;
Expand Down
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit a7d575e

Please sign in to comment.