mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-12-04 20:16:13 +01:00
Commit graph

50 commits

Author SHA1 Message Date
Łukasz Uznański
ac8c1248ea
[TASK] Move php sniff to Build dir (#1357)
Part of #1186
2024-09-17 11:41:40 +02:00
Oliver Klee
a14fd767d2
[TASK] Add missing commands to the runTest.sh documentation (#1423) 2024-08-01 19:59:09 +02:00
508c6b94cc
[TASK] Remove undocumented composerInstall (#1416)
The project doesn't have a `composer.lock`. That's why one should use
`composer update` instead of `composer lock`.
This can be done by using the existing `-s composer` and appending
`update.
Furthermore, the command itself was not documented or used anyway.

Relates: #1412
2024-08-01 19:44:01 +02:00
Oliver Klee
9c608ffc40
[TASK] Polish the runTests.sh help (#1422)
- sort some lists
- use the proper capitalization for PHPStan
2024-08-01 19:38:34 +02:00
Felix Althaus
adc864f257
[FEATURE] Update node to version 22 (#1420)
Fixes: #1403
2024-08-01 13:31:59 +00:00
bb9773b959
[TASK] Rename composerInstall* scripts (#1417)
`composer install` does not make sense as we do not have a
`composer.lock`. One should use `composer update` instead.
This is reflected by updating the script names.

Relates: #1412
2024-07-31 18:43:31 +02:00
Eike Starkmann
497dde4179
[BUGFIX] Clean up network after invalid command (#1411)
Fixes #1312
2024-07-31 18:32:25 +02:00
Eike Starkmann
b3d0a4b7b7
[FEATURE] Add support for PHP 8.4 in runTests.sh (#1413)
Fixes #1363
2024-07-31 18:19:30 +02:00
Felix Althaus
99a2b7f176
[FEATURE] Add shellcheck to Github pipeline (#1400)
Fixes #1398
2024-07-31 18:04:23 +02:00
Felix Althaus
0dc3e82829
[TASK] Split COMMAND variable to be type strict (#1415)
Fixes #1418
2024-07-31 14:28:56 +02:00
Eike Starkmann
6c8f0176c2
[FEATURE] Add PHP mess detector (#1391)
Resolves: #128
2024-07-31 12:54:03 +02:00
Felix Althaus
948505011c
[TASK] Tackle shellcheck issues (#1408)
Fixes #1398
2024-07-31 12:22:57 +02:00
2aec0534d0
[BUGFIX] Remove none existing cglFix (#1407)
The script actually does not exist.
Instead `cgl` will fix and adding `-n` will turn into try mode and only
check.
2024-07-30 21:16:21 +02:00
Felix Althaus
b3cf57bfab
[FEATURE] Allow running npm based quality checks via runTests.sh (#1396)
Fixes #972
2024-07-30 21:15:00 +02:00
Eike Starkmann
48dfc14a15
[BUGFIX] Remove debug echo (#1401)
Related: #1399
2024-07-30 16:55:58 +00:00
Eike Starkmann
1571ef0cff
[BUGFIX] No longer create not needed temp folder (#1394)
Resolves: #1222
2024-07-30 14:06:23 +02:00
Felix Althaus
0dce81e9ca
[FEATURE] Add composerUnused suite to runTests.sh (#1390) 2024-07-30 13:45:06 +02:00
Oliver Klee
8d80a25d43
[BUGFIX] Remove unavailable PHPUnit configuration option (#1395)
The PHPUnit configuration option `controlGarbageCollector` was
introduced for PHPUnit 10 and 11 only and hence is not available
for version 9 yet (the version we're using). So we cannot use
this configuration option yet.

This reverts commit 7dea2ddc0b.
2024-07-30 13:35:15 +02:00
1a33abac95
[TASK] Clean up the unit tests configuration (#1389)
Remove no longer needed bootstrap option.
Remove no longer needed backupGlobals options.

Resolves: #1347
2024-07-29 17:53:04 +00:00
5a25569a19
[TASK] Use typoscript instead of ts within script names (#1392)
As ts is usually understood as TypeScript instead of TypoScript.
TYPO3 itself also changed its file extension from `.ts` to `.typoscript`.
We reflect that by adopting the script name.

Resolves: #1385
2024-07-29 19:49:37 +02:00
3dca33ebec
[TASK] Allow additional composer options for -s composerInstall (#1380)
This change modifies the `Build/Script/runTests.sh`
command dispatcher to allow passing composer options
to the `composer install` subcommand, for example

  Build/Scripts/runTests.sh -s composerInstall \
    -- --prefer-source

Note that this is already possible using the generic
`-s composer` dispatcher but would resolve some user
confusion.

This aligns our implementation of runTests.sh with TYPO3 core,
see: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84870

Resolves: #1346
2024-07-29 19:44:01 +02:00
7dea2ddc0b
[TASK] Enable PHPUnit garbage collector control (#1384)
This is disabled by default and enabled with this change.
This has the following effect:

- Deactivate automatic garbage collection using gc_disable() before the
  first test is run
- Trigger garbage collection using gc_collect_cycles() before the first
  test is run
- Trigger garbage collection using gc_collect_cycles() after each n-th
  test
- Trigger garbage collection after using gc_collect_cycles() after the
  last test was run
- Activate automatic garbage collection using gc_enable() after the last
  test was run

Resolves: #1328
2024-07-29 19:02:50 +02:00
Eike Starkmann
e87c7403a6
[BUGFIX] Use correct path for functional and unit tests (#1375) 2024-07-29 16:55:44 +02:00
Łukasz Uznański
395281c299
[TASK] Move xliff linter to xliff dir (#1356)
Part of: #1186
2024-07-08 09:40:01 +02:00
Łukasz Uznański
b0f0450fe1
[TASK] Move tests configuration to Build directory (#1352)
Part of: #1186
2024-07-03 09:01:21 +02:00
Łukasz Uznański
662f6dd77a
[TASK] Rename the xliff script (#1296)
Resolves: #1261

Co-authored-by: Łukasz Uznański <l.uznanski@macopedia.com>
2024-05-07 16:27:40 +02:00
Stefan Bürk
7bff3fc341
[BUGFIX] Enhance container documentation rendering (#1294)
The new php based rendering container has been added
recently to render the documentation. The image come
with a internal uid/gid switch to mitigate permission
issues with docker due to a missimplementation, which
podman not suffers by proper using the kernal namespacing.

This change ensures to create a folder before hand with
the correct permissions to mitigate this for docker. On
top of that, the external user set is added for the direct
invokiation and also the interactive switch to avoid failure
in CI context usages.

To avoid permission issues with previously created folder,
a `chown` command is added to ensure correct permission on
that folder.

Resolves: #1283
2024-05-07 13:49:22 +00:00
Stefan Bürk
76293755df
[TASK] Use TYPO3 core-testing images directly (#1293)
Extended core-testing image has been used to
support extended `find` options not provided
by the busybox implementation.

After streamlining used `find` command usages
towards a stripped down version with #1209 it
is now possible to use the TYPO3 core-testing
images directly.

This change modifes `Build/Scripts/runTests.sh`
to use `typo3/core-testing-*` images now.

Resolves: #1275
Related: #1209
2024-05-07 15:24:46 +02:00
Oliver Klee
38b50bdf06
[TASK] Use PHP 8.3 by default in runTests.sh (#1287)
Let's use the most performant available PHP version for
local development.
2024-05-07 14:32:03 +02:00
Stefan Bürk
b3cfc9c7d0
[BUGFIX] Ensure correct service waits and container cleanup (#1285)
This change now uses a bash trap to ensure proper container
cleanup after some signals happend. The internal `waitFor()`
is modified to emit a signal to cleanup containers if the
waiting process does not process correctly and stop the
script execution.

Additionally, `--pull-never` as CI_PARAMS is no longer derived
from the `$CI` variable and must now be handed over from the
calling process.

Further, the max retry value in `waitFor()` is increased to 20
to mitigate the slowed down startup of MySQL 8.0 container.

Resolves: #1280
2024-05-07 13:08:57 +02:00
Stefan Bürk
823d4c406d
[BUGFIX] Display static driver info for sqlite and postgres (#1281)
In the PHP world there are only one driver for SQLite and
Postgres available. `runTests.sh` disallows to specify a
driver for SQLite or Postgres and therefore setting the
variable would make that check more complex.

This change modifies the driver information for SQLite and
Postgres to use hardcoded driver output to keep the cross
check for specifing a driver for these database vendors.

Resolves: #1278
2024-05-07 12:31:15 +02:00
Chris Müller
9b4c0a8f50
[TASK] Switch the documentation to PHP-based rendering (#1190)
Command for rendering:

    ./Build/Scripts/runTests.sh -s docsGenerate

or just:

    composer docs:generate

The reference to the TYPO3 Documentation Rendering Guide was adjusted as the Quickstart page does not exist anymore.

Additionally, the genindex isn't supported anymore. It is planned to consider the `index` directive in the global search on docs.typo3.org.

Resolves: #1189
2024-05-07 12:18:26 +02:00
Stefan Bürk
6bad0fbac7
[TASK] Streamline container binary chain (#1279)
First iteration of the `Build/Scripts/runTests.sh` supporting
`docker` and `podman` introduced a switch for direct usage in
local environments while keeping `docker` as strong default.

This change removes the hardcoded default for local and ci runs
and introduces a detection of available binaries, prefering the
`podman` over `docker` if both are installed on the host and no
specific binary selected using `-b <container-bin>`.

If no specific binary is provided, the detection chain is now:

* podman
* docker

Default binary variables are removed due to beeing obsolete now.

Resolves: #1148
2024-05-07 12:13:20 +02:00
Stefan Bürk
1a0a288a8b
[BUGFIX] Display dbms version for functional test execution (#1276)
The `Build/Scripts/runTests.sh` has been streamlined recently
towards the `docker-compose less` approach of the TYPO3 core.
That means, that the `runTest.sh` has been heavily modified,
and multiple changes in the core variant has been implemented.

One of these changes included streamlining the Database Version
handling for the different vendors and combining multiple options
into the `-i` option and using a generic version variable instead
of vendor specific ones. Sadly, it has been missed to align the
version output on the end to the generic variable name.

This change modifies the dbms version output at the end of the
functional test execution to use the correct generic version
variable and thus fixing the missing version information in the
output. The switch has been simplified in the same step.

Resolves: #1272
2024-05-07 11:46:46 +02:00
Stefan Bürk
760d009dad
[TASK] Add support for Postgres 16 to runTests.sh (#1271)
This change adds support for Postres 16 to the
`Build/Scripts/runTests.sh` execution wrapper.

[1] https://review.typo3.org/c/Packages/TYPO3.CMS/+/82761

Resolves: #1147
Related: #94
2024-05-07 09:23:48 +00:00
Łukasz Uznański
33a7a0425e
[TASK] Change webdir of TYPO3 to public (#1144)
Resolves: #1140
2024-01-31 10:14:57 +01:00
Oliver Klee
9df4171031
[BUGFIX] Use our own PHPUnit configuration files in runTests.sh (#1134)
Fixes #1129
2024-01-23 21:49:07 +01:00
Oliver Klee
e773ca9dca
[TASK] Make TYPO3 12LTS the default in runTests.sh (#1103)
Fixes #1102
2024-01-03 19:06:06 +01:00
Stefan Bürk
16aee3c836
[BUGFIX] Ensure removing dangling images works with podman (#1090)
The TYPO3 core `runTests.sh` contains the `-u` option to
update the images and remove dangling images. Providing
an image name and a `--filter` option is not supported
by podmand and has not been discovered yet in the TYPO3
core implementation yet - and adopted with the recently
sync of this repository implementation to the TYPO3 one.

Both supported docker binaries `docker` and `podman`
supportes filtering images using the `reference` filter
option. Therefore, this change modifies the dangling
image remove command to use double filter options.

To verify that double filtering can be used, following
command can be executed if already some images have
been downloaded:

```shell
podman images \
	--filter "reference=ghcr.io/sbuerk/demo-core-testing-*"
	--filter "dangling=false" --format "{{.ID}}"

docker images \
        --filter "reference=ghcr.io/sbuerk/demo-core-testing-*"
        --filter "dangling=false" --format "{{.ID}}"
```

**Note:**	`dangling=false` is used here instead of
		`dangling=true` like in `runTests.sh`

Resolves: #1088
2023-12-19 10:44:53 +01:00
Stefan Bürk
7f8f379fea
[BUGFIX] Avoid unsupported option for podman (#1089)
The TYPO3 core runTests.sh has been using the
uid option for the tmpfs mount in the past
and removed it due to the fact it's not supported
by the podman container binary.

This has been missed to change along with the
introduction of the `-b` container binary option
in #1075 and therefore the podmand and docker dual
support.

For example, following

```shell
--tmpfs ${ROOT_DIR}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,uid=${HOST_UID}
```

is changed to

```shell
--tmpfs ${ROOT_DIR}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid
```

which works for both binaries in case of tmpfs mounts.

Resolves: #1087
Resolves: #1083
Related: #1075
2023-12-19 10:37:17 +01:00
Stefan Bürk
d97d66206f
[BUGFIX] Use better supported condition checks in runTests.sh (#1086)
With 8a2e0cb the `-b` option to select the container
binary (podman or docker) has been added. During the
adoption from the TYPO3 core implementation, it has
been discoverd that the simplified checks are not
really working and changed to the better supported
version.

Sadly, it have been missed to do the at all places
correctly.

This change covers that and modifies `runTests.sh`
to use the better supported condition form for the
container binary checks introduced with 8a2e0cb.

For example, conditions like

```shell
if [ ${CONTAINER_BIN} = "" ]; then ..
```

are changed to

```shell
if [ "${CONTAINER_BIN}" == "" ]; then ..
```

Resolves: #1085
2023-12-19 10:19:07 +01:00
Stefan Bürk
f93010c332
[BUGFIX] Use extended sbuerk/demo-core-testing-* images (#1081)
The TYPO3 core testing images only adds stuffs which is
required for the core testing itself and which can be
considered as generic project and extension testing
requirement.

This extension uses advanced `find` options which are
not part of the base busybox provided tools used by
the alpine base image, for example for the `lintYaml`
command in `Build/Scripts/runTests.sh`.

The used `-regextype` option of the `find` binary does
not exists in the stripped down busybox implementation
used by the alpine base images. The `findutils` package
is required to provide the gnu `find` command supporting
this and other advanced options, which can be found as
a solution here:

https://github.com/nextcloud/docker/issues/282

Due to the fact that the additional package will not
make the way into the TYPO3 core images like other
requirements some project or extension may have, a
demonstration github repository has been created some
time ago to demonstrate automatic extended image builds
based on the core testing images. These images already
contains stuff which is required by some projects and
extensions - and the gnu `findutils` package has been
added to these images now with the feature commit

9f8b125b6a

This change switches the used php images from the
`typo3/core-testing-phpXY` images to the extended
`sbuerk/demo-core-testing-phpXY` images.

Can be tested and verified by using

```shell
./Build/Scripts/runTests.sh -s lintYaml
```

with and without this change.

Resolves: #966
2023-12-19 09:46:50 +01:00
Stefan Bürk
8a2e0cbcff
[TASK] Add -b option to select container binary (#1076)
TYPO3 core introduced the `-b` option for the
`Build/Scripts/runTests.sh` script to provide
the ability to select the container binary,
`docker` or `podman` and enforces podman for
CI (GitLab runner) runs after switching the
Core CI infrastructure from Docker-In-Docker
to Podman-In-Podman.

The `ext:tea` adoption of the `runTests.sh`
has been already adopted on a intermediate
version and dropped the `docker-compose`
based container definitions. Along with
other minor prepration patches this allows
now to add the container binary selection
also.

This change modifies `runTests.sh` to

* add the `-b` option with a corresponding
  helptext addition and allows `podman` or
  `docker` - whereas the latter is the default.

* integrates the determined and fixed issues
  with tty in CI environments by setting some
  paramater for the commands based on the CI
  detection (GitHub Action or GitLab Runner).

Note:	The implemention for `ext:tea` does not
        enforce hardcoed the `podman` binary for
        CI environments. If no user selection is
        provided, it fallbacks to `docker` for
        all environments.

It's worth to mention that the implementation to
deal properly with user namespacing and permission
handling on mountend volumns it's required to have
at least `podman 4.x` installed. Earlier versions
does not support the required handlinging and options.

Minor moving of variable declaration are done as a
drive-by change.

The `docsGenerate` suite has been guard and display
a concrete message when executed using the `podman`
binary.

Resolves: #1075
Related: #969
2023-12-18 23:41:14 +01:00
Łukasz Uznański
5f51604f14
[TASK] Add xliff linting locally (#1071)
Resolves: #346
2023-12-15 16:17:39 +01:00
Stefan Bürk
95c2801755
[TASK] Remove acceptance test traces from runTests.sh (#1069)
The adopted `Build/Scripts/runTests.sh` contains traces
of acceptance and acceptanceInstall, mainly in the help
text.

The occurances are left-overs from the adoption phase
and are now removed due to the fact they are currently
not available at all.

Resolves: #1068
Related: #969
2023-12-15 14:20:34 +01:00
Stefan Bürk
ec56abf6aa
[TASK] Use only ghcr.io for core-testing images (#1070)
TYPO3 provides core testing docker images which
the core itself uses for the Core testing. Core
stopped publishing new image builds to the docker
hub already and only publish to the GitHub container
registry in the future.

Therefore, the image prefix switch between CI and
local does not make sense anymore.

This change removes the image prefix variables and
use public images directly from docker hub and the
core testing images from the TYPO3 `ghcr.io` repo.

Resolves: #1066
Related: #969
2023-12-15 14:13:46 +01:00
Stefan Bürk
2619a344a8
[TASK] Merge dbms version flags into -i (#1065)
Until now three different dbmns version options
has been used like the TYPO3 core in older days.

This change aligns with the TYPO3 core and merge
these options together into one flag, keeping
`-i` for all dbms vendors now and dropping `-k`
for postgres and `-j` for mysql specific versions.

The help text is modified to align with the changed
options.

Resolves: #1062
Related: #969
2023-12-15 13:33:22 +01:00
Stefan Bürk
ba486fcee3
[BUGFIX] Remove invalid argment quuoting in runTests.sh (#1029)
`Build/Scripts/runTests.sh` provides a test-suite `composer`
and allows passing additional command and options directly
down to the composer command.

Due to an invalid quoting the passed options were broking
and not regonized by the `composer` binary.

This change removes the superflous argument passing
and therefore allows passing additional options to the
`composer` command.

Resolves: #967
2023-11-27 15:35:33 +00:00
Oliver Klee
723c5da950
[FEATURE] Add support for PHP 8.3 (#965) 2023-11-01 20:20:27 +00:00
Stefan Bürk
00ba733b0e
[FEATURE] Integrate runTests.sh execution wrapper - round one (#900)
TYPO3 Core and related repositories like the `typo3/testing-framework`
or `typo3/styleguide` uses a bash script arround docker to execute all
scripts over different operating systems in a controlled and ensured
manner. This helps to reproduce locally failing jobs from a CI like
GitHub actions or GitLab.

TYPO3 core dropped recently the requirement for `docker-compose`,
reducing it to `docker` and preparing for dual usage with docker
and podman in the future.

This change integrates the current state as extension wrapper,
aligning contained suits with existing tools. Additionally, a
TYPO3 core version switch is integrated.

The added script is excluded from git archive building and
during releasing.

A list of possible options can be display with:

```shell
Build/Scripts/runTests.sh -h
```

Overview of integrated features:

* `-p` to select the PHP version (7.4 - 8.3)
* `-s` to select the suite to execute
* `-t` to select the TYPO3 core version, mainly
  needed for the `composer` suits executions
* `-e` to provide additionally flags for phpunit
  executions, e.g. for unit and functional tests
* `-x` to enable xdebug trigger - this helps with
  debugging during unit or functional test
* `-d` to select the database backend to use, needed
  for functional test execution to start the correct
  database
* `-a` to select the used php driver for the `-d`
  database backend, if multiple options are possible
* `-i` to specify the mariadb version
* `-j` to specify the mysql version
* `-k` to specify the postgres version

Available suits (`-s`):

- cgl: Checks the code style with the PHP Coding Standards Fixer
  (PHP-CS-Fixer).
- cglFix: Fixes the code style with PHP-CS-Fixer."
- clean: clean up build, cache and testing related files and
  folders
- cleanBuild: clean up build related files and folders
- cleanCache: clean up cache related files and folders
- cleanRenderedDocumentation: clean up rendered documentation
  files and folders (Documentation-GENERATED-temp)
- cleanTests: clean up test related files and folders
- composer: "composer" with all remaining arguments dispatched.
- composerInstallMax: "composer update", with no platform.php config.
- composerInstallMin: "composer update --prefer-lowest", with
  platform.php set to PHP version x.x.0.
- docsGenerate: Renders the extension ReST documentation.
- functional: PHP functional tests
- lintTypoScript: TypoScript linting
- lintPhp: PHP linting
- lintJson: JSON linting
- lintYaml: YAML linting
- phpstan: phpstan tests
- phpstanGenerateBaseline: regenerate phpstan baseline, handy after
  phpstan updates
- unit (default): PHP unit tests
- unitRandom: PHP unit tests in random order, add -o <number> to use
  specific seed

Notes:

* Not everything is available directly for now in the `runTests.sh`
  and therefore not enabled in CI.

* Coverage related execution needs extended work and are therefore
  left out for now.

* `composer.json` protection for core version changes not included
  yet like the one or other advanced option.

* Intermediate cleanings for changing php versions and core versions
  not included yet and will follow.

* typo3/testing-framework template files **must** be copied to the
  extension or project and **must not** be used from the  vendor
  folder.

Resolves: #899
Releases: main
2023-07-31 13:38:07 +02:00